/* Violet Finance — design system
   Plum sidebar, violet brand (Menekşe), slab numerals for transaction numbers (same face as the printed forms). */
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../vendor/fonts/public-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../vendor/fonts/public-sans-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Zilla Slab'; font-weight: 400; src: url('../fonts/ZillaSlab-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Zilla Slab'; font-weight: 600; src: url('../fonts/ZillaSlab-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Zilla Slab'; font-weight: 700; src: url('../fonts/ZillaSlab-Bold.ttf') format('truetype'); }

:root {
  --plum: #24102F;
  --plum-2: #341946;
  --violet: #6B2FA0;
  --violet-2: #8B4FC4;
  --violet-50: #F3ECFA;
  --violet-100: #E6D8F4;
  --ink: #1D1A24;
  --ink-2: #4A4458;
  --muted: #776F86;
  --paper: #F6F4F9;
  --card: #FFFFFF;
  --line: #E4DFEB;
  --line-2: #EFEBF4;
  --signed: #1F8A5B;
  --signed-50: #E5F4EC;
  --pending: #B26B12;
  --pending-50: #FBF0DF;
  --info: #2457C5;
  --info-50: #E7EEFB;
  --danger: #B42318;
  --danger-50: #FCEAE8;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(36, 16, 47, .06), 0 8px 24px -16px rgba(36, 16, 47, .25);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --slab: 'Zilla Slab', Georgia, serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; color: var(--ink); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
small, .muted { color: var(--muted); }
.slab { font-family: var(--slab); }
:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 2px; border-radius: 4px; }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--plum); color: #E9DFF2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; text-decoration: none !important; }
.side-brand img { width: 36px; height: 36px; border-radius: 9px; background: #fff; padding: 3px; object-fit: contain; }
.side-brand b { display: block; font-size: 15px; letter-spacing: .01em; }
.side-brand small { color: #B9A5CB; font-size: 11.5px; }
.side-nav { padding: 6px 12px 20px; display: flex; flex-direction: column; gap: 2px; }
.side-group { margin: 16px 10px 6px; font-size: 11.5px; color: #9D88B2; font-weight: 600; }
.side a.nav { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: #E2D7EC;
  font-weight: 500; transition: background .15s, color .15s; text-decoration: none; }
.side a.nav i { width: 18px; text-align: center; color: #B39BC9; font-size: 14px; }
.side a.nav:hover { background: var(--plum-2); color: #fff; }
.side a.nav.active { background: #fff; color: var(--plum); font-weight: 650; }
.side a.nav.active i { color: var(--violet); }
.side a.nav .count { margin-left: auto; background: var(--violet-2); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px; }
.side-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--plum-2); display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
  background: var(--violet-2); color: #fff; flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: #B9A5CB; }
.side-foot button { background: none; border: 0; color: #B9A5CB; cursor: pointer; padding: 6px; border-radius: 6px; }
.side-foot button:hover { color: #fff; background: var(--plum-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(246, 244, 249, .86);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line-2); }
.top .burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs b { color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bell { position: relative; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); }
.bell .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--violet);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }

/* ------------------------------------------------------------------ page head */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 70ch; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 13.5px var(--sans); cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { border-color: #CFC6DA; background: #FBFAFD; }
.btn:active { transform: translateY(1px); }
.btn i { font-size: 13px; }
.btn-primary { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 6px 16px -8px rgba(107, 47, 160, .7); }
.btn-primary:hover { background: #5C2690; border-color: #5C2690; }
.btn-sign { background: var(--signed); border-color: var(--signed); color: #fff; }
.btn-sign:hover { background: #18734B; border-color: #18734B; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-50); border-color: #F2C3BD; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--violet-50); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { width: 34px; padding: 0; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.panel-head h2 { font-size: 15px; }
.panel-head .right { margin-left: auto; }
.panel-body { padding: 16px 20px 20px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ------------------------------------------------------------------ forms */
.fgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.field .req { color: var(--violet); }
.input, select.input, textarea.input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 0 11px; font: 14px var(--sans); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--violet-2); box-shadow: 0 0 0 3px rgba(139, 79, 196, .16); }
.input[readonly], .input.ro { background: #FAF9FC; color: var(--ink-2); }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.computed { min-height: 38px; display: flex; align-items: center; padding: 0 11px; border-radius: 8px; background: var(--paper);
  border: 1px dashed var(--line); color: var(--ink-2); font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hint { font-size: 12px; color: var(--muted); }
.radios { display: flex; gap: 6px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; font-weight: 500; background: #fff; }
.radios input { accent-color: var(--violet); }
.radios label:has(input:checked) { border-color: var(--violet-2); background: var(--violet-50); color: var(--plum); font-weight: 650; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { accent-color: var(--violet); width: 16px; height: 16px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #D7D0E0; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--violet); }
.switch input:checked + span::after { transform: translateX(16px); }
.section-title { font-size: 13px; font-weight: 700; color: var(--plum); margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; height: 1px; background: var(--line); flex: 1; }

/* lookup (searchable drop-down) */
.lk { position: relative; }
.lk-btn { width: 100%; height: 38px; display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; padding: 0 30px 0 11px; font: 14px var(--sans); color: var(--ink); cursor: pointer; position: relative; }
.lk-btn .ph { color: #A79FB4; }
.lk-btn .val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lk-btn::after { content: '\f107'; font: var(--fa-font-solid); position: absolute; right: 11px; color: var(--muted); font-size: 12px; }
.lk-btn:focus { outline: none; border-color: var(--violet-2); box-shadow: 0 0 0 3px rgba(139, 79, 196, .16); }
.lk-pop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 100%; width: max(100%, 340px); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 40px -16px rgba(36, 16, 47, .35); overflow: hidden; }
.lk-pop input { border: 0; border-bottom: 1px solid var(--line-2); width: 100%; height: 40px; padding: 0 12px; font: 14px var(--sans); }
.lk-pop input:focus { outline: none; }
.lk-list { max-height: 280px; overflow-y: auto; padding: 4px; }
.lk-item { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; }
.lk-item.on, .lk-item:hover { background: var(--violet-50); }
.lk-item b { font-weight: 600; font-size: 13.5px; }
.lk-item small { font-size: 12px; }
.lk-empty { padding: 14px; color: var(--muted); font-size: 13px; }
.lk-clear { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: #A79FB4; cursor: pointer; padding: 4px; }

/* ------------------------------------------------------------------ tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #FCFBFD; position: sticky; top: 0; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #FBF9FD; }
.tbl tr.link { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.ref { font-family: var(--slab); font-weight: 600; font-size: 15px; color: var(--plum); letter-spacing: .02em; white-space: nowrap; }

/* editable line tables */
.lines { border: 1px solid var(--line); border-radius: 12px; overflow: auto; background: #fff; }
.lines table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.lines th { font-size: 12px; font-weight: 650; color: var(--muted); text-align: left; padding: 9px 8px; background: #FCFBFD;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.lines td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.lines td.sn { width: 34px; text-align: center; color: var(--muted); font-size: 12px; }
.lines .input, .lines .lk-btn { height: 34px; font-size: 13.5px; }
.lines .computed { min-height: 34px; font-size: 13.5px; }
.lines tfoot td { background: #FCFBFD; border-bottom: 0; }
.lines .add { padding: 10px 12px; }
.row-enter { animation: rowIn .28s var(--ease); }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); background: var(--violet-50); } to { opacity: 1; transform: none; } }
.totals { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; }
.totals div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; text-align: right; min-width: 150px; }
.totals small { display: block; font-size: 11.5px; }
.totals b { font-family: var(--slab); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px;
  font-weight: 650; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-draft { background: #EEEAF3; color: #5D5470; }
.st-signing { background: var(--info-50); color: var(--info); }
.st-to_pay { background: var(--pending-50); color: var(--pending); }
.st-done { background: var(--signed-50); color: var(--signed); }
.st-cancel, .st-cancelled { background: var(--danger-50); color: var(--danger); }
.st-reserved { background: var(--violet-50); color: var(--violet); }
.st-used { background: var(--signed-50); color: var(--signed); }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; font: 600 13.5px var(--sans); color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 7px; align-items: center; }
.tabs button.on, .tabs a.on { color: var(--plum); border-bottom-color: var(--violet); }
.tabs .n { background: var(--violet-50); color: var(--violet); border-radius: 999px; font-size: 11px; padding: 0 7px; }

/* ------------------------------------------------------------------ document header */
.doc-head { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: start; margin-bottom: 18px; }
.doc-title small { font-weight: 600; color: var(--muted); }
.doc-number { font-family: var(--slab); font-size: 40px; font-weight: 600; letter-spacing: .02em; color: var(--plum); line-height: 1.05;
  display: inline-flex; align-items: center; gap: 12px; }
.doc-number.empty { font-size: 22px; color: #A79FB4; font-family: var(--sans); font-weight: 600; }
.stamp { display: inline-block; border: 2px solid currentColor; border-radius: 6px; padding: 2px 10px; font-family: var(--slab);
  font-weight: 700; font-size: 14px; letter-spacing: .06em; transform: rotate(-3deg); }
.stamp.st-done { color: var(--signed); background: transparent; }
.stamp.st-to_pay { color: var(--pending); background: transparent; }
.stamp.st-signing { color: var(--info); background: transparent; }
.stamp.st-draft { color: #8A8199; background: transparent; }
.stamp.st-cancel { color: var(--danger); background: transparent; }
.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* signature trail */
.trail { display: flex; align-items: stretch; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px 12px;
  margin-bottom: 18px; overflow-x: auto; }
.step { flex: 1 1 130px; min-width: 120px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; padding: 0 6px; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 16px; left: calc(50% + 21px); right: calc(-50% + 21px); height: 2px;
  background: repeating-linear-gradient(90deg, #D9D1E4 0 6px, transparent 6px 10px); }
.step .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #D9D1E4; background: #fff;
  color: #A79FB4; font-size: 13px; position: relative; z-index: 1; margin-bottom: 7px; }
.step b { font-size: 12.5px; }
.step span { font-size: 12px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step small { font-size: 11px; color: #A79FB4; }
.step.done .dot { background: var(--signed); border-color: var(--signed); color: #fff; }
.step.done::after { background: var(--signed) !important; }
.step.done small { color: var(--signed); }
.step.now .dot { background: var(--violet); border-color: var(--violet); color: #fff; animation: pulse 1.8s ease-in-out infinite; }
.step.now b { color: var(--violet); }
.step.now small { color: var(--violet); font-weight: 700; }
.step.pick .dot { border-style: dashed; color: var(--pending); border-color: #E3C38F; }
.step.pick small { color: var(--pending); }
.step.skip { opacity: .45; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(107, 47, 160, .18); } 50% { box-shadow: 0 0 0 9px rgba(107, 47, 160, .04); } }

/* ------------------------------------------------------------------ alerts & toasts */
.alert { border-radius: 10px; padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin-bottom: 16px; }
.alert i { margin-top: 3px; }
.alert-err { background: var(--danger-50); color: #7A1A12; border: 1px solid #F3C7C1; }
.alert-ok { background: var(--signed-50); color: #12583A; border: 1px solid #BDE3CD; }
.alert-info { background: var(--violet-50); color: var(--plum); border: 1px solid var(--violet-100); }
.alert-warn { background: var(--pending-50); color: #6D420B; border: 1px solid #EBD3A8; }
.alert ul { margin: 0; padding-left: 18px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--plum); color: #fff; border-radius: 10px; padding: 11px 16px; box-shadow: 0 14px 30px -10px rgba(36, 16, 47, .5);
  display: flex; gap: 10px; align-items: center; animation: toastIn .35s var(--ease); max-width: 420px; }
.toast i { color: #8EE0B6; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ modal */
.modal-bg { position: fixed; inset: 0; background: rgba(36, 16, 47, .45); backdrop-filter: blur(2px); z-index: 80; display: grid;
  place-items: center; padding: 20px; animation: fadeIn .2s; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  box-shadow: 0 30px 80px -20px rgba(36, 16, 47, .5); animation: modalIn .3s var(--ease); }
.modal-lg { width: min(820px, 100%); }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 17px; }
.modal-head .x { margin-left: auto; border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 0 22px 20px; display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ------------------------------------------------------------------ filters bar */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.search .input { padding-left: 34px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 12.5px var(--sans);
  color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none !important; }
.chip.on { background: var(--plum); border-color: var(--plum); color: #fff; }
.chip .n { font-size: 11px; opacity: .75; }
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 20px; align-items: center; color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty i { font-size: 30px; color: var(--violet-100); margin-bottom: 10px; display: block; }
.empty b { color: var(--ink); display: block; font-size: 15px; margin-bottom: 4px; }

/* ------------------------------------------------------------------ attachments */
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); transition: all .2s;
  cursor: pointer; background: #FCFBFD; }
.drop.over { border-color: var(--violet-2); background: var(--violet-50); color: var(--plum); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.file { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.file .ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--danger-50); color: var(--danger); flex: none; }
.file .ic.img { background: var(--info-50); color: var(--info); }
.file .nm { min-width: 0; flex: 1; }
.file .nm b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* activity */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--violet-50); color: var(--violet); font-size: 12px; flex: none; }
.feed-item p { font-size: 13.5px; }
.feed-item small { font-size: 12px; }

/* signature pad */
.pad-wrap { border: 1px dashed #CBBFDA; border-radius: 14px; background:
  linear-gradient(transparent 79%, #E9E2F1 79%, #E9E2F1 80%, transparent 80%), #fff; position: relative; touch-action: none; }
.pad-wrap canvas { width: 100%; height: 200px; display: block; cursor: crosshair; }
.pad-wrap .ph { position: absolute; left: 18px; bottom: 16%; color: #BDB2CB; pointer-events: none; font-size: 13px; }
.sig-preview { height: 80px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; background: #fff; }
.sig-preview img { max-height: 70px; max-width: 90%; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  .top { padding: 0 16px; }
  .top .burger { display: grid; }
  .content { padding: 18px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .doc-head { grid-template-columns: 1fr; }
  .actions-bar { justify-content: flex-start; }
  .fgrid > .field { grid-column: span 12 !important; }
  .doc-number { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------- admin */
.muted { color: var(--muted); }
i.ok { color: var(--signed); }
.danger-text { color: var(--danger) !important; }
.tbl tr.clickable { cursor: pointer; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl input[type=checkbox], .tbl input[type=radio] { accent-color: var(--violet); width: 16px; height: 16px; }
.tag.warn { background: var(--pending-50); color: #6D420B; border-color: #EBD3A8; }
a.tag { text-decoration: none; margin: 2px 0; }
a.tag:hover { border-color: var(--violet-2); color: var(--plum); }
.crumbs > i { font-size: 9px; opacity: .6; }
code { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--violet-50); color: var(--plum); padding: 1px 5px; border-radius: 4px; }
.input.mono { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.slab-in { font-family: var(--slab); font-weight: 600; font-size: 15px; color: var(--plum); }
.input-unit { display: flex; align-items: center; gap: 0; }
.input-unit .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-unit span { height: 38px; display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--paper); color: var(--muted); font-size: 13px; }
.sticky-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 14px 0; margin-top: 8px;
  background: linear-gradient(to top, var(--paper) 70%, transparent); z-index: 5; }

/* master data: list of tables on the left */
.split { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.subnav-group { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 14px 10px 6px; }
.subnav-group:first-child { margin-top: 0; }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; transition: background .15s, color .15s; }
.subnav a i { width: 16px; text-align: center; color: var(--muted); transition: color .15s; }
.subnav a span { flex: 1; }
.subnav a small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.subnav a:hover { background: #fff; color: var(--plum); }
.subnav a.on { background: #fff; color: var(--plum); font-weight: 650; box-shadow: var(--shadow); }
.subnav a.on i { color: var(--violet); }

/* forms management */
.form-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.form-card { --c: var(--violet); display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; color: var(--ink); position: relative; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.form-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); transform: scaleY(0); transform-origin: top; transition: transform .3s var(--ease); }
.form-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 35%, var(--line)); }
.form-card:hover::before { transform: scaleY(1); }
.fc-icon { --c: var(--violet); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 18px;
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); grid-row: span 2; }
.fc-icon.big { width: 54px; height: 54px; font-size: 22px; border-radius: 14px; align-self: center; }
.fc-body b { display: block; font-size: 15px; }
.fc-body small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.fc-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.fc-stats i { color: var(--muted); margin-right: 2px; }

.chain-flow { display: flex; gap: 0; margin: 4px 0 18px; overflow-x: auto; padding: 6px 2px 10px; }
.cf-step { position: relative; flex: 1 0 150px; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 8px;
  animation: cfIn .45s var(--ease) both; animation-delay: var(--d, 0ms); }
.cf-step::after { content: ''; position: absolute; top: 17px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 2px;
  background: repeating-linear-gradient(90deg, var(--violet-2) 0 6px, transparent 6px 11px); }
.cf-step:last-child::after { display: none; }
.cf-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--violet); color: #fff;
  font: 700 15px var(--slab); box-shadow: 0 0 0 5px var(--violet-50); margin-bottom: 8px; }
.cf-step b { font-size: 13px; }
.cf-step small { font-size: 11.5px; color: var(--muted); }
.cf-step.off { opacity: .45; }
.cf-step.off .cf-dot { background: #B9AEC6; }
.cf-step.end .cf-dot { background: var(--signed); box-shadow: 0 0 0 5px var(--signed-50); font-size: 13px; }
@keyframes cfIn { from { opacity: 0; transform: translateY(8px); } }
.chain-tbl td { padding: 8px 8px; }
.chain-tbl td.mv { white-space: nowrap; }
.chain-tbl .lk-btn:disabled { background: var(--paper); }

.print-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.print-card { display: grid; grid-template-columns: 70px 1fr; gap: 6px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.print-card.off { opacity: .6; }
.pc-sheet { grid-row: span 2; height: 92px; border-radius: 6px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 14px -10px rgba(36,16,47,.4);
  position: relative; display: grid; place-items: center; color: var(--violet-100); font-size: 30px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 10px, var(--line-2) 10px 11px); background-size: 70% 100%; background-repeat: no-repeat; background-position: center 26px; }
.pc-num { position: absolute; top: 6px; left: 6px; font: 700 11px var(--slab); color: var(--plum); }
.pc-body b { display: block; }
.pc-body small { display: block; color: var(--muted); font-size: 12.5px; }
.print-card .btn-row { grid-column: 2; }

.print-edit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.print-edit.with-preview { grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); }
.pe-preview { position: sticky; top: 76px; }
.pe-frame { background: #3A2F45; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); animation: modalIn .3s var(--ease); }
.pe-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #fff; }
.pe-bar small { color: #CDBFDB; flex: 1; font-size: 12px; }
.pe-bar .btn { color: #fff; }
.pe-frame iframe { width: 100%; height: calc(100vh - 170px); border: 0; display: block; background: #fff; }
.logo-pick { position: relative; display: grid; place-items: center; height: 92px; border: 1px dashed var(--line); border-radius: var(--r); background: #fff; cursor: pointer; overflow: hidden; }
.logo-pick img { max-height: 76px; max-width: 90%; object-fit: contain; }
.logo-pick span { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(36,16,47,.72); color: #fff; font-size: 12.5px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.logo-pick:hover span { opacity: 1; }
.labels-tbl td { padding: 6px 10px; }
.labels-tbl tr.changed td:first-child { box-shadow: inset 3px 0 var(--violet); }
.labels-tbl tr.hid .input { text-decoration: line-through; opacity: .5; }
.cell-ref { font: 600 12px ui-monospace, Menlo, monospace; color: var(--muted); }
.labels-tbl .was { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.labels-tbl thead th { position: sticky; top: 0; background: #fff; z-index: 1; }

@media (max-width: 1100px) {
  .print-edit.with-preview { grid-template-columns: minmax(0, 1fr); }
  .pe-preview { position: static; }
}
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; }
  .subnav-group { display: none; }
  .subnav a { white-space: nowrap; }
}
.chain-tbl td:nth-child(2) { min-width: 190px; }
