/* DataStudio Systems — design system on top of Bootstrap 5 */
:root, [data-bs-theme="light"] {
  --bs-body-font-family: "Inter", "Noto Sans Georgian", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.5;
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #eef0f3;
  --border: #e5e7eb; --border-strong: #d1d5db;
  --text: #0f172a; --text-2: #475569; --muted: #64748b; --faint: #94a3b8;
  --primary: #2563eb; --primary-600: #1d4ed8; --primary-soft: #eff4ff; --primary-ring: rgba(37, 99, 235, .18);
  --success: #059669; --success-soft: #ecfdf5; --warning: #d97706; --warning-soft: #fffbeb; --danger: #dc2626; --danger-soft: #fef2f2;
  --series-1: #2563eb; --series-2: #f97316;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
  --radius: 12px; --radius-sm: 8px;
  --sidebar-w: 248px;
  --bs-body-bg: var(--bg); --bs-body-color: var(--text); --bs-border-color: var(--border); --bs-secondary-color: var(--muted);
  --bs-primary: var(--primary); --bs-primary-rgb: 37, 99, 235; --bs-link-color: var(--primary); --bs-link-color-rgb: 37, 99, 235; --bs-link-hover-color: var(--primary-600);
}
[data-bs-theme="dark"] {
  --bg: #0b0f17; --surface: #111827; --surface-2: #161e2e; --surface-3: #1f2937;
  --border: #1f2937; --border-strong: #374151;
  --text: #e5e7eb; --text-2: #cbd5e1; --muted: #94a3b8; --faint: #64748b;
  --primary: #3b82f6; --primary-600: #60a5fa; --primary-soft: #172554; --primary-ring: rgba(59, 130, 246, .3);
  --success: #34d399; --success-soft: #052e16; --warning: #fbbf24; --warning-soft: #422006; --danger: #f87171; --danger-soft: #450a0a;
  --series-1: #3b82f6; --series-2: #fb923c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
  --bs-body-bg: var(--bg); --bs-body-color: var(--text); --bs-border-color: var(--border); --bs-secondary-color: var(--muted);
}
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { letter-spacing: -0.01em; font-weight: 600; }
.text-secondary { color: var(--muted) !important; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: 0; }
.pos { color: var(--success); } .neg { color: var(--danger); }
.num, .tabular { font-variant-numeric: tabular-nums; }
::selection { background: var(--primary-ring); }

/* Icons */
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -3px; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }

