/* ============================================================
   Buhalteris 3.0 — Programos (app) stilius
   Šiltas, ramus SaaS prietaisų skydelis
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=Schibsted+Grotesk:wght@400;500;600;700;800&display=swap');

:root {
  --cream:        #F7F1E3;
  --cream-soft:   #FBF6EC;
  --surface:      #FFFDF8;
  --surface-2:    #FCF7EC;
  --ink:          #2B2A26;
  --ink-soft:     #514E47;
  --muted:        #76726A;
  --line:         #E7DEC9;
  --line-soft:    #EFE8D7;

  --green:        oklch(0.62 0.11 152);
  --green-strong: oklch(0.50 0.12 152);
  --green-soft:   oklch(0.93 0.045 152);
  --coral:        oklch(0.70 0.13 36);
  --coral-strong: oklch(0.60 0.14 36);

  --accent:        var(--green);
  --accent-strong: var(--green-strong);
  --accent-soft:   var(--green-soft);
  --on-accent:     #fffdf8;

  --warn:    oklch(0.74 0.12 70);
  --warn-bg: oklch(0.95 0.05 80);
  --danger:  oklch(0.60 0.16 28);
  --danger-bg: oklch(0.94 0.05 30);
  --info:    oklch(0.60 0.09 240);
  --info-bg: oklch(0.95 0.03 240);

  --sh-sm: 0 1px 2px rgba(60,50,30,.05), 0 2px 6px rgba(60,50,30,.04);
  --sh-md: 0 2px 4px rgba(60,50,30,.04), 0 10px 24px rgba(60,50,30,.06);
  --sh-lg: 0 6px 14px rgba(60,50,30,.06), 0 24px 50px rgba(60,50,30,.10);

  --r-sm: 10px; --r-md: 16px; --r-lg: 22px;
  --sb-w: 268px;
  --ease: cubic-bezier(.22,.61,.36,1);

  /* semantic dark panels (don't invert with theme) */
  --panel-bg: var(--ink);
  --panel-fg: var(--cream-soft);
  --panel-strong: #fff;
}
[data-accent="coral"] { --accent: var(--coral); --accent-strong: var(--coral-strong); --accent-soft: oklch(0.93 0.05 46); }

/* ============ DARK THEME ============ */
[data-theme="dark"] {
  --cream:        #1b1a16;
  --cream-soft:   #232118;
  --surface:      #262420;
  --surface-2:    #211f1b;
  --ink:          #F2EAD8;
  --ink-soft:     #C9C0AC;
  --muted:        #918873;
  --line:         #39352d;
  --line-soft:    #302d26;

  --green:        oklch(0.70 0.12 152);
  --green-strong: oklch(0.78 0.12 152);
  --green-soft:   oklch(0.32 0.045 152);
  --coral:        oklch(0.74 0.13 36);
  --coral-strong: oklch(0.80 0.12 36);

  --accent:        oklch(0.70 0.12 152);
  --accent-strong: oklch(0.80 0.12 152);
  --accent-soft:   oklch(0.32 0.045 152);
  --on-accent:     #16150f;

  --warn:    oklch(0.78 0.12 75);
  --warn-bg: oklch(0.32 0.045 75);
  --danger:  oklch(0.72 0.15 28);
  --danger-bg: oklch(0.32 0.06 28);
  --info:    oklch(0.74 0.09 240);
  --info-bg: oklch(0.32 0.04 240);

  --panel-bg: #131210;
  --panel-fg: #ECE3D1;

  --sh-sm: 0 1px 2px rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.2);
  --sh-md: 0 2px 4px rgba(0,0,0,.25), 0 10px 24px rgba(0,0,0,.3);
  --sh-lg: 0 6px 14px rgba(0,0,0,.3), 0 24px 50px rgba(0,0,0,.45);
}
[data-theme="dark"][data-accent="coral"] { --accent-soft: oklch(0.32 0.05 36); --green-soft: oklch(0.32 0.05 36); }
html { background: var(--cream); transition: background .25s var(--ease); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 15px; line-height: 1.55;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: 'Schibsted Grotesk', sans-serif; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
a { color: inherit; text-decoration: none; }
input, button, select { font-family: inherit; }

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 16px; gap: 14px; z-index: 40;
}
.sb-brand { padding: 6px 8px 2px; }
.sb-logo { display: flex; align-items: center; gap: 10px; font-family: 'Schibsted Grotesk'; font-weight: 700; font-size: 18px; }
.sb-glyph { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; box-shadow: var(--sh-sm); }

