/* ============================================================
   Buhalteris 2.0 — application UI (uses tokens from styles.css)
   ============================================================ */

body.app { background: var(--bg-2); overflow-x: hidden; }

/* ---------- App layout ---------- */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; align-self: start;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 14px; gap: 6px; z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16.5px; letter-spacing: -.02em; padding: 8px 8px 14px; }
.sb-brand .logo { width: 30px; height: 30px; border-radius: 9px; flex: none; background: linear-gradient(150deg, var(--accent), var(--accent-strong)); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-sm); }
.sb-brand .logo svg { width: 17px; height: 17px; }

/* company switcher */
.cswitch { position: relative; margin-bottom: 12px; }
.cswitch-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg);
  cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.cswitch-btn:hover { border-color: var(--accent-line); }
.cswitch-btn .cav { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 650; color: #fff; background: var(--ink); }
.cswitch-btn .cmeta { flex: 1; min-width: 0; }
.cswitch-btn .cname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cswitch-btn .ckind { font-size: 11px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cswitch-btn .chev { flex: none; color: var(--ink-faint); transition: transform .2s; }
.cswitch.open .chev { transform: rotate(180deg); }
.cswitch-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 6px; display: none;
}
.cswitch.open .cswitch-menu { display: block; }
.cswitch-item { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--r-sm); cursor: pointer; transition: background .12s; }
.cswitch-item:hover { background: var(--bg); }
.cswitch-item .cav { width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 650; color: #fff; background: var(--ink-soft); }
.cswitch-item.active .cav { background: var(--accent); }
.cswitch-item .ci-name { font-size: 13px; font-weight: 550; flex: 1; }
.cswitch-item .ci-check { color: var(--accent-strong); opacity: 0; }
.cswitch-item.active .ci-check { opacity: 1; }
.cswitch-foot { border-top: 1px solid var(--line-2); margin-top: 6px; padding: 8px 9px 4px; }
.cswitch-foot a { font-size: 12.5px; color: var(--accent-strong); font-weight: 550; display: flex; align-items: center; gap: 7px; }

.sb-section { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; color: var(--ink-soft); cursor: pointer;
  transition: background .12s, color .12s; position: relative;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item .badge { margin-left: auto; font-size: 11px; font-weight: 650; background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 999px; }
.nav-item.active .badge { background: var(--accent-strong); }
.sb-spacer { flex: 1; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); }
.sb-user .uav { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 12px; font-weight: 650; }
.sb-user .uname { font-size: 13px; font-weight: 600; }
.sb-user .urole { font-size: 11px; color: var(--ink-faint); }
.sb-user a { margin-left: auto; color: var(--ink-faint); display: grid; place-items: center; }
.sb-user a:hover { color: var(--ink); }

/* ---------- Topbar ---------- */
.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  background: color-mix(in srgb, var(--bg-2) 86%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 24px;
}
.topbar .menu-btn { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.tb-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.tb-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.tb-spacer { flex: 1; }
.tb-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-faint); width: 220px; }
.tb-search svg { width: 15px; height: 15px; flex: none; }
.tb-search input { border: none; background: none; outline: none; font: inherit; font-size: 13.5px; color: var(--ink); width: 100%; }
.tb-icon { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); position: relative; transition: border-color .15s, color .15s; }
.tb-icon:hover { border-color: var(--accent-line); color: var(--accent-strong); }
.tb-icon .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--surface); }