/* Buttons & controls */
.btn { border-radius: var(--radius-sm); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease, transform .06s ease; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-600); --bs-btn-hover-border-color: var(--primary-600); --bs-btn-active-bg: var(--primary-600); --bs-btn-active-border-color: var(--primary-600); box-shadow: var(--shadow-sm); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: var(--primary-soft); --bs-btn-hover-color: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary-soft); --bs-btn-active-color: var(--primary); }
.btn-outline-secondary { --bs-btn-color: var(--text-2); --bs-btn-border-color: var(--border-strong); --bs-btn-bg: var(--surface); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border-strong); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--border-strong); }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: var(--danger-soft); --bs-btn-hover-color: var(--danger); --bs-btn-hover-border-color: var(--danger); }
.btn-success { --bs-btn-bg: var(--success); --bs-btn-border-color: var(--success); --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; }
.btn-ghost { --bs-btn-color: var(--text-2); --bs-btn-bg: transparent; --bs-btn-border-color: transparent; --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-color: var(--text); --bs-btn-active-bg: var(--surface-3); }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 9px; }
.form-control, .form-select { background: var(--surface); color: var(--text); border-color: var(--border-strong); border-radius: var(--radius-sm); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); background: var(--surface); color: var(--text); }
.form-control::placeholder { color: var(--faint); }
.form-control-sm, .form-select-sm { padding: 6px 10px; font-size: 13px; min-height: 34px; }
.form-label { color: var(--text-2); font-weight: 500; }
.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input { width: 34px; height: 19px; }
.badge { font-weight: 500; letter-spacing: .01em; padding: 4px 9px; border-radius: 999px; }
.badge.text-bg-light { background: var(--surface-3) !important; color: var(--text-2) !important; border: 0 !important; }
.badge.text-bg-success { background: var(--success-soft) !important; color: var(--success) !important; }
.badge.text-bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.badge.text-bg-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.badge.text-bg-secondary { background: var(--surface-3) !important; color: var(--text-2) !important; }
.badge.text-bg-primary { background: var(--primary-soft) !important; color: var(--primary) !important; }
.badge.text-bg-dark { background: var(--text) !important; color: var(--surface) !important; }
.alert { border-radius: var(--radius); }
.alert-light { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.form-text { color: var(--muted); }

/* Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: var(--text); }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; letter-spacing: -.02em; box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .6); }
.brand .name { font-weight: 650; font-size: 14.5px; line-height: 1.15; }
.brand .sub { font-size: 11.5px; color: var(--muted); }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 13.5px; font-weight: 500; transition: background .12s ease, color .12s ease; }
.sidenav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); }
.sidenav a .i { color: var(--muted); }
.sidenav a.active .i, .sidenav a:hover .i { color: inherit; }
.sidenav a .count { margin-left: auto; font-size: 11px; background: var(--surface-3); color: var(--muted); padding: 1px 7px; border-radius: 999px; }
.sidebar .foot { margin-top: auto; padding: 12px 10px 4px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 28px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1020; min-height: 58px; }
.topbar h1 { font-size: 1.05rem; margin: 0; }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.topbar .crumbs .sep { color: var(--faint); }
.topbar .crumbs .parent { color: var(--muted); font-size: 13px; }
.gsearch { position: relative; width: 300px; }
.gsearch .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.gsearch input { padding-left: 34px; padding-right: 44px; background: var(--surface-2); }
.gsearch kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10.5px; color: var(--faint); background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.gsearch .results { position: absolute; top: 40px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 1050; display: none; }
.gsearch .results.open { display: block; }
.gsearch .results .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 10px 12px 4px; font-weight: 600; }
.gsearch .results a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; color: var(--text); font-size: 13px; }
.gsearch .results a:hover, .gsearch .results a.hl { background: var(--primary-soft); text-decoration: none; }
.gsearch .results a .sub { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status.saving .dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status.error .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.content { padding: 24px 28px 80px; display: flex; flex-direction: column; gap: 20px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-head h2 { font-size: 1.25rem; margin: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text); }
.card-header .grow { flex: 1; }
.card-body { color: var(--text); }

/* KPI */
.kpi { position: relative; padding: 16px 18px; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .label .i { width: 16px; height: 16px; color: var(--faint); }
.kpi .value { font-size: clamp(17px, 1.35vw, 22px); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 6px; white-space: nowrap; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.delta { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.delta.up { color: var(--success); background: var(--success-soft); } .delta.down { color: var(--danger); background: var(--danger-soft); }

/* Tables */
.tbl { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); margin: 0; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; cursor: pointer; user-select: none; background: var(--surface-2); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.tbl th:hover { color: var(--text); }
.tbl th.sorted { color: var(--primary); }
.tbl td { padding: 9px 12px; vertical-align: middle; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.nowrap { white-space: nowrap; }
.tbl td.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tbody tr { cursor: pointer; transition: background .1s ease; }
.tbl tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.tbl a { white-space: nowrap; }
.tbl .empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.tbl .empty .i { width: 36px; height: 36px; color: var(--faint); margin-bottom: 8px; stroke-width: 1.4; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.tbl-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.tbl-foot .pages { margin-left: auto; display: flex; gap: 4px; }
.tbl-foot .pages button { min-width: 30px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters .chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all .12s ease; }
.filters .chip:hover { border-color: var(--primary); color: var(--primary); }
.filters .chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* Modal */
.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 22px; }
.modal-title { font-size: 1rem; }
.modal-body { padding: 20px 22px; }
.modal-footer { border-top: 1px solid var(--border); padding: 12px 22px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-backdrop { --bs-backdrop-opacity: .45; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Metrics & details */
.metric { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.metric .label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.metric .value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; word-break: break-word; }

/* Charts */
.chart { width: 100%; height: 260px; display: block; }
.chart text { font-family: var(--bs-body-font-family); font-size: 11px; fill: var(--muted); }
.chart .grid line { stroke: var(--border); }
.chart .axis { stroke: var(--border-strong); }
.chart rect.s1 { fill: var(--series-1); } .chart rect.s2 { fill: var(--series-2); }
.chart g.col rect.bar { transition: opacity .12s ease; }
.chart g.col:hover rect.bar { opacity: .8; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip-ds { position: fixed; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 6px 10px; border-radius: 8px; z-index: 2000; display: none; box-shadow: var(--shadow); }
.hbar { display: grid; grid-template-columns: 170px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; margin: 7px 0; }
.hbar .track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: linear-gradient(90deg, var(--series-1), #60a5fa); border-radius: 4px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.list .item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: center; }
.list .item:last-child { border-bottom: 0; }
.list .item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* Documents */
.doc { background: #fff; color: #111; width: 210mm; min-height: 280mm; margin: 0 auto; padding: 18mm 16mm; box-shadow: var(--shadow); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.45; border-radius: 4px; }
.doc .head { display: flex; justify-content: space-between; align-items: flex-start; }
.doc .head .logo { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.doc .head .logo span { color: #2563eb; }
.doc .inv-no { text-align: right; }
.doc .inv-no .lbl { color: #666; font-size: 12px; }
.doc .inv-no .val { font-size: 20px; font-weight: 700; }
.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 22px 0; }
.doc .party h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .04em; color: #666; font-weight: 600; }
.doc .party .row { display: grid; grid-template-columns: 110px 1fr; gap: 6px; padding: 2px 0; }
.doc .party .row .k { color: #666; }
.doc table.lines { width: 100%; border-collapse: collapse; margin-top: 10px; }
.doc table.lines th { text-align: left; font-size: 11.5px; letter-spacing: .04em; color: #666; border-bottom: 2px solid #222; padding: 8px 6px; }
.doc table.lines td { padding: 9px 6px; border-bottom: 1px solid #e5e5e5; vertical-align: top; }
.doc table.lines td.num, .doc table.lines th.num { text-align: right; white-space: nowrap; }
.doc .totals { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.doc .totals .sum .row { display: flex; justify-content: space-between; padding: 4px 0; }
.doc .totals .sum .row.total { border-top: 2px solid #222; font-weight: 700; font-size: 14px; margin-top: 6px; padding-top: 8px; }
.doc .note { margin-top: 24px; padding: 10px 12px; background: #f4f6f9; border-radius: 6px; font-size: 12px; }
.doc .foot { margin-top: 40px; display: flex; gap: 22px; font-size: 11px; color: #666; border-top: 1px solid #e5e5e5; padding-top: 10px; }
.doc .act-title { text-align: center; font-size: 18px; font-weight: 700; margin: 6px 0 18px; }
.doc .act-meta { display: flex; justify-content: space-between; margin-bottom: 18px; }
.doc p.para { text-align: justify; margin: 0 0 14px; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 40px; }
.doc .sign h4 { margin: 0 0 8px; font-size: 13px; }
.doc .sign .line { margin-top: 36px; border-top: 1px solid #222; padding-top: 6px; white-space: pre-line; }
.doc [contenteditable="true"]:hover { outline: 1px dashed #2563eb; background: #f5f9ff; border-radius: 3px; }
.doc [contenteditable="true"]:focus { outline: 1px solid #2563eb; background: #f5f9ff; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, .18), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(124, 58, 237, .16), transparent 60%), var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 32px; }
.login-card h1 { font-size: 1.25rem; margin: 18px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }

.toast-ds { position: fixed; bottom: 22px; right: 22px; z-index: 3000; background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: fade .18s ease; }
.toast-ds.success { background: var(--success); color: #fff; } .toast-ds.danger { background: var(--danger); color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s ease; z-index: 1040; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex !important; }
  .gsearch { width: 180px; }
  .content { padding: 16px; }
  .doc { width: 100%; padding: 16px; }
  .dl { grid-template-columns: 1fr; }
}
.menu-btn { display: none; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .modal, .modal-backdrop, .tooltip-ds, .toast-ds { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .doc { box-shadow: none; border: 0; width: auto; min-height: auto; margin: 0; padding: 0; }
  .doc [contenteditable="true"] { outline: none !important; background: none !important; }
  @page { size: A4; margin: 16mm; }
}

/* ===== v2 components ===== */
.i.xs { width: 12px; height: 12px; margin-right: 3px; vertical-align: -1px; }
.badge .i { vertical-align: -2px; }
.page-head h2 { font-family: var(--bs-body-font-family); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs .tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: 13.5px; text-decoration: none; border: 1px solid transparent; }
.tabs .tab:hover { background: var(--surface-3); color: var(--text); }
.tabs .tab.active { background: var(--surface); border-color: var(--border); color: var(--primary); box-shadow: var(--shadow-sm); }
.help { margin-top: -8px; }
.help .help-text { display: none; padding: 10px 14px; background: var(--primary-soft); color: var(--text-2); border-radius: var(--radius-sm); font-size: 13px; margin-top: 4px; max-width: 80ch; }
.help.open .help-text { display: block; }
.help-btn { color: var(--muted); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.numbers .kpi { height: 100%; }
.att .item { align-items: center; gap: 12px; padding: 10px 0; }
.att .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.att .ico.danger { background: var(--danger-soft); color: var(--danger); } .att .ico.warning { background: var(--warning-soft); color: var(--warning); } .att .ico.primary { background: var(--primary-soft); color: var(--primary); }
.att .tx { font-weight: 500; } .att .sub { font-size: 12px; color: var(--muted); }
.checklist { border-color: var(--primary); background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.cl-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px; }
.cl { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; }
.cl:hover { border-color: var(--primary); text-decoration: none; }
.cl.done { color: var(--muted); text-decoration: line-through; } .cl.done .i { color: var(--success); }
.outbox { border-color: var(--success); background: var(--success-soft); }
.tbl tr.hl td { background: var(--warning-soft); }
.tbl td.acts { white-space: nowrap; text-align: right; }
.tbl th.acts { width: 1%; }
.tsearch { max-width: 220px; } .tsearch svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); } .tsearch input { padding-left: 30px; }
.daterange .datefield { width: 130px; }
.form-section { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 6px; }
.more-wrap { margin-top: 14px; } .more-wrap .more-toggle { color: var(--muted); } .more-wrap .more-toggle .i { transition: transform .15s; } .more-wrap.open .more-toggle .i { transform: rotate(180deg); }
.more-wrap form.more { padding-top: 10px; }
.datefield { position: relative; display: flex; }
.datefield .txt { padding-right: 34px; }
.datefield .cal { position: absolute; right: 2px; top: 2px; height: 30px; width: 30px; color: var(--muted); }
.datefield .native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.picker { position: relative; }
.picker input { padding-right: 30px; }
.picker .caret { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--faint); cursor: pointer; }
.picker .menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; z-index: 1060; display: none; padding: 4px; }
.picker .menu.open { display: block; }
.picker .opt { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.picker .opt:hover, .picker .opt.sel { background: var(--primary-soft); color: var(--primary); }
.picker .opt .sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.picker .opt.none { color: var(--muted); cursor: default; }
.picker .opt.create { color: var(--primary); font-weight: 500; border-top: 1px solid var(--border); border-radius: 0; margin-top: 4px; padding-top: 9px; justify-content: flex-start; gap: 6px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice .opt { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; background: var(--surface); margin: 0; }
.choice .opt input { display: none; }
.choice .opt .i { width: 22px; height: 22px; color: var(--muted); }
.choice .opt span { display: flex; flex-direction: column; line-height: 1.25; } .choice .opt small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.choice .opt.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); } .choice .opt.sel .i { color: var(--primary); }
@media (max-width: 600px) { .choice { grid-template-columns: 1fr; } }
.drawer-bg { position: fixed; inset: 0; background: rgba(14, 18, 24, 0); z-index: 1045; transition: background .18s; }
.drawer-bg.open { background: rgba(14, 18, 24, .35); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100%; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column; }
.drawer-bg.open .drawer { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-title { font-weight: 600; font-size: 16px; } .drawer-sub { font-size: 12.5px; color: var(--muted); }
.drawer-b { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-f { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.timeline { display: flex; gap: 0; flex-wrap: wrap; }
.timeline .step { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 150px; padding: 6px 12px 6px 0; position: relative; }
.timeline .step .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: #fff; flex-shrink: 0; background: var(--surface); }
.timeline .step.done .dot { background: var(--success); border-color: var(--success); }
.timeline .step .lbl { font-weight: 600; font-size: 13px; } .timeline .step .sub { font-size: 12px; color: var(--muted); }
.timeline .step:not(.done) .lbl { color: var(--muted); font-weight: 500; }
.mail-preview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.mail-preview .mp-h { padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mail-preview .mp-b { padding: 14px; font-family: var(--bs-body-font-family); white-space: pre-wrap; margin: 0; font-size: 13.5px; }
.mail-preview .mp-a { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.guide h3 { font-size: 15px; margin: 18px 0 6px; } .guide h3:first-child { margin-top: 0; } .guide p { max-width: 75ch; color: var(--text-2); }
.list label.item { cursor: pointer; }
.toast-ds .btn { padding: 2px 8px; font-size: 12px; }
@media (max-width: 700px) {
  .tblcard .tbl thead { display: none; }
  .tblcard .tbl tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .tblcard .tbl tbody td { display: none; border: 0; padding: 0; }
  .tblcard .tbl tbody td.m-title { display: block; grid-column: 1; font-weight: 600; white-space: normal; max-width: none; }
  .tblcard .tbl tbody td.m-meta { display: block; grid-column: 1; color: var(--muted); font-size: 12.5px; white-space: normal; max-width: none; }
  .tblcard .tbl tbody td.m-value { display: block; grid-column: 2; grid-row: 1; font-weight: 600; text-align: right; }
  .tblcard .tbl tbody td.acts { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 4px; padding-top: 6px; }
  .tblcard .tbl tbody td[data-label="სტატუსი"], .tblcard .tbl tbody td[data-label="Status"] { display: block; grid-column: 1 / -1; text-align: left; padding-top: 4px; }
  .tblcard .tbl tbody td.m-title, .tblcard .tbl tbody td.m-meta { overflow-wrap: anywhere; }
  .tblcard .tbl tfoot { display: none; }
  .tblcard .card-header .tsearch { max-width: none; flex: 1 1 100%; }
  .content { gap: 14px; }
}