/* company switch */
.sb-co { position: relative; }
.co-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 12px; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.co-btn:hover { border-color: var(--accent); box-shadow: var(--sh-sm); }
.co-av { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-family: 'Schibsted Grotesk'; font-weight: 700; font-size: 14px; }
.co-av.sm { width: 28px; height: 28px; font-size: 12px; }
.co-info { flex: 1; min-width: 0; }
.co-info b { font-family: 'Schibsted Grotesk'; font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-info span { font-size: 11.5px; color: var(--muted); }
.co-chev { color: var(--muted); display: flex; transition: transform .2s; }
.sb-co.open .co-chev { transform: rotate(180deg); }
.co-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-lg); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: .2s var(--ease);
}
.sb-co.open .co-menu { opacity: 1; visibility: visible; transform: none; }
.co-opt { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; padding: 9px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 500; transition: background .15s; text-align: left; }
.co-opt:hover { background: var(--surface-2); }
.co-opt.on { color: var(--accent-strong); font-weight: 600; }
.co-tick { margin-left: auto; color: var(--accent-strong); display: flex; }

/* nav */
.sb-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm);
  font-weight: 500; font-size: 14.5px; color: var(--ink-soft); transition: background .15s, color .15s;
}
.ni-ic { display: flex; color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover .ni-ic { color: var(--ink-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-item.active .ni-ic { color: var(--accent-strong); }
.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 3px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px;
  padding: 16px 30px; background: color-mix(in srgb, var(--cream) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.tb-burger { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.tb-burger span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; margin: 4px 0; }
.tb-title h1 { font-size: 22px; }
.tb-title p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tb-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; width: 220px; transition: border-color .2s, width .2s; position: relative; }
.tb-search:focus-within { border-color: var(--accent); width: 280px; }

/* search results dropdown */
.search-results { position: absolute; top: calc(100% + 9px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-lg); padding: 6px; z-index: 60; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .18s var(--ease); max-height: 380px; overflow-y: auto; }
.search-results.open { opacity: 1; visibility: visible; transform: none; }
.sr-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; transition: background .15s; }
.sr-item:hover, .sr-item.hl { background: var(--surface-2); }
.sr-txt { min-width: 0; }
.sr-txt b { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-txt span { font-size: 12px; color: var(--muted); }
.sr-empty { padding: 16px 12px; font-size: 13.5px; color: var(--muted); text-align: center; }
.tbs-ic { color: var(--muted); display: flex; }
.tb-search input { border: none; background: none; outline: none; font-size: 14px; width: 100%; color: var(--ink); }
.tb-icon { position: relative; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; transition: .2s; }
.tb-icon:hover { border-color: var(--accent); color: var(--accent-strong); }
.tb-dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--surface); }
.tb-user { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.tb-av { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-family: 'Schibsted Grotesk'; font-weight: 700; font-size: 14px; }
.tb-uinfo b { font-family: 'Schibsted Grotesk'; font-size: 13.5px; display: block; line-height: 1.2; }
.tb-uinfo span { font-size: 12px; color: var(--muted); }

.content { padding: 30px; max-width: 1320px; width: 100%; }

/* ============ SHARED ELEMENTS ============ */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-family: 'Schibsted Grotesk'; font-weight: 700; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; border: 1.5px solid transparent; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 3px 10px -2px color-mix(in oklch, var(--accent) 50%, transparent); }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-soft:hover { background: color-mix(in oklch, var(--accent-soft) 80%, var(--accent)); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-head h3 { font-size: 17px; }
.card-head .sub { font-size: 13px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge .bd { width: 6px; height: 6px; border-radius: 50%; }
.badge.ok    { background: var(--green-soft); color: var(--green-strong); }
.badge.ok .bd{ background: var(--green-strong); }
.badge.warn  { background: var(--warn-bg); color: oklch(0.45 0.10 70); }
.badge.warn .bd { background: var(--warn); }
.badge.danger{ background: var(--danger-bg); color: var(--danger); }
.badge.danger .bd { background: var(--danger); }
.badge.info  { background: var(--info-bg); color: var(--info); }
.badge.info .bd { background: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.section-title { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* ============ STAT CARDS ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--sh-sm); transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: color-mix(in oklch, var(--accent) 32%, var(--line)); }
.stat .s-ic { width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; margin-bottom: 14px; }
.stat .s-lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .s-val { font-family: 'Schibsted Grotesk'; font-weight: 800; font-size: 27px; letter-spacing: -.02em; margin: 2px 0 6px; }
.stat .s-trend { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.stat .s-trend.up { color: var(--green-strong); }
.stat .s-trend.flat { color: var(--muted); }

/* ============ TABLES ============ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 0 16px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th.num, table.tbl td.num { text-align: right; }
table.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
table.tbl tbody tr { transition: background .15s; cursor: pointer; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.td-emp { display: flex; align-items: center; gap: 12px; }
.td-emp b { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 14px; display: block; }
.td-emp span { font-size: 12.5px; color: var(--muted); }
.td-mono { font-family: 'Schibsted Grotesk'; font-weight: 600; }
.td-accent { color: var(--accent-strong); font-family: 'Schibsted Grotesk'; font-weight: 700; }

/* ============ CHARTS ============ */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; }
.bc-bar { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: var(--accent-soft); position: relative; transition: height .6s var(--ease); }
.bc-col:last-child .bc-bar { background: var(--accent); }
.bc-col:hover .bc-bar { background: var(--accent); }
.bc-val { font-family: 'Schibsted Grotesk'; font-weight: 700; font-size: 12px; color: var(--ink); opacity: 0; transition: opacity .2s; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.bc-col:hover .bc-val { opacity: 1; }
.bc-lbl { font-size: 12px; color: var(--muted); font-weight: 500; }

.donut-row { display: flex; align-items: center; gap: 26px; }
.donut { width: 150px; height: 150px; flex: none; position: relative; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center b { font-family: 'Schibsted Grotesk'; font-weight: 800; font-size: 22px; display: block; line-height: 1; }
.donut .center span { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.legend-item .lg-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-item .lg-lbl { color: var(--ink-soft); }
.legend-item .lg-val { margin-left: auto; font-family: 'Schibsted Grotesk'; font-weight: 700; }

/* progress bars in payslip breakdown */
.split-bars { display: flex; flex-direction: column; gap: 16px; }
.sb-item .sbl { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 7px; }
.sb-item .sbl b { font-family: 'Schibsted Grotesk'; }
.sb-track { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.sb-fill { height: 100%; border-radius: 999px; transition: width .5s var(--ease); }

/* ============ DEADLINES / ACTIVITY ============ */
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.list-row:last-child { border-bottom: none; }
.lr-ic { width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center; }
.lr-body { flex: 1; min-width: 0; }
.lr-body b { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 14px; display: block; }
.lr-body span { font-size: 12.5px; color: var(--muted); }
.lr-meta { text-align: right; flex: none; }

/* ============ MODAL ============ */
.modal-back { position: fixed; inset: 0; background: rgba(43,42,38,.4); backdrop-filter: blur(3px); z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; animation: modalIn .25s var(--ease); }
@keyframes modalIn { from { transform: translateY(16px) scale(.985); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; }
.modal-x { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.modal-x:hover { border-color: var(--danger); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 24px; border-top: 1px solid var(--line); }

.field-l { margin-bottom: 16px; }
.field-l label { display: block; font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: var(--ink-soft); }
.field-l input, .field-l select { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14.5px; color: var(--ink); outline: none; transition: border-color .2s; }
.field-l input:focus, .field-l select:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check-l { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check-l input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ============ TOAST ============ */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--panel-bg); color: var(--panel-fg); padding: 13px 18px; border-radius: 12px; box-shadow: var(--sh-lg); font-size: 14px; font-weight: 500; transform: translateX(120%); opacity: 0; transition: .3s var(--ease); max-width: 360px; }
.toast.in { transform: none; opacity: 1; }
.toast .t-ic { display: flex; color: var(--accent); }
.toast.info .t-ic { color: var(--warn); }

/* ============ PAGE HEAD ROW ============ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-left h2 { font-size: 21px; }
.page-head .ph-left p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.ph-actions { display: flex; gap: 10px; align-items: center; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search-inline { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; flex: 1; min-width: 200px; max-width: 360px; }
.search-inline input { border: none; background: none; outline: none; font-size: 14px; width: 100%; }
.search-inline .si-ic { color: var(--muted); display: flex; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 13px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

/* segmented month picker */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 4px; gap: 2px; }
.seg button { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 13px; border: none; background: none; cursor: pointer; padding: 8px 14px; border-radius: 8px; color: var(--muted); transition: .15s; }
.seg button.on { background: var(--accent-soft); color: var(--accent-strong); }

/* two-col layouts */
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
.grid-2b { display: grid; grid-template-columns: 1fr 1.4fr; gap: 22px; }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 22px; }

/* payslip preview */
.payslip-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-md); overflow: hidden; }
.pd-top { padding: 26px 28px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; }
.pd-top .pd-co { font-family: 'Schibsted Grotesk'; font-weight: 700; font-size: 16px; }
.pd-top .pd-co span { display: block; font-family: 'Hanken Grotesk'; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.pd-top .pd-period { text-align: right; }
.pd-top .pd-period b { font-family: 'Schibsted Grotesk'; font-size: 15px; }
.pd-top .pd-period span { display: block; font-size: 12px; color: var(--muted); }
.pd-emp { padding: 20px 28px; background: var(--surface-2); display: flex; align-items: center; gap: 14px; }
.pd-emp b { font-family: 'Schibsted Grotesk'; font-size: 16px; display: block; }
.pd-emp span { font-size: 13px; color: var(--muted); }
.pd-rows { padding: 18px 28px; }
.pd-row { display: flex; justify-content: space-between; padding: 11px 0; font-size: 14.5px; border-bottom: 1px dashed var(--line); }
.pd-row span { color: var(--ink-soft); }
.pd-row b { font-family: 'Schibsted Grotesk'; font-weight: 600; }
.pd-row.minus b { color: var(--danger); }
.pd-row.plus b { color: var(--green-strong); }
.pd-total { display: flex; justify-content: space-between; align-items: center; padding: 20px 28px; background: var(--panel-bg); color: var(--panel-fg); }
.pd-total .l { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 15px; }
.pd-total .v { font-family: 'Schibsted Grotesk'; font-weight: 800; font-size: 28px; color: var(--panel-strong); }

/* mini ui hint */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty b { font-family: 'Schibsted Grotesk'; display: block; font-size: 16px; color: var(--ink); margin: 10px 0 4px; }

/* App content is visible by default; only below-fold items animate in */
.reveal { opacity: 1; transform: none; }
.reveal.pending { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.pending.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal.pending { opacity: 1 !important; transform: none !important; } }

/* ============ ONBOARDING TOUR ============ */
.tour-back { position: fixed; inset: 0; background: rgba(20,18,14,.55); backdrop-filter: blur(2px); z-index: 90; opacity: 0; transition: opacity .25s var(--ease); }
.tour-back.show { opacity: 1; }
.tour-focus { position: relative; z-index: 92; box-shadow: 0 0 0 4px var(--accent), 0 0 0 10px color-mix(in oklch, var(--accent) 30%, transparent), 0 10px 40px rgba(0,0,0,.3); border-radius: 14px; }
.tour-pop { position: fixed; z-index: 93; width: 320px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-lg); padding: 20px 22px; transition: opacity .2s var(--ease); }
.tour-pop .tp-step { font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 12px; color: var(--accent-strong); letter-spacing: .04em; margin-bottom: 8px; }
.tour-pop h4 { font-size: 18px; margin-bottom: 7px; }
.tour-pop p { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.tour-pop .tp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.tour-pop .tp-skip { background: none; border: none; cursor: pointer; font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 13.5px; color: var(--muted); padding: 6px 4px; }
.tour-pop .tp-skip:hover { color: var(--ink); }

/* ============ ACCESSIBILITY ============ */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible, .nav-item:focus-visible, .bn-item:focus-visible, .co-opt:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}
.tb-search:focus-within { outline: none; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* sidebar scrim (mobile drawer backdrop) */
.sb-scrim { display: none; }

/* mobile bottom-tab nav */
.bottom-nav { display: none; }

/* demo badge in topbar */
.demo-pill { display: inline-flex; align-items: center; gap: 6px; font-family: 'Schibsted Grotesk'; font-weight: 600; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: oklch(0.50 0.10 70); background: var(--warn-bg); padding: 4px 9px; border-radius: 999px; vertical-align: middle; margin-left: 10px; }
.demo-pill .bd { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-2b { grid-template-columns: 1fr; }
  .content { padding: 26px; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .26s var(--ease); box-shadow: var(--sh-lg); width: 280px; }
  body.sb-open .sidebar { transform: none; }
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(43,42,38,.42); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .26s var(--ease), visibility .26s; }
  body.sb-open .sb-scrim { opacity: 1; visibility: visible; }
  body.sb-open { overflow: hidden; }
  .tb-burger { display: block; }
  .tb-search { display: none; }
  .content { padding: 20px 18px; }
  .topbar { padding: 13px 18px; gap: 12px; }
  .tb-right { gap: 9px; }
}
@media (max-width: 640px) {
  /* secondary table columns collapse to keep tables readable without horizontal scroll */
  .col-hide-sm { display: none !important; }
  /* bottom-tab nav */
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 38;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 7px 4px calc(7px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around; box-shadow: 0 -3px 18px rgba(60,50,30,.06); }
  .bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-family: 'Schibsted Grotesk';
    font-weight: 600; font-size: 10px; letter-spacing: -.01em; color: var(--muted); padding: 4px 6px; border-radius: 10px;
    flex: 1; max-width: 76px; transition: color .15s; }
  .bn-item .bn-ic { display: flex; opacity: .85; }
  .bn-item.active { color: var(--accent-strong); }
  .bn-item.active .bn-ic { opacity: 1; }
  .content { padding-bottom: 82px; }
  .toast-wrap { bottom: 88px; right: 16px; left: 16px; }
  .toast { max-width: none; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 16px; }
  .stat .s-ic { width: 36px; height: 36px; margin-bottom: 10px; }
  .stat .s-val { font-size: 21px; }
  .stat .s-lbl { font-size: 12px; }
  .tb-uinfo { display: none; }
  .tb-icon { display: none; }
  .tb-title h1 { font-size: 18px; }
  .tb-title p { display: none; }
  .demo-pill { display: none; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .ph-actions { width: 100%; }
  .ph-actions .btn { flex: 1; }
  .seg { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .seg button { flex: 1; white-space: nowrap; }
  .donut-row { flex-direction: column; align-items: stretch; gap: 18px; }
  .donut { margin: 0 auto; }
  .card-pad { padding: 20px; }
  table.tbl th, table.tbl td { padding-left: 12px; padding-right: 12px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* print payslip */
@media print {
  .sidebar, .topbar, .page-head, .ph-actions, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .payslip-doc { box-shadow: none; border: 1px solid #ccc; }
}