/* ---------- Content ---------- */
.content { padding: 28px 24px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.page-head .ph-sub { font-size: 14px; color: var(--ink-soft); margin-top: 5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* month selector */
.month-pick { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 4px; }
.month-pick button { width: 30px; height: 30px; border-radius: 999px; border: none; background: none; cursor: pointer; color: var(--ink-soft); display: grid; place-items: center; }
.month-pick button:hover { background: var(--bg); color: var(--ink); }
.month-pick .mlabel { font-size: 13.5px; font-weight: 600; padding: 0 8px; min-width: 116px; text-align: center; }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 15.5px; font-weight: 600; }
.card-head .ch-link { font-size: 13px; font-weight: 550; color: var(--accent-strong); cursor: pointer; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.kpi .kic { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; margin-bottom: 14px; }
.kpi .kic svg { width: 19px; height: 19px; }
.kpi .klabel { font-size: 12.5px; color: var(--ink-faint); font-weight: 500; }
.kpi .kval { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; font-family: var(--mono); font-feature-settings: "tnum"; }
.kpi .ktrend { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.kpi .ktrend.up { color: #1F8A5B; }
.kpi .ktrend.down { color: #B4453B; }
.kpi .ktrend.flat { color: var(--ink-faint); }
.kpi .ktrend svg { width: 13px; height: 13px; }

.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Allow grid items to shrink so wide tables scroll inside their .table-wrap
   instead of forcing horizontal page overflow (mainly on mobile). */
.kpi-grid > *, .grid-2 > *, .grid-2-even > * { min-width: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 0 16px 12px; white-space: nowrap; }
table.data thead { border-bottom: 1px solid var(--line); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink-soft); white-space: nowrap; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--bg); }
table.data tbody tr.clickable { cursor: pointer; }
table.data .num { text-align: right; font-family: var(--mono); font-feature-settings: "tnum"; }
table.data td.strong { color: var(--ink); font-weight: 600; }
table.data tr.total td { border-top: 1.5px solid var(--line); border-bottom: none; font-weight: 650; color: var(--ink); background: var(--bg); }
.cell-emp { display: flex; align-items: center; gap: 11px; }
.cell-emp .av { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 12px; font-weight: 650; }
.cell-emp .nm { color: var(--ink); font-weight: 550; }
.cell-emp .pos { font-size: 12px; color: var(--ink-faint); }
.editable-cell { display: inline-flex; align-items: center; }
.editable-cell input { width: 86px; text-align: right; font-family: var(--mono); font-size: 13.5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.editable-cell input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }

/* ---------- Badges ---------- */
.badge-st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge-st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-st.ok { color: #1F8A5B; background: #E7F3EC; }
.badge-st.warn { color: #B07A1E; background: #F8F0DE; }
.badge-st.info { color: var(--accent-strong); background: var(--accent-soft); }
.badge-st.muted { color: var(--ink-faint); background: var(--bg-2); }

/* ---------- Deadlines / list rows ---------- */
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-ic { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-soft); }
.list-row .lr-ic.acc { background: var(--accent-soft); color: var(--accent-strong); }
.list-row .lr-ic svg { width: 18px; height: 18px; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 13.5px; font-weight: 550; color: var(--ink); }
.list-row .lr-sub { font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.list-row .lr-meta { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }

.act-row { display: flex; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--line-2); }
.act-row:last-child { border-bottom: none; }
.act-row .ad { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-line); margin-top: 6px; flex: none; }
.act-row .at { font-size: 13px; color: var(--ink); line-height: 1.45; }
.act-row .at b { font-weight: 600; }
.act-row .aw { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- Chart ---------- */
.chart { width: 100%; height: 220px; }
.chart .bar { fill: var(--accent); transition: fill .2s; }
.chart .bar.muted { fill: var(--accent-line); }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-lbl { fill: var(--ink-faint); font-size: 11px; font-family: var(--font); }
.chart .val-lbl { fill: var(--ink-soft); font-size: 10.5px; font-weight: 600; font-family: var(--mono); }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(18,24,31,.34); backdrop-filter: blur(2px); z-index: 80; opacity: 0; transition: opacity .25s; }
.drawer-scrim.in { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(440px, 92vw); z-index: 90;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column; overflow-y: auto;
}
.drawer.in { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.drawer-head .x { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); }
.drawer-head .x:hover { color: var(--ink); border-color: var(--accent-line); }
.drawer-body { padding: 22px; }
.emp-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.emp-hero .av { width: 56px; height: 56px; border-radius: 50%; flex: none; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 19px; font-weight: 650; }
.emp-hero .nm { font-size: 18px; font-weight: 650; }
.emp-hero .pos { font-size: 13px; color: var(--ink-soft); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 20px; }
.kv .cell { background: var(--surface); padding: 12px 14px; }
.kv .k { font-size: 11.5px; color: var(--ink-faint); font-weight: 500; }
.kv .v { font-size: 14px; color: var(--ink); font-weight: 550; margin-top: 2px; }

/* ---------- Payslip document ---------- */
.payslip-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); max-width: 560px; margin: 0 auto; overflow: hidden; }
.psd-head { padding: 26px 30px; border-bottom: 1px solid var(--line-2); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.psd-head .psd-co { font-size: 16px; font-weight: 650; }
.psd-head .psd-meta { font-size: 12px; color: var(--ink-faint); margin-top: 3px; line-height: 1.5; }
.psd-head .psd-tag { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.psd-emp { padding: 20px 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-bottom: 1px solid var(--line-2); background: var(--bg); }
.psd-emp .k { font-size: 11.5px; color: var(--ink-faint); }
.psd-emp .v { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.psd-rows { padding: 14px 30px; }
.psd-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 13.5px; }
.psd-row span { color: var(--ink-soft); }
.psd-row b { font-family: var(--mono); font-weight: 550; color: var(--ink); }
.psd-row.minus b { color: #B4453B; }
.psd-row.section-lbl { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); padding-top: 14px; border-top: 1px solid var(--line-2); margin-top: 6px; }
.psd-net { margin: 6px 30px 0; padding: 18px 0 26px; border-top: 2px solid var(--ink); display: flex; align-items: center; justify-content: space-between; }
.psd-net span { font-size: 15px; font-weight: 650; }
.psd-net b { font-family: var(--mono); font-size: 24px; font-weight: 650; color: var(--accent-strong); }

/* select / inputs */
.fld-select { height: 38px; padding: 0 32px 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2351565F' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.fld-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* empty / banner */
.info-banner { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-strong); font-size: 13.5px; font-weight: 500; margin-bottom: 18px; }
.info-banner svg { width: 18px; height: 18px; flex: none; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 200; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.in { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; color: #6BD79B; }

/* segmented control */
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; font: inherit; font-size: 13px; font-weight: 550; color: var(--ink-soft); padding: 7px 16px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Mobile ---------- */
.sb-backdrop { display: none; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .26s cubic-bezier(.2,.7,.2,1); }
  .app-shell.sb-open .sidebar { transform: none; }
  .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(18,24,31,.34); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .app-shell.sb-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  .topbar .menu-btn { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
  .tb-search { display: none; }
}
@media (max-width: 560px) {
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .page-head h1 { font-size: 22px; }
}

/* ---------- Modal & forms ---------- */
.modal-scrim { position: fixed; inset: 0; z-index: 120; background: rgba(18,24,31,.4); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 20px 20px; opacity: 0; transition: opacity .2s; overflow-y: auto; }
.modal-scrim.in { opacity: 1; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); transform: translateY(14px) scale(.98); opacity: 0; transition: transform .22s cubic-bezier(.2,.7,.2,1), opacity .22s; }
.modal.in { transform: none; opacity: 1; }
.modal.wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.modal-head .x { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); }
.modal-head .x:hover { color: var(--ink); border-color: var(--accent-line); }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line-2); background: var(--bg); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.ff { display: flex; flex-direction: column; gap: 7px; }
.ff-label { font-size: 12.5px; font-weight: 550; color: var(--ink); }
.ff-input-wrap { position: relative; display: flex; align-items: center; }
.ff-input { width: 100%; height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 14px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.ff-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ff-suffix { position: absolute; right: 13px; font-size: 13px; color: var(--ink-faint); font-family: var(--mono); pointer-events: none; }
.ff-toggle { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s; }
.ff-toggle:hover { border-color: var(--accent-line); }
.switch { width: 40px; height: 24px; border-radius: 999px; background: var(--bg-2); position: relative; flex: none; transition: background .18s; border: 1px solid var(--line); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on .knob { transform: translateX(16px); }

.danger-link { color: #B4453B; font-size: 13px; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.danger-link:hover { text-decoration: underline; }

/* notifications dropdown */
.notif-pop { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 70; overflow: hidden; }
.notif-head { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.notif-head h4 { font-size: 14px; font-weight: 600; }
.notif-head a { font-size: 12px; color: var(--accent-strong); font-weight: 550; cursor: pointer; }
.notif-item { display: flex; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.notif-item:last-child { border-bottom: none; }
.notif-item .ni-ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.notif-item .ni-ic svg { width: 16px; height: 16px; }
.notif-item .ni-t { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.notif-item .ni-sub { font-size: 12px; color: var(--ink-soft); line-height: 1.4; margin-top: 2px; }
.notif-item .ni-w { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
.notif-item .ni-ic.ni-warn { background: #F8F0DE; color: #B07A1E; }
.notif-item .ni-ic.ni-ok { background: #E7F3EC; color: #1F8A5B; }
.notif-item .ni-ic.ni-muted { background: var(--bg-2); color: var(--ink-faint); }
[data-theme="dark"] .notif-item .ni-ic.ni-warn { background: color-mix(in srgb,#B07A1E 24%,var(--surface)); color: #E8B860; }
[data-theme="dark"] .notif-item .ni-ic.ni-ok { background: color-mix(in srgb,#1F8A5B 22%,var(--surface)); color: #6BD79B; }
.tb-icon-wrap { position: relative; }
@media (max-width: 560px) { .notif-pop { width: calc(100vw - 32px); right: -8px; } }

/* ---------- Topbar search dropdown ---------- */
.tb-search-wrap { position: relative; }
.search-pop { position: absolute; top: calc(100% + 8px); left: 0; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 70; overflow: hidden; padding: 6px; }
.search-item { padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; transition: background .12s; }
.search-item:hover { background: var(--bg); }

/* ---------- Onboarding checklist ---------- */
.onboard { padding: 22px; margin-bottom: 20px; position: relative; overflow: hidden; }
.onboard-x { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-faint); }
.onboard-x:hover { color: var(--ink); }
.onboard-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.onboard-ring { position: relative; width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.onboard-ring svg { position: absolute; inset: 0; width: 52px; height: 52px; transform: rotate(-90deg); }
.onboard-ring .ring-bg { fill: none; stroke: var(--bg-2); stroke-width: 3.5; }
.onboard-ring .ring-fg { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 97; transition: stroke-dashoffset .6s ease; }
.onboard-ring span { font-size: 12px; font-weight: 650; font-family: var(--mono); color: var(--accent-strong); }
.onboard-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.onboard-step { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13.5px; }
.onboard-step.done { background: var(--bg); }
.onboard-step:not(.done) { cursor: pointer; border-color: var(--accent-line); }
.onboard-step:not(.done):hover { background: var(--accent-soft); }
.onboard-step .os-check { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.onboard-step.done .os-check { background: var(--accent); color: #fff; }
.onboard-step:not(.done) .os-check { border: 1.5px dashed var(--accent-line); color: var(--accent-strong); }
.onboard-step .os-num { font-size: 11px; font-weight: 650; }
.onboard-step .os-t { flex: 1; color: var(--ink); font-weight: 500; }
.onboard-step.done .os-t { color: var(--ink-soft); }
.onboard-step .os-go { font-size: 12px; font-weight: 600; color: var(--accent-strong); }
@media (max-width: 620px) { .onboard-steps { grid-template-columns: 1fr; } }

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg: #15171C;
  --bg-2: #1C2026;
  --surface: #1F242B;
  --ink: #ECEEF1;
  --ink-soft: #AEB4BE;
  --ink-faint: #727883;
  --line: rgba(255,255,255,.11);
  --line-2: rgba(255,255,255,.06);
  --accent: oklch(0.64 0.15 258);
  --accent-strong: oklch(0.78 0.11 258);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 38%, var(--surface));
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 14px rgba(0,0,0,.36);
  --shadow-lg: 0 10px 34px rgba(0,0,0,.46);
}
[data-theme="dark"] body.app { background: var(--bg-2); }
[data-theme="dark"] .editable-cell input { background: var(--bg-2); }
[data-theme="dark"] .badge-st.ok { background: color-mix(in srgb, #1F8A5B 22%, var(--surface)); color: #6BD79B; }
[data-theme="dark"] .badge-st.warn { background: color-mix(in srgb, #B07A1E 24%, var(--surface)); color: #E8B860; }
[data-theme="dark"] .psd-row.minus b, [data-theme="dark"] .calc-row.minus b { color: #E68A7E; }
[data-theme="dark"] .switch .knob, [data-theme="dark"] .calc-toggle .switch .knob { background: #E8EAED; }

/* ---------- Document sheet (sutartis / pažyma) ---------- */
.doc-sheet { background: #fff; color: #16191D; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 34px 38px; font-size: 13.5px; line-height: 1.6; }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid #16191D; }
.doc-co { font-size: 16px; font-weight: 700; }
.doc-meta { font-size: 11.5px; color: #51565F; margin-top: 3px; }
.doc-no { font-size: 11.5px; color: #51565F; }
.doc-title { font-size: 19px; font-weight: 700; text-align: center; letter-spacing: .02em; margin: 26px 0 4px; color: #16191D; }
.doc-place { text-align: center; font-size: 12px; color: #51565F; margin-bottom: 22px; }
.doc-body p { margin-bottom: 14px; }
.doc-body ol { margin: 0 0 18px 20px; display: flex; flex-direction: column; gap: 9px; }
.doc-body ol li { padding-left: 4px; }
.doc-table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; }
.doc-table td { padding: 9px 12px; border: 1px solid var(--line); }
.doc-table td:last-child { text-align: right; font-family: var(--mono); width: 160px; }
.doc-table .doc-total td { font-weight: 700; background: var(--bg); }
.doc-sign { display: flex; gap: 40px; margin-top: 36px; }
.doc-sign > div { flex: 1; }
.doc-sign span { font-size: 11.5px; color: #51565F; }
.doc-line { height: 1px; background: #16191D; margin-top: 30px; }

/* ---------- Leave calendar ---------- */
.cal-grid { display: grid; align-items: center; min-width: 760px; }
.cal-corner { height: 30px; }
.cal-dnum { font-size: 10.5px; color: var(--ink-faint); text-align: center; font-family: var(--mono); padding-bottom: 6px; }
.cal-emp { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink); font-weight: 500; padding: 6px 16px 6px 22px; white-space: nowrap; overflow: hidden; }
.cal-emp .av { flex: none; }
.cal-emp span:last-child { overflow: hidden; text-overflow: ellipsis; }
.cal-cell { height: 26px; margin: 2px 1px; border-radius: 4px; background: var(--bg-2); }

/* ---------- Integrations ---------- */
.integ-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.integ { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.integ .ilogo { width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.integ .iname { font-size: 14px; font-weight: 600; }
.integ .idesc { font-size: 12px; color: var(--ink-faint); }
.integ .ibtn { margin-left: auto; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty .eic { width: 60px; height: 60px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; margin: 0 auto 18px; }
.empty .eic svg { width: 28px; height: 28px; }
.empty h3 { font-size: 18px; font-weight: 650; }
.empty p { font-size: 14px; color: var(--ink-soft); margin: 8px auto 22px; max-width: 360px; line-height: 1.55; }

/* ---------- Print (payslip + documents → PDF) ---------- */
@media print {
  body.print-payslip, body.print-doc { background: #fff !important; }
  .print-payslip .sidebar, .print-payslip .topbar, .print-payslip .page-head,
  .print-payslip .sb-backdrop, .print-payslip .pay-toolbar, .print-payslip .pay-foot,
  .print-payslip .toast, .print-payslip .info-banner { display: none !important; }
  .print-payslip .app-shell, .print-payslip .main-col { display: block !important; }
  .print-payslip .content { padding: 0 !important; max-width: 100% !important; }
  .print-payslip .payslip-doc { box-shadow: none !important; border: 1px solid #ddd !important; max-width: 100% !important; margin: 0 !important; }
  .print-doc .modal-scrim { position: static !important; background: none !important; padding: 0 !important; backdrop-filter: none !important; }
  .print-doc .modal { max-width: 100% !important; box-shadow: none !important; border: none !important; transform: none !important; }
  .print-doc .modal-head, .print-doc .modal-foot { display: none !important; }
  .print-doc .modal-body { padding: 0 !important; }
  .print-doc .doc-sheet { border: none !important; }
  .print-doc .sidebar, .print-doc .topbar { display: none !important; }
}

body.login { background: var(--bg); }

/* ---------- Command palette (⌘K) ---------- */
.cmdk-scrim { position: fixed; inset: 0; z-index: 300; background: rgba(18,24,31,.4); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; opacity: 0; transition: opacity .18s; }
.cmdk-scrim.in { opacity: 1; }
.cmdk { width: 100%; max-width: 540px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(-10px) scale(.99); transition: transform .2s cubic-bezier(.2,.7,.2,1); }
.cmdk-scrim.in .cmdk { transform: none; }
.cmdk-input { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); color: var(--ink-faint); }
.cmdk-input input { flex: 1; border: none; background: none; outline: none; font: inherit; font-size: 15.5px; color: var(--ink); }
.cmdk-input kbd { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-item:hover, .cmdk-item:first-child { background: var(--bg); }
.cmdk-ic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.cmdk-lbl { flex: 1; font-size: 14px; color: var(--ink); }
.cmdk-hint { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; }
.cmdk-empty { padding: 24px; text-align: center; font-size: 13.5px; color: var(--ink-faint); }

/* ---------- Wizard ---------- */
.wiz-steps { display: flex; gap: 8px; }
.wiz-step { flex: 1; display: flex; align-items: center; gap: 9px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--ink-faint); }
.wiz-step.on { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.wiz-step.done { color: var(--ink-soft); }
.wiz-step .ws-n { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 650; background: var(--bg-2); color: var(--ink-soft); }
.wiz-step.on .ws-n { background: var(--accent); color: #fff; }
.wiz-step.done .ws-n { background: var(--accent); color: #fff; }
.wiz-dots { display: flex; gap: 6px; align-items: center; }
.wiz-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.wiz-dot.on { background: var(--accent); width: 22px; border-radius: 99px; }
.wiz-dot.done { background: var(--accent-line); }
.kbd-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-faint); }
.kbd-hint kbd { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; background: var(--surface); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-left { display: flex; flex-direction: column; justify-content: center; padding: 6vw 7vw; max-width: 560px; margin-left: auto; }
.login-left .brand { margin-bottom: 40px; }
.login-card { width: 100%; }
.login-card h1 { font-size: 30px; font-weight: 650; letter-spacing: -.02em; }
.login-card .seg2 { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; gap: 3px; width: 100%; }
.login-card .seg2 button { flex: 1; border: none; background: none; font: inherit; font-size: 14px; font-weight: 550; color: var(--ink-soft); padding: 10px 18px; border-radius: 999px; cursor: pointer; transition: background .18s, color .18s; }
.login-card .seg2 button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.login-card p.sub { font-size: 15px; color: var(--ink-soft); margin-top: 8px; margin-bottom: 28px; }
.fld { margin-bottom: 16px; }
.fld label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 7px; }
.fld input { width: 100%; height: 46px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 14.5px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.fld input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: 13px; }
.login-row a { color: var(--accent-strong); font-weight: 550; }
.login-row label { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); cursor: pointer; }
.login-foot { margin-top: 24px; font-size: 13.5px; color: var(--ink-soft); text-align: center; }
.login-foot a { color: var(--accent-strong); font-weight: 600; }
.login-demo { margin-top: 22px; padding: 13px 16px; border-radius: var(--r-sm); background: var(--bg-2); font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; }
.login-demo svg { width: 17px; height: 17px; color: var(--accent-strong); flex: none; }
.login-right { position: relative; background: var(--ink); overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-right::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 60% at 70% 20%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%); }
.login-quote { position: relative; max-width: 420px; color: #fff; }
.login-quote .lq-mark { font-size: 56px; line-height: 1; color: var(--accent-line); font-family: var(--mono); }
.login-quote p { font-size: 21px; line-height: 1.5; font-weight: 500; letter-spacing: -.01em; margin-top: 4px; }
.login-quote .lq-who { margin-top: 22px; font-size: 14px; color: color-mix(in srgb,#fff 75%, transparent); }
.login-quote .lq-who b { color: #fff; font-weight: 600; display: block; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-right { display: none; } .login-left { margin: 0 auto; } }
