@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Mono:wght@400;500&family=Inter+Tight:wght@300;400;500;600&display=swap');

/* ── Variabler ─────────────────────────────────────────────── */
:root {
  --bg:         #0c0d10;
  --surface:    #13151c;
  --surface2:   #1a1c26;
  --border:     #22253a;
  --border2:    #2d3150;
  --text:       #dde1ef;
  --muted:      #6b7294;
  --dim:        #3d4265;
  --accent:     #e8a020;
  --accent-dk:  #b87a10;
  --accent-gl:  rgba(232,160,32,.15);
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #3b82f6;
  --purple:     #8b5cf6;
  --nav-w:      220px;
  --r:          8px;
  --r2:         12px;
  --font:       'Inter Tight', system-ui, sans-serif;
  --font-head:  'Syne', sans-serif;
  --font-mono:  'DM Mono', monospace;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: var(--font);
       line-height: 1.6; min-height: 100vh; display: flex; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }

/* ── Nav ───────────────────────────────────────────────────── */
.ink-nav {
  width: var(--nav-w); background: #0f1016; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}

.ink-logo {
  padding: .95rem 1.2rem .8rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .4rem; flex-shrink: 0;
}
.ink-logo-link {
  font-family: var(--font-head); font-size: 1.2rem; font-weight: 800;
  color: var(--accent); letter-spacing: -.02em;
}
.ink-role {
  margin-left: auto; font-size: .57rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); background: rgba(255,255,255,.05);
  padding: .12rem .38rem; border-radius: 4px;
}

.ink-section-label {
  font-size: .58rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--dim);
  padding: .85rem 1.2rem .2rem; opacity: .6;
}

.ink-nav-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .48rem 1.2rem .48rem .9rem;
  color: var(--muted); font-size: .8rem; font-weight: 400;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.ink-nav-item:hover { background: rgba(255,255,255,.03); color: var(--text); opacity: 1; }
.ink-nav-item.active {
  background: var(--accent-gl); color: var(--accent);
  border-left-color: var(--accent); font-weight: 500; opacity: 1;
}
.ink-icon { font-size: .9rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.ink-spacer { flex: 1; min-height: .5rem; }
.ink-bottom { border-top: 1px solid var(--border); padding: .7rem 1.2rem; flex-shrink: 0; }
.ink-user {
  display: flex; align-items: center; gap: .45rem;
  margin-bottom: .4rem; color: inherit;
}
.ink-online { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.ink-uname { font-size: .76rem; font-weight: 600; display: block; color: var(--text); }
.ink-urole { font-size: .61rem; color: var(--muted); display: block; }
.ink-logout { font-size: .69rem; color: var(--muted); transition: color .12s; }
.ink-logout:hover { color: #ff4466; opacity: 1; }

/* ── Indhold ───────────────────────────────────────────────── */
.ink-content {
  margin-left: var(--nav-w); flex: 1; min-width: 0;
  padding: 28px 32px; overflow-x: hidden;
}

/* ── Flash ─────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-radius: var(--r); border: 1px solid transparent;
  font-size: .85rem; margin-bottom: 16px;
}
.flash-success { background: rgba(34,197,94,.1);  border-color: rgba(34,197,94,.3);  color: #22c55e; }
.flash-danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #ef4444; }
.flash-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #f59e0b; }
.flash-info    { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); color: #3b82f6; }
.flash-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ── Page header ───────────────────────────────────────────── */
.page-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-title { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700;
              letter-spacing: -.03em; }
.page-sub   { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }

/* ── KPI ───────────────────────────────────────────────────── */
.kpi-grid { display: grid; gap: 16px;
            grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
            margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 18px 20px; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--kpi-color, var(--accent));
}
.kpi-label { font-size: .68rem; font-weight: 600; letter-spacing: .08em;
             text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 500;
             letter-spacing: -.02em; line-height: 1; }
.kpi-sub   { font-size: .7rem; color: var(--muted); margin-top: 6px; }

/* ── Kort ──────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--r2); overflow: hidden; margin-bottom: 20px; }
.card-hd { display: flex; align-items: center; justify-content: space-between;
           padding: 14px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.card-title { font-family: var(--font-head); font-size: .92rem; font-weight: 700;
              letter-spacing: -.01em; }
.card-body { padding: 20px; }

/* ── Tabel ─────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .83rem; }
table.tbl th {
  text-align: left; padding: 9px 14px;
  font-size: .67rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: rgba(255,255,255,.02); }
.col-mono  { font-family: var(--font-mono); font-size: .82rem; }
.col-amt   { font-family: var(--font-mono); font-size: .88rem; text-align: right; }
.col-amt.pos { color: var(--success); }
.col-amt.neg { color: var(--danger); }

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: .7rem; font-weight: 600; border: 1px solid transparent;
  white-space: nowrap; letter-spacing: .02em;
}

/* ── Knapper ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: var(--r); border: 1px solid transparent;
  font-size: .83rem; font-weight: 500; font-family: var(--font); cursor: pointer;
  transition: all .15s; white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dk); opacity: 1; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); opacity: 1; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; opacity: 1; }
.btn-success { background: var(--success); color: #000; border-color: var(--success); }
.btn-sm { padding: 4px 10px; font-size: .74rem; }
.btn-lg { padding: 10px 22px; font-size: .95rem; }
.btn-row { display: flex; gap: 8px; align-items: center; }

/* ── Formularer ────────────────────────────────────────────── */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); }
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg.full { grid-column: 1/-1; }
.form-label { font-size: .72rem; font-weight: 600; letter-spacing: .04em;
              color: var(--muted); text-transform: uppercase; }
