/* tax.eaudit.ge — დიზაინის სისტემა.
   ბრენდი (MARKETING-PLAYBOOK §6): ტექსტი/აქცენტი #131C3E, CTA/ხაზგასმა #E20935, ფონი ღიაა.
   მუქი რეჟიმი მხოლოდ მკითხველის არჩევანია (სისტემის პარამეტრი ან მენიუ). */

@font-face { font-family: "Noto Sans Georgian"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/nsg-geo.woff2) format("woff2"); unicode-range: U+0589, U+10A0-10FF, U+1C90-1CBA, U+1CBD-1CBF, U+205A, U+2D00-2D2F, U+2E31; }
@font-face { font-family: "Noto Sans Georgian"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/nsg-lat.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --navy: #131C3E;
  --red: #E20935;
  --bg: #F6F7FA;
  --surface: #FFFFFF;
  --ink: #131C3E;
  --ink-2: #4B5372;
  --ink-3: #6E7591;
  --line: #E4E7EF;
  --line-2: #EEF0F5;
  --link: #2440A8;
  --accent: #E20935;
  --accent-soft: #FDEBEF;
  --mark: #FFF3C4;
  --shadow: 0 1px 2px rgba(19, 28, 62, .06), 0 4px 16px rgba(19, 28, 62, .06);
  --radius: 14px;
  --fs: 17px;
  --bar-h: 56px;
  --pager-h: 64px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1324; --surface: #151B31; --ink: #E7EAF3; --ink-2: #B4BAD0; --ink-3: #8C93AD;
  --line: #262E4A; --line-2: #1D2440; --link: #A9B9FF; --accent: #FF5C77; --accent-soft: #3A1C2B;
  --mark: #4A3F12; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1324; --surface: #151B31; --ink: #E7EAF3; --ink-2: #B4BAD0; --ink-3: #8C93AD;
    --line: #262E4A; --line-2: #1D2440; --link: #A9B9FF; --accent: #FF5C77; --accent-soft: #3A1C2B;
    --mark: #4A3F12; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}

@view-transition { navigation: auto; }
.bar { view-transition-name: bar; }
.pager { view-transition-name: pager; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } * { scroll-behavior: auto !important; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + var(--sat) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--fs)/1.65 "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
sup, sub { line-height: 0; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.muted { color: var(--ink-3); }
code { font: 500 .9em ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--line-2); padding: 1px 6px; border-radius: 6px; }

/* ── ზედა ზოლი ─────────────────────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--bar-h) + var(--sat)); padding: var(--sat) 8px 0;
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.home {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px; margin-right: 4px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 15px; text-decoration: none;
  transition: transform .12s ease;
}
.home:active { transform: scale(.96); }
.home svg { width: 20px; height: 20px; stroke-width: 2; }
.brand { display: inline-flex; align-items: center; gap: 10px; padding-left: 8px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--navy); color: #fff; font-weight: 700; font-size: 18px; box-shadow: inset 0 -3px 0 var(--red); }
:root[data-theme="dark"] .brand-mark { background: #27305A; }
.bar-title { flex: 1; min-width: 0; text-align: center; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn[aria-pressed="true"] { color: #E8A100; }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }

main { display: block; max-width: 760px; margin: 0 auto; padding: 0 16px calc(var(--pager-h) + var(--sab) + 24px); }

/* ── სარჩევი ───────────────────────────────────────────────────────── */
.hero { padding: 28px 0 8px; }
.kicker { margin: 0 0 4px; color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .02em; }
.hero h1 { margin: 0; font-size: clamp(26px, 6.4vw, 34px); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.edition { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 18px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.edition .dot { width: 8px; height: 8px; border-radius: 50%; background: #1FA463; box-shadow: 0 0 0 3px color-mix(in srgb, #1FA463 22%, transparent); }
.find {
  display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink-3);
}
.find:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 14%, transparent); }
.find input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; }
.find input::placeholder { color: var(--ink-3); }
.recent { margin-top: 18px; }
.sub { margin: 0 0 8px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips a { flex: none; max-width: 240px; display: inline-flex; gap: 6px; align-items: baseline; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips a b { color: var(--accent); }

.toc { margin-top: 26px; }
.toc-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.toc-head h2 { margin: 0; font-size: 19px; }
.link-btn { border: 0; background: none; color: var(--link); cursor: pointer; font-size: 14px; padding: 8px 4px; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.kari { margin: 0 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.kari > summary { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lbl chev" "ttl chev" "meta chev"; column-gap: 12px; padding: 16px 16px 15px; }
.kari > summary .lbl { grid-area: lbl; color: var(--accent); font-size: 12.5px; font-weight: 700; letter-spacing: .04em; }
.kari > summary .ttl { grid-area: ttl; font-weight: 650; font-size: 17px; line-height: 1.35; margin: 2px 0 4px; }
.kari > summary .meta { grid-area: meta; color: var(--ink-3); font-size: 13px; }
.kari > summary svg { grid-area: chev; align-self: center; color: var(--ink-3); transition: transform .18s ease; }
.kari[open] > summary svg { transform: rotate(90deg); }
.kari[open] > summary { border-bottom: 1px solid var(--line-2); }
.kari-body { padding: 6px 0 8px; }

.tavi > summary { display: flex; align-items: baseline; gap: 10px; padding: 11px 16px; }
.tavi > summary:hover, .kari > summary:hover { background: color-mix(in srgb, var(--line-2) 60%, transparent); }
.tavi > summary .lbl { flex: none; min-width: 64px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.tavi > summary .ttl { flex: 1; font-weight: 550; font-size: 15.5px; line-height: 1.4; }
.tavi > summary .cnt, .cnt { flex: none; min-width: 26px; padding: 0 7px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: center; line-height: 22px; }
.tavi[open] > summary .ttl { color: var(--accent); }
.repealed > summary .ttl, li.repealed .t { color: var(--ink-3); font-style: italic; }

.arts { list-style: none; margin: 0; padding: 0 8px 8px 8px; }
.arts li a { display: flex; gap: 12px; align-items: baseline; padding: 9px 8px 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.4; }
.arts li a:hover { background: var(--line-2); }
.arts .n, .chapter .n { flex: none; min-width: 42px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .arts .n, :root[data-theme="dark"] .chapter .n { color: var(--ink); }
.arts li.here a { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .arts .n, :root:not([data-theme="light"]) .chapter .n { color: var(--ink); } }

/* ── მუხლი ─────────────────────────────────────────────────────────── */
.article { padding-top: 14px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; font-size: 13.5px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; padding: 4px 0; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--ink-3); }
.article h1 { margin: 6px 0 18px; font-size: clamp(22px, 5.4vw, 27px); line-height: 1.3; font-weight: 700; letter-spacing: -.005em; }
.article h1 .num { color: var(--accent); white-space: nowrap; }
.body p { margin: 0 0 .75em; }
.body p.l1 { padding-left: 1.15em; }
.body p.l2 { padding-left: 2.3em; }
.body p.l3 { padding-left: 3.45em; }
.body p[id] { scroll-margin-top: calc(var(--bar-h) + var(--sat) + 16px); border-radius: 8px; transition: background .4s ease; }
.body p.target, .body p:target { background: var(--mark); box-shadow: -8px 0 0 var(--mark), 8px 0 0 var(--mark); }
.body a[data-ref] { color: var(--link); text-decoration: underline dotted; text-decoration-thickness: 1.5px; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); -webkit-overflow-scrolling: touch; }
.table-wrap table { border-collapse: collapse; min-width: 100%; font-size: .88em; line-height: 1.45; }
.table-wrap td, .table-wrap th { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; min-width: 90px; }
.table-wrap tr:first-child td { background: var(--line-2); font-weight: 600; }

.srcnote { margin: -8px 0 16px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.srcnote a { color: var(--accent); font-weight: 600; }
.backrefs, .resources, .history { margin: 26px 0 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.backrefs h2, .resources h2 { margin: 0 0 8px; font-size: 14.5px; color: var(--ink-2); }
.backrefs p { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.backrefs a { display: inline-block; min-width: 44px; padding: 6px 10px; border-radius: 10px; background: var(--line-2); color: var(--ink); text-decoration: none; font-weight: 600; text-align: center; font-size: 14px; }
.resources .via { font-weight: 500; color: var(--ink-3); font-size: 12.5px; margin-left: 6px; }
.resources details + details { border-top: 1px solid var(--line-2); }
.resources summary, .history > summary { padding: 8px 0; font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.history ol, .resources ul { margin: 6px 0 4px; padding-left: 1.2em; font-size: 14px; color: var(--ink-2); }
.history li, .resources li { margin: 4px 0; }

.chapter { display: none; }

/* ── ქვედა ზოლი ────────────────────────────────────────────────────── */
.pager {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--pager-h) + var(--sab)); padding: 0 10px var(--sab);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line);
}
.pg { display: inline-flex; align-items: center; gap: 4px; min-width: 96px; height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.pg.next { justify-content: flex-end; }
.pg:hover { background: var(--line-2); }
.pg-actions { display: flex; gap: 4px; }

/* ── ძებნა, გვერდები ───────────────────────────────────────────────── */
.plainpage { padding-top: 22px; }
.plainpage h1 { margin: 0 0 16px; font-size: 26px; }
.plainpage h2 { margin: 28px 0 8px; font-size: 18px; }
.find.big { height: 58px; }
.hint { color: var(--ink-3); font-size: 13.5px; margin: 10px 2px 18px; }
.results { display: grid; gap: 10px; }
.result { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.result:hover { border-color: color-mix(in srgb, var(--navy) 35%, var(--line)); }
.result .h { display: flex; gap: 10px; align-items: baseline; font-weight: 650; }
.result .h b { color: var(--accent); flex: none; }
.result .h > span { min-width: 0; overflow-wrap: anywhere; }
.result .s { margin: 6px 0 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.result mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.result.jump { background: var(--accent-soft); border-color: transparent; }
.result.jump .h { color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; }
:root[data-theme="dark"] .btn { background: #2F3B73; }

footer.src { margin: 36px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; line-height: 1.6; }
footer.src p { margin: 0 0 6px; }
footer.src a { color: var(--ink-2); }
.brandline { margin-top: 10px !important; font-weight: 600; }

/* ── ფურცელი (bottom sheet) და toast ───────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 30, .38); opacity: 0; transition: opacity .2s ease; }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 78vh; overflow: auto; overscroll-behavior: contain;
  padding: 8px 18px calc(18px + var(--sab)); background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(10, 14, 30, .18);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet.on { transform: none; }
.sheet .grip { width: 40px; height: 4px; margin: 4px auto 10px; border-radius: 4px; background: var(--line); }
.sheet h3 { margin: 4px 0 10px; font-size: 18px; line-height: 1.35; }
.sheet h3 .num { color: var(--accent); }
.sheet .peek p { margin: 0 0 .6em; font-size: .95em; }
.sheet .peek p.l1 { padding-left: 1em; } .sheet .peek p.l2 { padding-left: 2em; }
.sheet .peek .target { background: var(--mark); border-radius: 6px; }
.sheet .row { position: sticky; bottom: calc(-18px - var(--sab)); display: flex; gap: 10px; margin: 14px -18px calc(-18px - var(--sab)); padding: 12px 18px calc(12px + var(--sab)); background: var(--surface); border-top: 1px solid var(--line-2); }
.sheet .row .btn { flex: 1; justify-content: center; }
.sheet .btn.ghost { background: var(--line-2); color: var(--ink); }
.menu-list { display: grid; gap: 4px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 4px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--line-2); }
.seg button { min-width: 44px; height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); }
.toast { position: fixed; left: 50%; bottom: calc(var(--pager-h) + var(--sab) + 14px); z-index: 50; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; background: var(--navy); color: #fff; font-size: 14px; font-weight: 500; transition: .2s ease; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── დესკტოპი ──────────────────────────────────────────────────────── */
@media (min-width: 1100px) {
  html[data-kind="article"] main { max-width: 1180px; display: grid; grid-template-columns: 300px minmax(0, 760px); grid-template-areas: "aside article" "aside foot"; column-gap: 48px; }
  html[data-kind="article"] .article { grid-area: article; }
  html[data-kind="article"] footer.src { grid-area: foot; }
  .chapter { display: block; grid-area: aside; position: sticky; top: calc(var(--bar-h) + 16px); align-self: start; max-height: calc(100vh - var(--bar-h) - 32px); overflow: auto;
    margin-top: 18px; padding: 14px 8px 14px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .chapter .lbl { margin: 0; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
  .chapter .ttl { margin: 2px 0 10px; font-weight: 650; font-size: 14.5px; line-height: 1.35; }
  .chapter ol { list-style: none; margin: 0; padding: 0; }
  .chapter li a { display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; line-height: 1.35; }
  .chapter li a:hover { background: var(--line-2); }
  .chapter li[aria-current] a { background: var(--accent-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
  .chapter .n { min-width: 34px; }
  .pager { left: 50%; right: auto; transform: translateX(-50%); bottom: 16px; width: min(560px, 92vw); height: 60px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 0 8px; }
  .sheet { left: 50%; right: auto; width: 560px; transform: translate(-50%, 110%); border-radius: 20px; bottom: 24px; }
  .sheet.on { transform: translate(-50%, 0); }
  .body p[id]:hover::before { content: "#"; position: absolute; margin-left: -1.2em; color: var(--ink-3); }
}
@media (min-width: 1100px) { .body p[id] { position: relative; } }
@media print {
  .bar, .pager, .chapter, .toast, footer.src .brandline, .find { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; }
}