input.fc, select.fc, textarea.fc {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--font); font-size: .875rem; padding: 8px 11px;
  width: 100%; transition: border-color .15s; outline: none;
}
input.fc:focus, select.fc:focus, textarea.fc:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-gl);
}
input.fc::placeholder { color: var(--dim); }
textarea.fc { resize: vertical; min-height: 76px; }
select.fc option { background: var(--surface); }
.form-hint { font-size: .7rem; color: var(--muted); }
.form-err  { font-size: .7rem; color: var(--danger); }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px; font-size: .82rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; background: none; border-top: none;
  border-left: none; border-right: none; font-family: var(--font); transition: all .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Filter-bar ────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar input.fc  { max-width: 240px; }
.filter-bar select.fc { max-width: 180px; }

/* ── Tidslinje ──────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 9px; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.tl-item { position: relative; margin-bottom: 20px; }
.tl-dot {
  position: absolute; left: -23px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center; font-size: 8px;
}
.tl-dot.status_change { border-color: var(--accent); background: var(--accent-gl); }
.tl-dot.payment       { border-color: var(--success); background: rgba(34,197,94,.15); }
.tl-dot.note          { border-color: var(--info); background: rgba(59,130,246,.15); }
.tl-dot.fee_added     { border-color: var(--warning); background: rgba(245,158,11,.15); }
.tl-hd  { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.tl-type { font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tl-time { font-size: .68rem; color: var(--dim); font-family: var(--font-mono); margin-left: auto; }
.tl-body { font-size: .84rem; color: var(--text); line-height: 1.5; }
.tl-by   { font-size: .7rem; color: var(--muted); margin-top: 2px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 500;
            display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r2); width: 100%; max-width: 540px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6); animation: mIn .17s ease;
}
@keyframes mIn { from { opacity:0; transform:scale(.95) translateY(8px); } }
.modal-hd { display: flex; align-items: center; justify-content: space-between;
            padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-family: var(--font-head); font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px;
            padding: 14px 20px; border-top: 1px solid var(--border); }

/* ── Pagination ────────────────────────────────────────────── */
.pag { display: flex; gap: 4px; justify-content: center; padding: 16px 0; }
.pag-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: .78rem;
  font-family: var(--font-mono); cursor: pointer; transition: all .15s; text-decoration: none;
}
.pag-btn:hover { background: var(--surface2); color: var(--text); opacity: 1; }
.pag-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ── Empty state ───────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty h3 { font-family: var(--font-head); color: var(--text); margin-bottom: 6px; }
.empty p  { font-size: .84rem; }

/* ── Login ─────────────────────────────────────────────────── */
body.login-page { display: block; }
.login-wrap { min-height: 100vh; display: flex; align-items: center;
              justify-content: center; background: var(--bg); padding: 20px; }
.login-box { background: var(--surface); border: 1px solid var(--border);
             border-radius: var(--r2); padding: 40px; width: 100%; max-width: 390px;
             box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.login-logo    { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800;
                 color: var(--accent); text-align: center; margin-bottom: 4px;
                 letter-spacing: -.04em; }
.login-tagline { text-align: center; font-size: .72rem; color: var(--muted);
                 margin-bottom: 30px; letter-spacing: .06em; text-transform: uppercase; }

/* ── Utilities ─────────────────────────────────────────────── */
.df   { display: flex; }
.ac   { align-items: center; }
.jb   { justify-content: space-between; }
.g8   { gap: 8px; }
.g12  { gap: 12px; }
.g16  { gap: 16px; }
.mla  { margin-left: auto; }
.mt8  { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mb8  { margin-bottom: 8px; }
.mb16 { margin-bottom: 16px; }
.tc   { text-align: center; }
.tr   { text-align: right; }
.muted  { color: var(--muted); }
.danger { color: var(--danger); }
.succ   { color: var(--success); }
.warn   { color: var(--warning); }
.mono   { font-family: var(--font-mono); }
.sm     { font-size: .8rem; }
.xs     { font-size: .7rem; }
.fw6    { font-weight: 600; }
.w100   { width: 100%; }

@media (max-width:768px) {
  .ink-nav { display: none; }
  .ink-content { margin-left: 0; padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
