:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #efebe2;
  --ink: #1a1f2b;
  --ink-2: #3a4152;
  --muted: #697083;
  --line: #e2ddd1;
  --accent: #1f3a5f;
  --accent-2: #2c5282;
  --accent-ink: #ffffff;
  --brass: #9a6b1f;
  --brass-soft: #f4e9d3;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(20, 24, 33, .06), 0 8px 24px -12px rgba(20, 24, 33, .18);
  --shadow-lg: 0 24px 64px -16px rgba(10, 14, 24, .35);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1f2430;
    --ink: #eceff5;
    --ink-2: #c7ccd8;
    --muted: #8e96a8;
    --line: #2a303d;
    --accent: #8fb3e8;
    --accent-2: #a9c5ef;
    --accent-ink: #0f1218;
    --brass: #e1b866;
    --brass-soft: #2c2516;
    --danger: #f97066;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1218;
  --surface: #171b23;
  --surface-2: #1f2430;
  --ink: #eceff5;
  --ink-2: #c7ccd8;
  --muted: #8e96a8;
  --line: #2a303d;
  --accent: #8fb3e8;
  --accent-2: #a9c5ef;
  --accent-ink: #0f1218;
  --brass: #e1b866;
  --brass-soft: #2c2516;
  --danger: #f97066;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 16px; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
kbd { font: 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 19px/1 var(--serif); letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; }
.brand-bg { fill: #1f3a5f; stroke: none; }
.brand-mark { stroke: #e9c98b; }
.brand em { font-style: italic; color: var(--brass); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge { font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); transition: background .15s, color .15s, border-color .15s; }
.icon-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#themeBtn .i-sun { display: none; }
:root[data-theme="dark"] #themeBtn .i-sun { display: inline; }
:root[data-theme="dark"] #themeBtn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #themeBtn .i-sun { display: inline; }
  :root:not([data-theme="light"]) #themeBtn .i-moon { display: none; }
}

/* ---------- hero ---------- */
.hero { padding: 26px 0 16px; background:
  radial-gradient(900px 300px at 85% -60px, color-mix(in srgb, var(--brass) 14%, transparent), transparent 70%),
  radial-gradient(700px 260px at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.hero h1 { margin: 0 0 16px; font: 600 clamp(20px, 2.6vw, 26px)/1.2 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.hero h1 span { color: var(--muted); font-style: italic; font-weight: 500; }

.searchbar { display: flex; align-items: center; gap: 8px; padding: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.searchbar:focus-within { border-color: var(--accent-2); box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--accent-2) 18%, transparent); }
.search-icon { width: 20px; height: 20px; margin-left: 10px; color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 10px 6px; font-size: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; border: 1px solid transparent; padding: 10px 18px; font-weight: 600; font-size: 15px; transition: transform .05s, background .15s, opacity .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn .spinner { display: none; }
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-label { opacity: .7; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 6px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 500; transition: background .15s, border-color .15s, color .15s; }
.chip:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

@keyframes rise { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- results ---------- */
.active-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.active-chips:empty { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--brass-soft); color: var(--ink); font-size: 13px; border: 1px solid color-mix(in srgb, var(--brass) 25%, transparent); max-width: 100%; }
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip small { color: var(--brass); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.fchip button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.fchip button:hover { background: color-mix(in srgb, var(--brass) 20%, transparent); color: var(--ink); }
.fchip.clear { background: transparent; border-style: dashed; color: var(--muted); padding: 4px 12px; cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 16px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.summary { margin: 0; color: var(--muted); font-size: 14.5px; }
.summary b { color: var(--ink); font-variant-numeric: tabular-nums; }
.toolbar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.select { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.select select { padding: 7px 28px 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13.5px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.view-toggle { display: inline-flex; gap: 4px; }
.view-toggle .icon-btn { width: 34px; height: 34px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s, transform .15s, box-shadow .15s; animation: rise .25s ease-out both; }
.card:hover { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line)); transform: translateY(-1px); }
.date { display: grid; place-items: center; align-content: center; height: 72px; border-radius: 12px; background: var(--surface-2); text-align: center; line-height: 1.1; }
.date b { font: 600 24px/1 var(--serif); }
.date span { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.date.new { background: var(--brass-soft); }
.date.new span { color: var(--brass); }
.c-body { min-width: 0; }
.c-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }
.court { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); font-size: 11.5px; }
.tag-new { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--brass); background: var(--brass-soft); padding: 2px 7px; border-radius: 999px; }
.c-title { margin: 0; font: 600 19px/1.3 var(--serif); letter-spacing: -.005em; overflow-wrap: anywhere; }
.c-title button { all: unset; cursor: pointer; }
.c-title button:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.c-title button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
.c-cite { margin: 4px 0 0; font: 13px var(--mono); color: var(--ink-2); overflow-wrap: anywhere; }
.c-coram { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.c-snippet { margin: 10px 0 0; color: var(--ink-2); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.c-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* compact view */
.list.compact { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list.compact .card { grid-template-columns: 92px 1fr; gap: 14px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; transform: none; animation: none; }
.list.compact .card:last-child { border-bottom: 0; }
.list.compact .card:hover { background: var(--surface-2); }
.list.compact .date { height: auto; background: none; place-items: start; text-align: left; display: block; }
.list.compact .date b { font: 600 13.5px var(--sans); }
.list.compact .date span { display: inline; margin-left: 4px; }
.list.compact .c-title { font-size: 16px; }
.list.compact .c-snippet, .list.compact .c-actions, .list.compact .c-coram { display: none; }

/* skeleton */
.skel { pointer-events: none; }
.skel .bar { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 40%, var(--surface)), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; margin-top: 10px; }
.skel .date { animation: shimmer 1.2s ease-in-out infinite; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 40%, var(--surface)), var(--surface-2)); background-size: 200% 100%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.empty { text-align: center; padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--ink); font: 600 22px var(--serif); }
.empty .btn { margin-top: 14px; }
.empty.error h3 { color: var(--danger); }

/* pager */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 26px; }
.pager:empty { display: none; }
.pg { min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.pg:hover:not(:disabled) { border-color: var(--accent-2); color: var(--ink); }
.pg[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg svg { width: 16px; height: 16px; }
.gap { color: var(--muted); padding: 0 4px; }
.jump { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-size: 13px; color: var(--muted); }
.jump input { width: 72px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 10px; text-align: center; }

.foot { padding: 12px 16px 40px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- left search panel ---------- */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; padding-top: 18px; }
.results { min-width: 0; padding-bottom: 32px; outline: none; }
.side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.side-head h2 { margin: 0; font: 600 18px var(--serif); }
.side-close, .side-open { display: none; }
.side-sec { border-top: 1px solid var(--line); }
.side-sec:first-child { border-top: 0; }
.side-sec summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 10px; margin: 3px 0; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--ink-2); user-select: none; }
.side-sec summary::-webkit-details-marker { display: none; }
.side-sec summary:hover { background: var(--surface-2); color: var(--ink); }
.side-sec summary svg { width: 18px; height: 18px; color: var(--brass); }
.side-sec summary span { flex: 1; }
.side-sec summary .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.side-sec[open] summary { background: var(--brass-soft); color: var(--ink); }
.side-sec[open] summary .chev { transform: rotate(90deg); }
.side-form { display: grid; gap: 10px; padding: 8px 8px 14px; animation: rise .18s ease-out; }
.side-form label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.side-form input, .side-form select { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 14.5px; font-weight: 400; }
.side-form input:focus, .side-form select:focus { outline: 0; border-color: var(--accent-2); }
.side-go { width: 100%; margin-top: 2px; }
.side-go svg { width: 16px; height: 16px; }
.side-clear { width: 100%; margin-top: 8px; font-size: 13.5px; }
.side-scrim { position: fixed; inset: 0; background: rgba(8, 11, 18, .45); z-index: 44; animation: fade .2s; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 45; top: 0; left: 0; bottom: 0; width: min(340px, 88vw); max-height: none; border-radius: 0 var(--radius) var(--radius) 0; transform: translateX(-105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .25s; visibility: hidden; }
  .side.open { transform: none; visibility: visible; transition-delay: 0s; }
  .side-close { display: inline-grid; }
  .side-open { display: inline-flex; margin-bottom: 12px; }
}

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 11, 18, .45); z-index: 40; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { -webkit-user-select: none; user-select: none; position: fixed; z-index: 50; inset: 0; width: 100%; height: 100%; height: 100dvh; background: var(--surface); display: flex; flex-direction: column; animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { transform: scale(.985); opacity: 0; } }
.d-head { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.d-meta { min-width: 0; }
.d-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); }
.d-head h2 { margin: 0; font: 600 22px/1.25 var(--serif); overflow-wrap: anywhere; }
.d-cite { margin: 4px 0 0; font: 12.5px var(--mono); color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.d-actions { display: flex; gap: 6px; align-items: center; }
.pdf-btn { display: inline-flex; align-items: center; width: auto; gap: 5px; padding: 0 11px; font-size: 12.5px; font-weight: 700; color: #b42318; border-color: color-mix(in srgb, #b42318 30%, var(--line)); }
.pdf-btn:hover { color: #b42318; background: color-mix(in srgb, #b42318 8%, var(--surface)); }
.pdf-btn.loading { opacity: .6; cursor: progress; }
.d-body { position: relative; flex: 1; min-height: 0; }
.pane { position: absolute; inset: 0; overflow: auto; }
.pane iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--surface); }
.pane-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); z-index: 3; transition: opacity .35s ease;
  background: radial-gradient(520px 340px at 50% 42%, color-mix(in srgb, var(--brass) 12%, var(--surface)), var(--surface)); }
.pane-loading.out { opacity: 0; }
.viewer-splash .splash-logo { width: 104px; height: 104px; }
.viewer-splash .splash-name { font-size: 28px; }



.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); animation: rise .2s; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .hero { padding-top: 18px; }
  .card { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .date { height: auto; display: inline-flex; gap: 6px; padding: 4px 10px; justify-self: start; place-items: center; }
  .date b { font-size: 15px; }
  .date span { margin: 0; }
  .list.compact .card { grid-template-columns: 1fr; gap: 2px; }
  .toolbar-controls { width: 100%; justify-content: space-between; }
  .jump { display: none; }
  .pg.edge { display: none; }
  .d-head { padding: 14px 16px 10px; }
  .d-head h2 { font-size: 19px; }
  .d-head { flex-wrap: wrap; gap: 10px; }
  .d-actions { flex-wrap: wrap; gap: 6px; width: 100%; }
  .d-actions .icon-btn { width: 36px; height: 36px; }
  .d-actions .print-btn .pdf-label { display: none; }
  .d-actions .pdf-btn .pdf-label { display: none; }
  .d-actions .pdf-btn { width: auto; padding: 0 9px; }
  .d-actions .dd-btn { height: 36px; max-width: 150px; }
  .d-actions .dd { flex: 1; min-width: 0; }
  .d-actions .dd .dd-btn { width: 100%; max-width: none; }
}

/* ---------- judgment viewer: navigation + toolbar ---------- */
.d-head .d-meta { flex: 1; }

.d-tools { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-behavior: smooth; }
.d-tools::-webkit-scrollbar { display: none; }
.d-tools > * { flex: none; }
/* its pop-ups sit on the page, under their button (placed by app.js), so the scrolling line does not cut them off */
.d-tools .cases-pop, .d-tools .pop { position: fixed; top: var(--py, 120px); left: var(--px, 16px); right: auto; z-index: 70; }
/* ‹ › at the two ends, when the tools are wider than the window */
.dt-scroll { position: sticky; z-index: 2; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 6px var(--surface-2); }
.dt-scroll.prev { left: 0; margin-right: 2px; }
.dt-scroll.next { right: 0; margin-left: auto; }
.dt-scroll[hidden] { display: none; }
.dt-scroll:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.dt-scroll svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.tool-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.tool-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.tool-group .tool-btn { border-color: transparent; height: 28px; min-width: 28px; padding: 0 7px; border-radius: 7px; }
.tool-btn:hover:not(:disabled) { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); }
.tool-group .tool-btn:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.tool-btn:disabled { opacity: .4; cursor: not-allowed; }
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn.active, .tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tool-btn.mini { min-width: 26px; height: 26px; padding: 0; border-color: transparent; background: transparent; }
.tool-btn.mini:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.aa { font: 600 12px var(--serif); }
.aa.big { font-size: 16px; }
.tool-val { min-width: 22px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg .tool-btn.active { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent-2); color: var(--ink); }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); }
.sw-light { background: #fff; }
.sw-sepia { background: #f1e3c4; }
.sw-dark { background: #1b2030; border-color: rgba(255, 255, 255, .35); }
.tool-sep { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }

.pill { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); font-size: 11px; line-height: 18px; text-align: center; }
.tool-btn.active .pill { background: rgba(255, 255, 255, .25); color: inherit; }

.cases-wrap { position: relative; }
.cases-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(460px, calc(100vw - 48px)); max-height: 360px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); animation: rise .15s ease-out; }
.cases-head { margin: 4px 8px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cases-pop ol { list-style: none; margin: 0; padding: 0; }
.cases-pop button { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; }
.cases-pop button:hover { background: var(--surface-2); }
.c-name { font: 600 14px/1.35 var(--serif); color: var(--ink); }
.c-cit { font: 12.5px var(--mono); color: var(--accent-2); }
.c-how { font-size: 11.5px; color: var(--muted); }

/* side-by-side panes */
.d-body.split { display: grid; grid-template-columns: 1fr 1fr; }
.d-body.split .pane { position: relative; inset: auto; display: flex; flex-direction: column; min-width: 0; }
.d-body.split .pane-orig { border-right: 1px solid var(--line); }
.d-body.split iframe { flex: 1; height: auto; }
.pane-label { flex: none; padding: 6px 16px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }

/* full screen */
.drawer:fullscreen { animation: none; }
.drawer::backdrop { background: var(--bg); }

/* recently viewed (left panel) */
.recent-body { padding: 4px 4px 12px; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.recent-list button { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 8px; border: 0; border-radius: 8px; background: transparent; }
.recent-list button:hover { background: var(--surface-2); }
.r-title { font: 600 13px/1.3 var(--serif); color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.r-meta { font-size: 11.5px; color: var(--muted); }
.r-empty { padding: 8px; font-size: 13px; color: var(--muted); }
.link-small { margin: 6px 8px 0; padding: 0; border: 0; background: none; color: var(--accent-2); font-size: 12.5px; font-weight: 600; }

@media (max-width: 900px) {
  .d-body.split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .d-body.split .pane-orig { border-right: 0; border-bottom: 1px solid var(--line); }
  .tool-btn span:not(.aa):not(.swatch):not(.pill) { display: none; }
}
@media (max-width: 640px) {
  .d-tools { padding: 7px 10px; }
  .tool-sep { display: none; }
  .cases-pop { position: fixed; top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 60vh; }
  .d-tools .cases-pop, .d-tools .pop { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 60vh; overflow: auto; }
}

/* ---------- intro screen ---------- */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background:
  radial-gradient(600px 400px at 50% 40%, color-mix(in srgb, var(--brass) 14%, var(--bg)), var(--bg)); transition: opacity .5s ease, visibility .5s; }
.splash.out { opacity: 0; visibility: hidden; }
.splash-inner { display: grid; justify-items: center; gap: 10px; }
.splash-logo { width: 120px; height: 120px; overflow: visible; }
.splash-logo * { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sp-ring { stroke: color-mix(in srgb, var(--brass) 35%, transparent); stroke-width: 1.5; stroke-dasharray: 352; stroke-dashoffset: 352; animation: sp-draw 1s ease-out forwards; }
.sp-draw { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 120; stroke-dashoffset: 120; animation: sp-draw .9s ease-out .15s forwards; }
.sp-bowl { stroke: var(--brass); fill: color-mix(in srgb, var(--brass) 18%, transparent); }
.sp-knob { fill: var(--brass); stroke: none; transform-origin: 60px 34px; transform: scale(0); animation: sp-pop .3s ease-out .8s forwards; }
.sp-beam { transform-origin: 60px 38px; animation: sp-tilt 2.4s ease-in-out 1s infinite; }
.sp-pan { transform-box: view-box; }
.sp-pan-l { transform-origin: 30px 38px; animation: sp-keep 2.4s ease-in-out 1s infinite; }
.sp-pan-r { transform-origin: 90px 38px; animation: sp-keep 2.4s ease-in-out 1s infinite; }
.splash-name { font: 600 34px/1 var(--serif); letter-spacing: -.01em; color: var(--ink); opacity: 0; transform: translateY(8px); animation: sp-rise .6s ease-out .55s forwards; }
.splash-name em { color: var(--brass); }
.splash-tag { font-size: 13.5px; color: var(--muted); opacity: 0; animation: sp-rise .6s ease-out .8s forwards; }
.splash-bar { width: 180px; height: 3px; margin-top: 6px; border-radius: 3px; background: var(--line); overflow: hidden; opacity: 0; animation: sp-rise .4s ease-out .9s forwards; }
.splash-bar span { display: block; width: 40%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--brass)); animation: sp-slide 1.1s ease-in-out infinite; }
@keyframes sp-draw { to { stroke-dashoffset: 0; } }
@keyframes sp-pop { to { transform: scale(1); } }
@keyframes sp-rise { to { opacity: 1; transform: none; } }
@keyframes sp-tilt { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes sp-keep { 0%, 100% { transform: rotate(7deg); } 50% { transform: rotate(-7deg); } }
@keyframes sp-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ---------- loading: top progress bar + loader card ---------- */
.top-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 30; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .3s; }
.top-progress::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; background: linear-gradient(90deg, transparent, var(--brass), var(--accent-2)); animation: sp-slide 1.2s ease-in-out infinite; }
body.is-loading .top-progress { opacity: 1; }
.loader-card { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--brass) 45%, var(--line)); background: color-mix(in srgb, var(--brass-soft) 60%, var(--surface)); color: var(--ink-2); font: 500 15px var(--serif); animation: rise .3s ease-out; }
.list.compact .loader-card { border-radius: 0; border-width: 0 0 1px; }
.mini-scale { width: 44px; height: 34px; overflow: visible; }
.mini-scale * { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mini-scale .ms-l path:last-child, .mini-scale .ms-r path:last-child { stroke: var(--brass); fill: color-mix(in srgb, var(--brass) 20%, transparent); }
.ms-beam { transform-origin: 32px 12px; animation: sp-tilt 1.4s ease-in-out infinite; }
.ms-l { transform-origin: 12px 12px; animation: sp-keep 1.4s ease-in-out infinite; }
.ms-r { transform-origin: 52px 12px; animation: sp-keep 1.4s ease-in-out infinite; }

/* ---------- custom dropdowns ---------- */
.dd { position: relative; display: inline-flex; }
.dd-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; max-width: 220px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 12.5px; font-weight: 600; transition: border-color .15s, box-shadow .15s; }
.d-actions .dd-btn { height: 38px; border-radius: 10px; }
.dd.wide .dd-btn { max-width: 200px; }
.dd-btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); }
.dd.open .dd-btn { border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent); }
.dd-btn:disabled { opacity: .45; cursor: not-allowed; }
.dd-icon { width: 15px; height: 15px; color: var(--accent-2); }
.dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-chev { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(320px, calc(100vw - 32px)); padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); animation: dd-in .14s ease-out; }
.d-actions .dd-pop { left: auto; right: 0; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dd-search { width: 100%; height: 32px; margin-bottom: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 13px; outline: none; }
.dd-search:focus { border-color: var(--accent-2); }
.dd-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; scrollbar-width: thin; }
.dd-opt { position: relative; padding: 8px 30px 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.dd-opt.active { background: var(--surface-2); color: var(--ink); }
.dd-opt.selected { color: var(--accent-2); font-weight: 700; }
.dd-opt.selected::after { content: ""; position: absolute; right: 11px; top: 50%; width: 9px; height: 5px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-70%) rotate(-45deg); }
.dd-empty { padding: 10px; font-size: 13px; color: var(--muted); }

/* ---------- viewer loading animation ---------- */
.viewer-loader { display: grid; justify-items: center; gap: 12px; color: var(--ink-2); font: 500 15px var(--serif); }
.mini-scale.big { width: 72px; height: 54px; }

/* ---------- court chips ---------- */
.court-row { position: relative; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.court-chips { display: flex; gap: 8px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 2px; flex: 1; mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%); }
.court-chips::-webkit-scrollbar { display: none; }
.court-chip { flex: none; white-space: nowrap; }
.court-scroll { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); }
.court-scroll:disabled { opacity: .35; cursor: default; }
.court-scroll:hover:not(:disabled) { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.court-scroll svg { width: 15px; height: 15px; }

/* ---------- search within results ---------- */
.toolbar { justify-content: flex-end; }
.within { margin-right: auto; }
.within { display: flex; align-items: center; gap: 6px; flex: 1; max-width: 420px; height: 38px; padding: 0 4px 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.within:focus-within { border-color: var(--accent-2); }
.within svg { width: 16px; height: 16px; color: var(--muted); }
.within input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--ink); }

/* ---------- offline + install ---------- */
.offline-badge { display: inline-flex; align-items: center; gap: 5px; background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.offline-badge svg { width: 13px; height: 13px; }
.install-btn { height: 38px; padding: 0 12px; font-size: 13px; background: var(--brass-soft); color: var(--brass); border-color: color-mix(in srgb, var(--brass) 35%, transparent); }
.install-btn:hover { background: color-mix(in srgb, var(--brass) 18%, var(--surface)); }
.install-btn svg { width: 15px; height: 15px; }
.empty.offline { border-style: solid; background: color-mix(in srgb, var(--brass-soft) 50%, var(--surface)); padding: 24px 16px; }

@media (max-width: 640px) {
  .court-scroll { width: 26px; height: 26px; } /* ‹ › show there is more to scroll to */
  .within { max-width: none; flex-basis: 100%; }
  .install-btn span, .install-btn { font-size: 12px; padding: 0 9px; }
}

/* ---------- search modes (Database / AI) ---------- */
.search-modes { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.mode-check { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; transition: border-color .15s, background .15s, color .15s; }
.mode-check:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); color: var(--ink); }
.mode-check input { position: absolute; opacity: 0; pointer-events: none; }
.mc-box { display: grid; place-items: center; width: 18px; height: 18px; border: 2px solid var(--line); border-radius: 5px; background: var(--surface); transition: background .15s, border-color .15s; }
.mc-box svg { width: 12px; height: 12px; stroke-width: 3; color: #fff; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.mc-icon { width: 15px; height: 15px; color: var(--muted); }
.mode-check:has(input:checked) { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); background: color-mix(in srgb, var(--accent-2) 8%, var(--surface)); color: var(--ink); }
.mode-check input:checked + .mc-box { background: var(--accent); border-color: var(--accent); }
.mode-check input:checked + .mc-box svg { opacity: 1; transform: none; color: var(--accent-ink); }
.mode-check input:checked ~ .mc-icon { color: var(--accent-2); }
.mode-check.ai:has(input:checked) { border-color: color-mix(in srgb, #7c4dcc 55%, var(--line)); background: color-mix(in srgb, #7c4dcc 9%, var(--surface)); }
.mode-check.ai input:checked + .mc-box { background: #7c4dcc; border-color: #7c4dcc; }
.mode-check.ai input:checked ~ .mc-icon { color: #7c4dcc; }
.mode-check input:focus-visible + .mc-box { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- AI answer panel ---------- */
.ai-panel { margin-bottom: 18px; border: 1px solid color-mix(in srgb, #7c4dcc 30%, var(--line)); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; animation: rise .3s ease-out; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: linear-gradient(120deg, color-mix(in srgb, #7c4dcc 10%, var(--surface)), color-mix(in srgb, var(--brass) 8%, var(--surface))); border-bottom: 1px solid var(--line); }
.ai-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-title > svg { flex: none; width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: #7c4dcc; color: #fff; }
.ai-kicker { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7c4dcc; }
.ai-title h2 { margin: 2px 0 0; font: 600 18px/1.3 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.ai-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.ai-body { padding: 8px 16px 4px; }
.ai-sec { border-bottom: 1px solid var(--line); }
.ai-sec:last-child { border-bottom: 0; }
.ai-sec summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 2px; cursor: pointer; font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-2); }
.ai-sec summary::-webkit-details-marker { display: none; }
.ai-sec summary > svg:first-child { width: 17px; height: 17px; color: var(--brass); }
.ai-sec summary span { flex: 1; }
.ai-sec summary .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.ai-sec:not([open]) summary .chev { transform: rotate(-90deg); }
.ai-sec-body { padding: 0 2px 14px 29px; font: 15px/1.75 var(--serif); color: var(--ink-2); animation: rise .2s ease-out; }
.ai-sec-body p { margin: 0 0 10px; }
.ai-main .ai-sec-body p, .ai-conclusion .ai-sec-body p { padding: 12px 14px; margin: 0 0 8px; border-left: 3px solid var(--accent-2); border-radius: 6px; background: color-mix(in srgb, var(--accent-2) 7%, var(--surface)); color: var(--ink); }
.ai-conclusion .ai-sec-body p { border-left-color: var(--brass); background: color-mix(in srgb, var(--brass-soft) 70%, var(--surface)); }
.ai-principles { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.ai-principles li { position: relative; padding: 8px 0 8px 18px; border-bottom: 1px dashed var(--line); }
.ai-principles li:last-child { border-bottom: 0; }
.ai-principles li::before { content: ""; position: absolute; left: 2px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.ai-principles .ai-cite { display: flex; margin-top: 4px; }
.ai-cite { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 6px; padding: 0; border: 0; background: none; color: var(--brass); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.ai-cite span { font: 600 11px var(--mono); color: var(--muted); padding: 1px 6px; border-radius: 999px; background: var(--surface-2); }
.ai-cite:hover { text-decoration: underline; text-underline-offset: 3px; }
/* the cards of "Cases Referenced", spread in equal columns (only the card list: the section itself is also "ai-cases") */
div.ai-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.ai-case .c-cit { font: 600 12px var(--sans); letter-spacing: .02em; color: #1d4ed8; }
.ai-case { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: left; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ai-case:hover { border-color: color-mix(in srgb, var(--brass) 50%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow); }
.ai-case .c-name { font: 600 14px/1.35 var(--serif); color: var(--ink); }
.ai-loading { display: grid; justify-items: center; gap: 12px; padding: 30px 0 34px; color: var(--ink-2); font: 500 15px var(--serif); }
.ai-loading .splash-bar { opacity: 1; animation: none; }
.ai-error { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 0; color: var(--danger); }
.ai-note { margin: 0; padding: 10px 16px 14px; font-size: 12px; color: var(--muted); }
/* AI only: database results are set aside */
.results.ai-only .court-row, .results.ai-only #activeChips, .results.ai-only .toolbar, .results.ai-only #list, .results.ai-only #pager { display: none !important; }
@media (max-width: 640px) {
  .ai-head { flex-wrap: wrap; }
  .ai-actions .tool-btn span { display: none; }
  .ai-sec-body { padding-left: 2px; }
}
@media print {
  body.print-ai .layout > .side, body.print-ai .results > :not(#aiPanel), body.print-ai .drawer, body.print-ai .scrim, body.print-ai .toast { display: none !important; }
  body.print-ai .ai-actions, body.print-ai .ai-sec summary .chev { display: none !important; }
  body.print-ai .layout { display: block; }
  body.print-ai .ai-panel { box-shadow: none; border: 0; }
}

/* ---------- AI Assistant panel (judgment viewer) ---------- */
.tool-btn.ai-btn { color: #7c4dcc; border-color: color-mix(in srgb, #7c4dcc 35%, var(--line)); }
.tool-btn.ai-btn svg { color: #7c4dcc; }
.tool-btn.ai-btn.active { background: #7c4dcc; border-color: #7c4dcc; color: #fff; }
.tool-btn.ai-btn.active svg { color: #fff; }
.d-body.with-ai { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: minmax(0, 1fr); }
.d-body.with-ai.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 380px; }
.d-body.with-ai .pane { position: relative; inset: auto; display: flex; flex-direction: column; min-width: 0; }
.d-body.with-ai iframe { flex: 1; height: auto; }
.ai-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--surface-2); }
.ai-side[hidden] { display: none !important; }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, color-mix(in srgb, #7c4dcc 12%, var(--surface)), var(--surface)); }
.as-title { display: flex; align-items: center; gap: 10px; }
.as-title > svg { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: #7c4dcc; color: #fff; flex: none; }
.as-title b { display: block; font: 600 16px var(--serif); color: var(--ink); }
.as-title span { font-size: 12px; color: var(--muted); }
.as-head .icon-btn { width: 32px; height: 32px; }
.as-tasks { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.as-task { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 600; transition: border-color .15s, color .15s, background .15s; }
.as-task svg { width: 14px; height: 14px; color: #7c4dcc; }
.as-task:hover:not(:disabled) { border-color: color-mix(in srgb, #7c4dcc 50%, var(--line)); color: var(--ink); background: color-mix(in srgb, #7c4dcc 6%, var(--surface)); }
.as-task:disabled { opacity: .45; cursor: progress; }
.as-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.as-empty { margin: auto 0; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); font-size: 14px; }
.as-empty p { margin: 0 0 10px; }
.as-sugg-title { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.as-sugg { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink-2); font-size: 13px; }
.as-sugg:hover { border-color: color-mix(in srgb, #7c4dcc 45%, var(--line)); color: var(--ink); }
.as-msg { animation: rise .2s ease-out; }
.as-msg.q { align-self: flex-end; max-width: 88%; }
.as-bubble { padding: 9px 13px; border-radius: 14px 14px 4px 14px; background: var(--accent); color: var(--accent-ink); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.as-msg.a { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.as-label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #7c4dcc; }
.as-label svg { width: 14px; height: 14px; }
.as-answer { font: 14.5px/1.65 var(--serif); color: var(--ink-2); overflow-wrap: anywhere; }
.as-answer h4 { margin: 12px 0 4px; font: 700 13px var(--sans); letter-spacing: .02em; color: var(--ink); }
.as-answer h4:first-child { margin-top: 0; }
.as-answer p { margin: 0 0 8px; }
.as-answer ul, .as-answer ol { margin: 0 0 8px; padding-left: 20px; }
.as-answer li { margin: 3px 0; }
.as-answer strong { color: var(--ink); }
.para-link { padding: 0 5px; margin: 0 1px; border: 0; border-radius: 5px; background: var(--brass-soft); color: var(--brass); font: 600 12px var(--sans); cursor: pointer; }
.para-link:hover { background: var(--brass); color: #fff; }
.as-caret { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: #7c4dcc; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.as-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.as-typing span { width: 7px; height: 7px; border-radius: 50%; background: #7c4dcc; opacity: .35; animation: as-dot 1.1s ease-in-out infinite; }
.as-typing span:nth-child(2) { animation-delay: .15s; }
.as-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes as-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.as-err { color: var(--danger); margin: 0; }
.as-stopped { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); font-style: italic; }
.as-ask { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px 6px; border-top: 1px solid var(--line); background: var(--surface); }
.as-ask textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.4; outline: none; -webkit-user-select: text; user-select: text; }
.as-ask textarea:focus { border-color: #7c4dcc; }
.as-send { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: #7c4dcc; color: #fff; }
.as-send svg { width: 18px; height: 18px; }
.as-send.stop { background: var(--ink-2); }
.as-note { margin: 0; padding: 4px 14px 10px; font-size: 11.5px; color: var(--muted); background: var(--surface); }
@media (max-width: 900px) {
  .d-body.with-ai, .d-body.with-ai.split { display: block; }
  .ai-side { position: absolute; inset: 0; z-index: 6; border-left: 0; }
}

/* AI Assistant full screen inside the judgment window */
.as-head-btns { display: flex; gap: 6px; }
#aiMax .i-shrink { display: none; }
#aiMax[aria-pressed="true"] .i-expand { display: none; }
#aiMax[aria-pressed="true"] .i-shrink { display: inline; }
.d-body.with-ai.ai-max, .d-body.with-ai.split.ai-max { grid-template-columns: minmax(0, 1fr); }
.d-body.ai-max .pane { display: none !important; }
.d-body.ai-max .ai-side { border-left: 0; }
.d-body.ai-max .as-tasks, .d-body.ai-max .as-feed > *, .d-body.ai-max .as-ask, .d-body.ai-max .as-note { width: 100%; max-width: 860px; margin-left: auto; margin-right: auto; }
.d-body.ai-max .as-feed { align-items: stretch; }
.d-body.ai-max .as-msg.q { align-self: auto; max-width: 860px; display: flex; justify-content: flex-end; }
.d-body.ai-max .as-answer { font-size: 16px; }

/* ---------- results: sort & filter bar ---------- */
.result-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.result-filters .dd-btn { height: 34px; }
.tool-btn#alertMe { height: 34px; }
.tool-btn#alertMe.active { background: var(--brass-soft); color: var(--brass); border-color: color-mix(in srgb, var(--brass) 45%, var(--line)); }
.toolbar { flex-wrap: wrap; row-gap: 10px; }

/* ---------- did you mean ---------- */
.dym { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); }
.dym-link small { font-weight: 600; color: var(--muted); text-decoration: none; }
.dym.checking { font-size: 14px; color: var(--muted); }
.dym .spinner { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.empty-actions .btn { margin-top: 0; }
.empty-actions .ai-go svg { width: 16px; height: 16px; }
.dym-or { margin: 0 4px; color: var(--muted); font-size: 13px; }
.dym-count { font-size: 13px; color: var(--muted); }
.dym-link { padding: 0; border: 0; background: none; color: var(--accent-2); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- AI buttons and citations ---------- */
.btn.ai-go { background: #7c4dcc; color: #fff; }
.as-answer .ai-cite span { color: var(--brass); background: var(--brass-soft); }

/* ---------- alerts ---------- */
.alerts-wrap, .save-wrap, .share-wrap { position: relative; }
.alert-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font: 700 10.5px/18px var(--sans); text-align: center; }
.alert-pop, .pop { position: absolute; z-index: 60; top: calc(100% + 8px); right: 0; width: min(340px, calc(100vw - 32px)); padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); animation: dd-in .14s ease-out; text-align: left; }
.ap-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ap-head b { font: 600 15px var(--serif); color: var(--ink); }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.alert-list li { display: flex; align-items: flex-start; gap: 4px; }
.al-open { flex: 1; display: grid; gap: 2px; padding: 8px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.al-open:hover { background: var(--surface-2); }
.al-label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.al-meta { font-size: 12px; color: var(--muted); }
.al-meta b { color: var(--danger); }
.ap-tip { margin: 10px 2px 0; font-size: 12px; color: var(--muted); }

/* ---------- save / share pop-ups ---------- */
.icon-btn#dSave.saved { color: var(--brass); border-color: color-mix(in srgb, var(--brass) 45%, var(--line)); }
.icon-btn#dSave.saved svg { fill: var(--brass); }
.pop-title { margin: 0 0 10px; font: 600 15px var(--serif); color: var(--ink); }
.pop-label { display: grid; gap: 5px; margin: 8px 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.pop textarea, .pop-input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); font: 14px var(--sans); resize: vertical; -webkit-user-select: text; user-select: text; outline: none; }
.pop textarea:focus, .pop-input:focus { border-color: var(--accent-2); }
.folder-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.fchip-opt input { position: absolute; opacity: 0; pointer-events: none; }
.fchip-opt span { display: inline-block; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; }
.fchip-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.share-pop { width: 260px; }
.share-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; text-align: left; cursor: pointer; }
.share-opt:hover { background: var(--surface-2); }
.share-opt::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.share-opt.wa::before { background: #25d366; }
.share-opt.tg::before { background: #229ed9; }
.share-opt.em::before { background: var(--brass); }
.share-opt.cp::before { background: var(--accent-2); }
.share-note { margin: 8px 4px 0; font-size: 11.5px; color: var(--muted); }

/* ---------- My Research (left panel) ---------- */
.research-body { padding: 4px 4px 12px; }
.rf { margin-bottom: 8px; }
.rf-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.rf-head span { flex: 1; }
.rf-head b { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); }
.rf-del, .rf-x { flex: none; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.rf-del:hover, .rf-x:hover { background: var(--surface-2); color: var(--danger); }
.rf-item { display: flex; align-items: flex-start; }
.rf-item > button:first-child { flex: 1; }
.r-note { font-size: 12px; color: var(--ink-2); font-style: italic; }

/* ---------- AI tools: similar + compare ---------- */
.sim-q { margin: 0 0 10px; font: 13px var(--sans); color: var(--muted); }
.sim-chip { display: inline-block; margin: 2px 2px 0 0; padding: 2px 8px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); font-weight: 600; }
.sim-list { display: grid; gap: 8px; }
.sim-item { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: left; cursor: pointer; transition: border-color .15s; }
.sim-item:hover { border-color: color-mix(in srgb, #7c4dcc 50%, var(--line)); }
.sim-item .c-name { font: 600 14px/1.35 var(--serif); color: var(--ink); }
.sim-snip { font: 12.5px/1.5 var(--sans); color: var(--ink-2); }

/* ---------- Refine (judgment window) ---------- */
.refine { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 3px 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.refine:focus-within { border-color: var(--accent-2); }
.refine > svg { width: 15px; height: 15px; color: var(--muted); }
.refine input { width: 150px; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--ink); -webkit-user-select: text; user-select: text; }
.refine input:disabled { opacity: .5; }
@media (max-width: 900px) { .refine input { width: 110px; } }

/* ---------- AI token usage ---------- */
.tok-stack { position: fixed; top: 14px; right: 14px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.tok { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 10px 12px 12px; border: 1px solid color-mix(in srgb, #7c4dcc 30%, var(--line));
  border-radius: 12px; background: var(--surface); box-shadow: 0 10px 30px rgba(20, 16, 40, .18); font: 13px var(--sans); color: var(--muted); text-align: left;
  font-variant-numeric: tabular-nums; cursor: pointer; pointer-events: auto; opacity: 0; transform: translateX(30px) scale(.96);
  transition: opacity .35s ease, transform .4s cubic-bezier(.2, .9, .3, 1.2); }
.tok.go { opacity: 1; transform: none; }
.tok.out { opacity: 0; transform: translateX(30px); transition-duration: .3s; }
.tok svg { width: 30px; height: 30px; padding: 7px; border-radius: 9px; background: #7c4dcc; fill: #fff; stroke: none; flex: none; }
.tok.go svg { animation: tok-pop .6s ease-out 1; }
@keyframes tok-pop { 0% { transform: scale(.5); } 60% { transform: scale(1.2); } 100% { transform: none; } }
.tok span { display: flex; flex-direction: column; line-height: 1.3; }
.tok span.tok-n { display: block; }
.tok small { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.tok b { font-size: 16px; font-weight: 700; color: #7c4dcc; }
.tok em { font-style: normal; font-size: 11.5px; }
.tok-x { font-style: normal; font-size: 18px; line-height: 1; color: var(--muted); margin-left: 4px; align-self: flex-start; }
.tok-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #7c4dcc; transform-origin: left; }
.tok.go .tok-timer { animation: tok-timer 5s linear forwards; }
@keyframes tok-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.tok.cached svg, .tok.cached .tok-timer { background: var(--muted); }
.tok.cached b { color: var(--ink-2); }
.tok-today { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 14px; border-top: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tok-today svg { width: 14px; height: 14px; fill: #7c4dcc; stroke: none; flex: none; }
.tok-today b { color: var(--ink); }
.tok-today > span { flex: 1; }
.tok-gauge { flex: 0 0 64px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tok-gauge i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #8f6ad8, #7c4dcc); transition: width .9s ease; }
.tok-today.full { color: #b42318; }
.tok-today.full b { color: #b42318; }
.tok-today.full svg { fill: #b42318; }
/* daily AI limit reached: switch off the AI tools in the judgment viewer */
body.ai-off .as-task, body.ai-off .as-sugg, body.ai-off #aiAsk { opacity: .45; pointer-events: none; filter: grayscale(1); }
.tok-today.bump { animation: tok-bump .9s ease-out; }
@keyframes tok-bump { 0% { background: color-mix(in srgb, #7c4dcc 22%, var(--surface)); } 100% { background: var(--surface); } }

@media (prefers-reduced-motion: reduce) {
  .tok { opacity: 1; transform: none; }
  .tok.go .tok-timer { animation: none; }
  .sp-draw, .sp-ring { stroke-dashoffset: 0 !important; }
  .sp-knob { transform: none !important; }
  .splash-name, .splash-tag, .splash-bar { opacity: 1 !important; transform: none !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, .hero, .toolbar, .pager, .foot, .c-actions, .active-chips { display: none !important; }
}

/* ---------- AI usage box (left sidebar) ---------- */
.tok-box { margin-top: 12px; padding: 12px; border: 1px solid color-mix(in srgb, #7c4dcc 25%, var(--line)); border-radius: 12px;
  background: linear-gradient(160deg, color-mix(in srgb, #7c4dcc 7%, var(--surface)), var(--surface) 70%); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tok-box:empty { display: none; }
.tok-box h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font: 600 14px var(--sans); color: var(--ink); }
.tok-box h3 svg { width: 15px; height: 15px; fill: #7c4dcc; stroke: none; }
.tb-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.tb-name { display: flex; flex-direction: column; color: var(--ink-2); font-weight: 600; }
.tb-name small { font-weight: 400; font-size: 11px; color: var(--muted); }
.tb-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.tb-m b { color: #7c4dcc; font-size: 13.5px; }
.tb-val small { font-size: 11px; }
.tb-val small b { color: var(--ink-2); font-weight: 600; }
.tb-free { padding-bottom: 6px; }
.tb-free .tb-row { border-top: 0; padding-top: 0; }
.tb-free .tok-gauge { display: block; height: 6px; margin: 2px 0 4px; }
.tb-left { font-size: 11px; }
.tb-total { border-top: 1px solid var(--line); }
.tb-total .tb-name { color: var(--ink); }
.tok-box.full .tok-gauge i { background: #b42318; }
.tok-box.full .tb-left { color: #b42318; font-weight: 600; }

/* ---------- purchase more tokens ---------- */
.tb-buy { margin-top: 10px; padding: 12px; border-radius: 10px; text-align: center;
  background: linear-gradient(135deg, color-mix(in srgb, #7c4dcc 14%, var(--surface)), color-mix(in srgb, var(--brass) 14%, var(--surface)));
  border: 1px solid color-mix(in srgb, #7c4dcc 35%, var(--line)); animation: tb-buy-in .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes tb-buy-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.tb-buy p { margin: 0; }
.tb-buy-title { font: 700 14px var(--sans); color: #b42318; }
.tb-buy-sub { margin: 2px 0 10px !important; font-size: 12.5px; color: var(--ink-2); }
.tb-buy-sub b { color: #7c4dcc; font-size: 14px; }
.tb-packs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px; }
.tb-pack { display: flex; flex-direction: column; align-items: center; padding: 5px 2px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font: 600 12.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.tb-pack small { font-weight: 400; font-size: 10.5px; color: var(--muted); }
.tb-pack:hover { border-color: #7c4dcc; }
.tb-pack.on { border-color: #7c4dcc; background: #7c4dcc; color: #fff; }
.tb-pack.on small { color: rgba(255, 255, 255, .85); }
.tb-buy-go { width: 100%; justify-content: center; background: #7c4dcc; color: #fff; font-weight: 700; animation: tb-glow 2s ease-in-out infinite; }
.tb-buy-go:hover { background: #6a3dbb; }
@keyframes tb-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 77, 204, .45); } 50% { box-shadow: 0 0 0 6px rgba(124, 77, 204, 0); } }
@media (prefers-reduced-motion: reduce) { .tb-buy, .tb-buy-go { animation: none; } }

/* ---------- flipbook view ---------- */
.flipbook { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 50% 35%, #4a3a2a 0%, #2b2118 55%, #17110c 100%); animation: fb-in .35s ease-out; }
.flipbook[hidden] { display: none; }
@keyframes fb-in { from { opacity: 0; } to { opacity: 1; } }
.fb-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; color: #f3e9d8;
  background: rgba(0, 0, 0, .28); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.fb-title { display: flex; align-items: center; gap: 8px; font: 600 15px var(--serif); }
.fb-title svg { width: 20px; height: 20px; fill: none; stroke: #e7c27d; stroke-width: 1.8; }
.fb-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.flipbook .tool-btn { color: #f3e9d8; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); }
.flipbook .tool-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }
.flipbook .tool-btn:disabled { opacity: .35; }
.fb-pages { min-width: 128px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.fb-range { width: min(240px, 30vw); accent-color: #e7c27d; }
.fb-close { margin-left: 4px; }
.fb-stage { position: relative; flex: 1; min-height: 0; }
.fb-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.fb-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: #f3e9d8; transition: opacity .3s; pointer-events: none; }
.fb-loading.done { opacity: 0; }
@media (max-width: 700px) {
  .fb-range { order: 5; width: 100%; }
  .fb-close span, #fbFirst, #fbLast { display: none; }
  .fb-pages { min-width: 96px; }
}

/* ---------- reading panel (left side of the judgment viewer) ---------- */
.d-main { position: relative; display: flex; flex: 1; min-height: 0; }
.d-main > .d-body { flex: 1; min-width: 0; }
.read-side { flex: none; width: 272px; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface-2); animation: rs-in .25s ease-out; }
.read-side[hidden] { display: none; }
@keyframes rs-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.rs-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); font: 600 14px var(--sans); }
.rs-head .icon-btn { width: 30px; height: 30px; }
.rs-scroll { flex: 1; min-height: 0; overflow: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.rs-sec { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rs-sec:last-child { border-bottom: 0; }
.rs-sec h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font: 600 13.5px var(--sans); color: var(--ink); }
.rs-sec h4 svg, .rs-stats svg { width: 16px; height: 16px; color: var(--brass); flex: none; }
.rs-sec h4 small { font-weight: 400; color: var(--muted); }
.rs-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.rs-stats span { display: flex; align-items: center; gap: 6px; }
.rs-stats b { color: var(--ink); font-weight: 600; }
.rs-progress { height: 6px; margin: 10px 0 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rs-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--brass), #d9a64a); transition: width .3s ease; }
.rs-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rs-row span { margin-right: auto; }
.rs-link { padding: 0; border: 0; background: none; font: 600 12px var(--sans); color: var(--accent); cursor: pointer; }
.rs-link:hover { text-decoration: underline; }
.rs-hint { margin: 6px 0 8px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.rs-hl-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rs-toggle { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 12px var(--sans); color: var(--ink-2); cursor: pointer; }
.rs-toggle i { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--line); transition: background .2s; }
.rs-toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .2s; }
.rs-toggle[aria-pressed="true"] { border-color: var(--brass); color: var(--ink); }
.rs-toggle[aria-pressed="true"] i { background: var(--brass); }
.rs-toggle[aria-pressed="true"] i::after { transform: translateX(12px); }
.rs-colors { display: flex; gap: 6px; }
.rs-colors button { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.rs-colors button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink-2); }
.rs-colors [data-c="y"], .hl-dot.y { background: #ffd84d; }
.rs-colors [data-c="g"], .hl-dot.g { background: #6fd47e; }
.rs-colors [data-c="p"], .hl-dot.p { background: #ff8fb8; }
.rs-colors [data-c="b"], .hl-dot.b { background: #79b4ff; }
.rs-hl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-hl-list li { padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); animation: rs-in .2s ease-out; }
.rs-hl-top { display: flex; align-items: center; gap: 6px; }
.hl-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rs-hl-go { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: 600 12.5px var(--sans); color: var(--ink); cursor: pointer; }
.rs-hl-go:hover { color: var(--accent); }
.rs-hl-del { padding: 0 2px; border: 0; background: none; font-size: 16px; line-height: 1; color: var(--muted); cursor: pointer; }
.rs-hl-del:hover { color: #b42318; }
.rs-hl-prev { margin: 3px 0 6px 16px; font-size: 11.5px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rs-hl-list textarea { width: 100%; min-height: 30px; resize: vertical; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font: 12.5px/1.4 var(--sans); color: var(--ink); -webkit-user-select: text; user-select: text; }
.rs-hl-list textarea:focus { outline: 2px solid color-mix(in srgb, var(--brass) 50%, transparent); border-color: var(--brass); }
.rs-export { margin-top: 10px; width: 100%; justify-content: center; }
.rs-export svg { width: 15px; height: 15px; }
.rs-empty { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .read-side { position: absolute; z-index: 8; top: 0; left: 0; bottom: 0; width: min(320px, 88vw); box-shadow: var(--shadow-lg); }
}
@media (max-width: 700px) { #tRead span { display: none; } }

/* hide / show tab on the edge of the reading panel */
.rs-handle { position: absolute; z-index: 9; top: 50%; left: 0; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface); color: var(--ink-2);
  box-shadow: 2px 2px 10px rgba(0, 0, 0, .12); cursor: pointer; font: 600 11px var(--sans); transition: left .25s cubic-bezier(.2, .8, .2, 1), background .15s; }
.rs-handle:hover { background: var(--brass-soft, var(--surface-2)); color: var(--ink); }
.rs-handle svg { width: 16px; height: 16px; transition: transform .25s; }
.rs-handle span { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; }
.drawer.rs-open .rs-handle { left: 272px; }
.drawer.rs-open .rs-handle svg { transform: rotate(180deg); }
@media (max-width: 900px) {
  .drawer.rs-open .rs-handle { left: min(320px, 88vw); }
  .d-main:has(.ai-side:not([hidden])) .rs-handle { display: none; } /* the AI Assistant covers the judgment on phones */
}

/* hide / show tab for the AI Assistant, on the right edge (mirrors the reading-panel tab) */
.ai-handle { position: absolute; z-index: 9; top: 50%; right: 0; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border: 1px solid color-mix(in srgb, #7c4dcc 35%, var(--line)); border-right: 0; border-radius: 10px 0 0 10px; background: #7c4dcc; color: #fff;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, .15); cursor: pointer; font: 600 11px var(--sans); transition: right .25s cubic-bezier(.2, .8, .2, 1), background .15s; }
.ai-handle:hover { background: #6a3dbb; }
.ai-handle svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.ai-handle span { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em; }
.drawer.ai-open .ai-handle { right: 400px; background: var(--surface); color: #7c4dcc; }
.drawer.ai-open .d-body.split ~ .ai-handle, .drawer.ai-open:has(.d-body.split) .ai-handle { right: 380px; }
.drawer:has(.d-body.ai-max) .ai-handle { display: none; }
@media (max-width: 900px) {
  .drawer.ai-open .ai-handle { display: none; } /* the assistant covers the judgment; it has its own close button */
}




/* ---------- statutes ---------- */
.rs-statutes { display: flex; flex-direction: column; gap: 8px; }
.hs-item { padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.hs-name { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.hs-name b { display: block; font: 700 12.5px var(--sans); color: var(--ink); }
.hs-name span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.hs-name:hover b { color: var(--accent); }
.hs-ai { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 9px; border: 1px solid color-mix(in srgb, #7c4dcc 35%, var(--line)); border-radius: 999px; background: color-mix(in srgb, #7c4dcc 8%, var(--surface)); font: 600 11.5px var(--sans); color: #7c4dcc; cursor: pointer; }
.hs-ai svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.hs-ai:hover, .hs-ai[aria-expanded="true"] { background: #7c4dcc; color: #fff; }
.hs-answer { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; line-height: 1.5; }
.hs-answer p { margin: 0 0 6px; }
.hs-answer h3, .hs-answer h4, .hs-answer strong { font-size: 12.5px; }

/* ---------- case timeline ---------- */
.rs-tl { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; max-height: 420px; overflow: auto; scrollbar-width: thin; }
.rs-tl::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--brass), color-mix(in srgb, var(--brass) 25%, transparent)); border-radius: 2px; }
.tl-year { margin: 8px 0 4px -14px; font: 700 11px var(--sans); letter-spacing: .06em; color: var(--brass); }
.tl-year:first-child { margin-top: 0; }
.tl-item { position: relative; display: block; width: 100%; margin: 0 0 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; cursor: pointer; }
.tl-item::before { content: ""; position: absolute; left: -15px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brass); box-sizing: border-box; }
.tl-item:hover { border-color: var(--brass); }
.tl-item:hover::before { background: var(--brass); }
.tl-item b { display: block; font: 700 12px var(--sans); color: var(--ink); }
.tl-item b small { font-weight: 400; color: var(--muted); }
.tl-item span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }


/* ---------- brief cards (AI Assistant) ---------- */
.bc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.bc-card { --c: var(--brass); padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); border-top: 4px solid var(--c); border-radius: 10px;
  background: color-mix(in srgb, var(--c) 6%, var(--surface)); animation: bc-in .35s ease-out both; animation-delay: calc(var(--i) * 90ms); }
.bc-card h4 { margin: 0 0 6px; font: 700 12.5px var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--c); }
.bc-card ul { margin: 0; padding-left: 18px; }
.bc-card p, .bc-card li { font-size: 13px; line-height: 1.5; margin: 0 0 4px; }
.bc-facts { --c: #2563eb; }
.bc-issues { --c: #b45309; }
.bc-held { --c: #15803d; }
.bc-ratio { --c: #7c4dcc; }
@keyframes bc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- section digest ---------- */
.dg-wait { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dg-total { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.hs-paras { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.hs-paras small { margin-right: 2px; font-size: 11px; color: var(--muted); }
.hs-para { padding: 2px 8px; border: 1px solid color-mix(in srgb, var(--brass) 45%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--brass) 10%, var(--surface)); font: 600 11px var(--sans); color: var(--ink-2); cursor: pointer; }
.hs-para:hover { background: var(--brass); border-color: var(--brass); color: #fff; }
.hs-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.hs-btns .hs-ai { margin-top: 0; }
.hs-digest { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 11.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.hs-digest svg { width: 13px; height: 13px; fill: #7c4dcc; stroke: none; }
.hs-digest:hover { border-color: #7c4dcc; color: #7c4dcc; }

/* ---------- legal tools (home sidebar) ---------- */
.tools-body { padding: 0 6px 10px; }
.tool-card { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; cursor: pointer; }
.tool-card b { font-size: 13px; color: var(--ink); }
.tool-card span { font-size: 11.5px; color: var(--muted); }
.tool-card:hover { border-color: var(--brass); }

/* ---------- motor accident calculator ---------- */
.calc-modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(8, 11, 18, .5); animation: fade .2s; }
.calc-modal[hidden] { display: none; }
.calc-card { display: flex; flex-direction: column; width: min(900px, 100%); max-height: min(92vh, 900px); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
.calc-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.calc-head > svg { width: 30px; height: 30px; padding: 5px; border-radius: 9px; background: var(--brass-soft, var(--surface-2)); color: var(--brass); flex: none; }
.calc-head div { flex: 1; min-width: 0; }
.calc-head h2 { margin: 0; font: 600 18px var(--serif); }
.calc-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.calc-body { display: grid; grid-template-columns: 300px 1fr; min-height: 0; overflow: auto; }
.calc-form { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-right: 1px solid var(--line); background: var(--surface-2); }
.calc-form label { display: flex; flex-direction: column; gap: 4px; font: 600 12px var(--sans); color: var(--ink-2); }
.calc-form input, .calc-form select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 14px var(--sans); }
.calc-form input:focus, .calc-form select:focus { outline: 2px solid color-mix(in srgb, var(--brass) 50%, transparent); border-color: var(--brass); }
.calc-result { padding: 16px 18px; }
.calc-total { padding: 14px 16px; border-radius: 12px; background: linear-gradient(135deg, #1f2a44, #2f3f66); color: #fff; }
.calc-total small { display: block; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; opacity: .8; }
.calc-total b { font: 700 28px var(--serif); font-variant-numeric: tabular-nums; }
.calc-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 13px; }
.calc-table th, .calc-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.calc-table th { text-align: left; font-weight: 600; color: var(--ink-2); }
.calc-table th small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.calc-table td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
.calc-table tr.sub th, .calc-table tr.sub td { font-weight: 700; background: var(--surface-2); }
.calc-table tr.total th, .calc-table tr.total td { font-weight: 700; font-size: 14.5px; border-bottom: 0; border-top: 2px solid var(--ink-2); }
.calc-note { margin: 12px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
@media (max-width: 720px) {
  .calc-body { grid-template-columns: 1fr; }
  .calc-form { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---------- precedents: filter by the court's opinion ---------- */
.prec-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 6px 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.prec-filters > span { flex-basis: 100%; font: 700 12px var(--sans); color: var(--ink); }
.cases-pop .prec-f { --c: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 5px 10px; border: 2px solid var(--c); border-radius: 9px;
  background: var(--surface); font: 600 12px var(--sans); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); cursor: pointer; }
.cases-pop .prec-f small { min-width: 18px; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-weight: 700; text-align: center; }
.cases-pop .prec-f:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.cases-pop .prec-f[aria-pressed="true"] { background: var(--c); color: #fff; }
.cases-pop .prec-f[aria-pressed="true"] small { background: rgba(255, 255, 255, .25); color: #fff; }
.cases-pop .prec-f:disabled { opacity: .45; cursor: default; }
.prec-party, .cases-pop .prec-f.prec-party { --c: #1d4ed8; }
.prec-accepted, .cases-pop .prec-f.prec-accepted { --c: #15803d; }
.prec-negative, .cases-pop .prec-f.prec-negative { --c: #c2410c; }
.prec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 10px 8px; }
.prec-tag { padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--c); font: 700 10.5px var(--sans); }
.cases-pop .prec-para { width: auto; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 10.5px var(--sans); color: var(--ink-2); }
.cases-pop .prec-para:hover { border-color: var(--brass); color: var(--ink); background: var(--surface); }
.cases-pop li + li { border-top: 1px solid var(--line); }

/* ---------- brief cards: print ---------- */
.bc-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.bc-actions .btn svg { width: 15px; height: 15px; }

/* ---------- "At a glance" bar along the bottom of the judgment window ---------- */
.gl-bar { position: relative; flex: none; z-index: 15; border-top: 1px solid var(--line); background: var(--surface); }
.gl-bar[hidden] { display: none; }
.gl-tabs { display: flex; align-items: center; gap: 6px; padding: 7px 12px; overflow-x: auto; scrollbar-width: thin; }
.gl-title { flex: none; margin-right: 4px; font: 700 11px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gl-tab { --c: var(--ink-2); flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid color-mix(in srgb, var(--c) 40%, var(--line)); border-radius: 999px;
  background: color-mix(in srgb, var(--c) 7%, var(--surface)); font: 600 12.5px var(--sans); color: var(--ink); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.gl-tab i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.gl-tab small { padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); font-weight: 700; }
.gl-tab:hover { background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.gl-tab[aria-selected="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.gl-tab[aria-selected="true"] i { background: #fff; }
.gl-tab[aria-selected="true"] small { background: rgba(255, 255, 255, .25); color: #fff; }
.gl-facts { --c: #2563eb; } .gl-issues { --c: #b45309; } .gl-pet { --c: #0e7490; } .gl-resp { --c: #be185d; }
.gl-law { --c: #7c4dcc; } .gl-reason { --c: #15803d; } .gl-order { --c: #b42318; }
.gl-sheet { --c: var(--ink-2); position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); max-height: min(46vh, 420px); display: flex; flex-direction: column;
  border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); animation: gl-up .22s cubic-bezier(.2, .8, .2, 1); }
.gl-sheet[hidden] { display: none; }
@keyframes gl-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.gl-sheet header { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--line); }
.gl-sheet header b { font: 700 13px var(--sans); color: var(--c); text-transform: uppercase; letter-spacing: .05em; }
.gl-sheet header span { flex: 1; font-size: 11.5px; color: var(--muted); }
.gl-sheet header .icon-btn { width: 30px; height: 30px; }
.gl-sheet ol { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.gl-item { display: flex; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; text-align: left; cursor: pointer; font: 13.5px/1.5 var(--serif); color: var(--ink-2); }
.gl-item b { flex: none; min-width: 56px; font: 700 12px var(--sans); color: var(--c); padding-top: 2px; }
.gl-item:hover, .gl-item.cur { background: color-mix(in srgb, var(--c) 9%, var(--surface)); color: var(--ink); }
@media (max-width: 700px) {
  .gl-title { display: none; }
  .gl-sheet { left: 6px; right: 6px; max-height: 55vh; }
}

/* ---------- precedent filters in the bottom bar ---------- */
.gl-sep { flex: none; width: 1px; height: 22px; margin: 0 6px; background: var(--line); }
.gl-tab.gl-pv { border-width: 2px; border-color: var(--c); background: var(--surface); border-radius: 9px; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.gl-tab.gl-pv:disabled { opacity: .45; cursor: default; }
.gl-tab.prec-party, .gl-sheet.prec-party { --c: #1d4ed8; }
.gl-tab.prec-accepted, .gl-sheet.prec-accepted { --c: #15803d; }
.gl-tab.prec-negative, .gl-sheet.prec-negative { --c: #c2410c; }
.pv-item { padding: 8px 10px; border-radius: 9px; }
.pv-item + .pv-item { border-top: 1px solid var(--line); }
.pv-open { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.pv-open b { font: 600 13.5px var(--serif); color: var(--ink); }
.pv-open span { font: 600 11.5px var(--sans); color: var(--c); }
.pv-open:hover b { color: var(--accent); text-decoration: underline; }
.pv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; }
.pv-meta em { margin-right: 4px; font-size: 11.5px; font-style: normal; color: var(--muted); }
@media (min-width: 701px) {
  .gl-tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
}

/* ---------- bottom bar: professional colour design ---------- */
.gl-facts { --c: #2563eb; --c2: #60a5fa; }
.gl-issues { --c: #d97706; --c2: #fbbf24; }
.gl-pet { --c: #0891b2; --c2: #22d3ee; }
.gl-resp { --c: #db2777; --c2: #f472b6; }
.gl-law { --c: #7c3aed; --c2: #a78bfa; }
.gl-reason { --c: #059669; --c2: #34d399; }
.gl-order { --c: #dc2626; --c2: #f87171; }
.gl-tab.prec-party, .gl-sheet.prec-party { --c: #1d4ed8; --c2: #3b82f6; }
.gl-tab.prec-accepted, .gl-sheet.prec-accepted { --c: #15803d; --c2: #22c55e; }
.gl-tab.prec-negative, .gl-sheet.prec-negative { --c: #c2410c; --c2: #fb923c; }

.gl-bar { border-top: 0; background: linear-gradient(180deg, color-mix(in srgb, #7c3aed 5%, var(--surface)), var(--surface) 70%);
  box-shadow: 0 -8px 22px rgba(15, 23, 42, .08); }
.gl-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #2563eb, #0891b2, #059669, #d97706, #dc2626, #db2777, #7c3aed, #2563eb); background-size: 200% 100%; animation: gl-stripe 12s linear infinite; }
@keyframes gl-stripe { to { background-position: 200% 0; } }
.gl-tabs { padding: 11px 14px 9px; gap: 8px; }
.gl-title { display: inline-flex; align-items: center; gap: 6px; margin-right: 2px; font: 800 10.5px var(--sans); letter-spacing: .12em; text-transform: uppercase;
  background: linear-gradient(90deg, #7c3aed, #2563eb); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gl-title svg { width: 14px; height: 14px; fill: #7c3aed; stroke: none; }
.gl-sep { height: 26px; margin: 0 8px; background: linear-gradient(180deg, transparent, var(--line), transparent); width: 2px; }

.gl-tab { --c2: var(--c); gap: 7px; padding: 4px 6px 4px 4px; border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line)); border-radius: 999px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .06); font: 600 12.5px var(--sans); color: var(--ink);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s, background .25s, color .2s, border-color .2s; }
.gl-tab .gl-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--c) 40%, transparent); }
.gl-ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gl-tab small { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; font: 700 11px var(--sans); text-align: center; }
.gl-tab:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--c); background: color-mix(in srgb, var(--c) 6%, var(--surface));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 28%, transparent); }
.gl-tab[aria-selected="true"] { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--c), var(--c2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 45%, transparent); }
.gl-tab[aria-selected="true"] .gl-ico { background: rgba(255, 255, 255, .22); box-shadow: none; }
.gl-tab[aria-selected="true"] small { background: #fff; color: var(--c); }
.gl-tab.gl-pv { border-radius: 12px; border: 2px solid color-mix(in srgb, var(--c) 70%, var(--line)); }
.gl-tab.gl-pv[aria-selected="true"] { border-color: transparent; }
.gl-tab:disabled { opacity: .4; filter: grayscale(.6); }

.gl-sheet { border: 0; border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 44px rgba(15, 23, 42, .24), 0 0 0 1px color-mix(in srgb, var(--c) 25%, var(--line)); }
.gl-sheet header { gap: 9px; padding: 11px 12px 11px 14px; border-bottom: 0; color: #fff; background: linear-gradient(135deg, var(--c), var(--c2)); }
.gl-sheet header .gl-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; flex: none; }
.gl-sheet header b { color: #fff; font-size: 13.5px; }
.gl-sheet header span { color: rgba(255, 255, 255, .85); }
.gl-sheet header .icon-btn { color: #fff; background: rgba(255, 255, 255, .16); border-color: transparent; }
.gl-sheet header .icon-btn:hover { background: rgba(255, 255, 255, .3); }
.gl-sheet ol { padding: 8px; }
.gl-item { border-left: 3px solid transparent; border-radius: 10px; transition: background .15s, border-color .15s, transform .15s; }
.gl-item b { display: inline-grid; place-items: center; min-width: 62px; height: 22px; padding: 0 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--c); font: 700 11.5px var(--sans); }
.gl-item:hover, .gl-item.cur { border-left-color: var(--c); background: color-mix(in srgb, var(--c) 7%, var(--surface)); transform: translateX(2px); }
.gl-item.cur b { background: linear-gradient(135deg, var(--c), var(--c2)); color: #fff; }
.pv-open span { color: var(--c); }
@media (prefers-reduced-motion: reduce) { .gl-bar::before { animation: none; } .gl-tab:hover:not(:disabled) { transform: none; } }

/* ---------- "Back to result" after following a link ---------- */
.tool-btn.back-res { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--accent); animation: rise .2s ease-out; }
.tool-btn.back-res:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- "Judgment at a glance" inside the reading panel ---------- */
.gl-sec[hidden] { display: none; }
.gl-sec .gl-tabs { flex-wrap: wrap; overflow: visible; padding: 0; gap: 6px; }
.gl-sec .gl-title { flex-basis: 100%; margin: 4px 0 0; font-size: 10px; }
.gl-sec .gl-title:first-child { margin-top: 0; }
.gl-sec .gl-sep { display: none; }
.gl-sec .gl-tab { font-size: 11.5px; padding: 3px 6px 3px 3px; gap: 6px; }
.gl-sec .gl-tab .gl-ico { width: 22px; height: 22px; }
.gl-sec .gl-tab:hover:not(:disabled) { transform: translateY(-1px); }
.gl-sec .gl-sheet { position: static; flex-basis: 100%; width: 100%; max-height: 380px; margin: 2px 0 4px; border-radius: 12px; animation: gl-drop .2s ease-out; }
@keyframes gl-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.gl-sec .gl-sheet header { padding: 8px 8px 8px 10px; gap: 7px; }
.gl-sec .gl-sheet header .gl-ico { width: 24px; height: 24px; }
.gl-sec .gl-sheet header b { font-size: 12px; }
.gl-sec .gl-sheet header span { font-size: 11px; }
.gl-sec .gl-sheet header .icon-btn { width: 26px; height: 26px; }
.gl-sec .gl-sheet ol { padding: 6px; }
.gl-sec .gl-item { flex-direction: column; gap: 4px; padding: 7px 8px; font-size: 12.5px; line-height: 1.45; }
.gl-sec .gl-item b { align-self: flex-start; min-width: 0; height: 20px; font-size: 11px; }
.gl-sec .pv-item { padding: 7px 6px; }
.gl-sec .pv-open b { font-size: 12.5px; }

/* ---------- overruled judgment: red theme, warning strip and pop-up ---------- */
.drawer.is-overruled { box-shadow: inset 0 0 0 3px #dc2626; }
.drawer.is-overruled .d-head { background: linear-gradient(180deg, color-mix(in srgb, #dc2626 10%, var(--surface)), var(--surface)); border-bottom-color: color-mix(in srgb, #dc2626 35%, var(--line)); }
.drawer.is-overruled #dTitle { color: #b91c1c; text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, .45); text-decoration-thickness: 2px; }
.drawer.is-overruled #dTitle::before { content: "OVERRULED"; display: inline-block; margin-right: 10px; padding: 2px 9px; border-radius: 6px; background: #dc2626; color: #fff;
  font: 800 11px/1.6 var(--sans); letter-spacing: .1em; vertical-align: middle; text-decoration: none; }
.drawer.is-overruled .d-tools { background: color-mix(in srgb, #dc2626 5%, var(--surface)); }
.ov-banner { display: flex; align-items: center; gap: 10px; flex: none; padding: 9px 16px; background: linear-gradient(90deg, #b91c1c, #dc2626 55%, #ef4444); color: #fff;
  font: 500 13px/1.45 var(--sans); box-shadow: 0 4px 12px rgba(185, 28, 28, .25); animation: ov-pulse 2.4s ease-in-out 3; }
.ov-banner[hidden] { display: none; }
.ov-banner svg { width: 20px; height: 20px; flex: none; fill: none; stroke: #fff; stroke-width: 2; }
.ov-banner span { flex: 1; }
.ov-banner b { font-weight: 700; }
.ov-banner span span { opacity: .85; }
.ov-go { flex: none; padding: 5px 11px; border: 1px solid rgba(255, 255, 255, .6); border-radius: 8px; background: rgba(255, 255, 255, .15); color: #fff; font: 600 12px var(--sans); cursor: pointer; }
.ov-go:hover { background: #fff; color: #b91c1c; }
@keyframes ov-pulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.15); } }
.ov-modal { position: absolute; inset: 0; z-index: 46; display: grid; place-items: center; padding: 16px; background: rgba(60, 8, 8, .55); backdrop-filter: blur(2px); animation: fade .2s; }
.ov-modal[hidden] { display: none; }
.ov-card { width: min(460px, 100%); padding: 24px 22px 20px; border-radius: 18px; background: var(--surface); text-align: center; border-top: 6px solid #dc2626;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); animation: pop .25s cubic-bezier(.2, .8, .2, 1); }
.ov-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 50%; background: color-mix(in srgb, #dc2626 14%, var(--surface)); animation: ov-shake .6s ease-in-out 1 .2s; }
.ov-icon svg { width: 30px; height: 30px; fill: none; stroke: #dc2626; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
@keyframes ov-shake { 0%, 100% { transform: none; } 20%, 60% { transform: rotate(-8deg); } 40%, 80% { transform: rotate(8deg); } }
.ov-card h3 { margin: 0 0 6px; font: 700 19px var(--serif); color: #b91c1c; }
.ov-text { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.ov-text b { color: #b91c1c; }
.ov-by { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #dc2626 7%, var(--surface-2)); font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.ov-by:empty { display: none; }
.ov-by small { display: block; margin-bottom: 2px; font: 700 10.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ov-by span { color: var(--muted); }
.ov-actions { display: flex; flex-direction: column; gap: 8px; }
.ov-actions .btn { justify-content: center; }
.ov-open { background: #dc2626; color: #fff; border-color: #dc2626; }
.ov-open:hover { background: #b91c1c; }
@media (prefers-reduced-motion: reduce) { .ov-banner, .ov-icon { animation: none; } }

/* referred cases that link straight to their judgment */
.c-link { margin-left: 5px; font-style: normal; font-size: .85em; color: var(--accent); }

/* ---------- reading aids switches ---------- */
.aid-list { display: flex; flex-direction: column; gap: 2px; }
.aid { display: flex; align-items: flex-start; gap: 9px; padding: 5px 4px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.aid:hover { background: var(--surface); }
.aid input { position: absolute; opacity: 0; pointer-events: none; }
.aid i { position: relative; flex: none; width: 28px; height: 16px; margin-top: 1px; border-radius: 999px; background: var(--line); transition: background .2s; }
.aid i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .2s; }
.aid input:checked + i { background: var(--brass); }
.aid input:checked + i::after { transform: translateX(12px); }
.aid input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.aid span { display: flex; flex-direction: column; line-height: 1.35; }
.aid small { font-size: 11px; color: var(--muted); }

/* ---------- a cited or linked judgment that is not in the library ---------- */
.doc-missing { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 420px; padding: 26px 24px; border-radius: 16px; background: var(--surface); text-align: center; box-shadow: var(--shadow-lg); border-top: 5px solid var(--brass); animation: pop .25s cubic-bezier(.2, .8, .2, 1); }
.doc-missing svg { width: 42px; height: 42px; fill: none; stroke: var(--brass); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.doc-missing b { font: 600 17px var(--serif); color: var(--ink); }
.doc-missing p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.doc-missing div { display: flex; gap: 8px; }


/* ---------- search: history, more options ---------- */
.searchbar { position: relative; }
.q-hist { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); animation: dd-in .14s ease-out; }
.q-hist[hidden] { display: none; }
.qh-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 6px; font: 700 11px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.qh-head button { border: 0; background: none; color: var(--accent); font: 600 12px var(--sans); cursor: pointer; text-transform: none; letter-spacing: 0; }
.qh-row { display: flex; align-items: center; border-radius: 9px; }
.qh-row:hover { background: var(--surface-2); }
.qh-go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 8px; border: 0; background: none; text-align: left; font: 14px var(--sans); color: var(--ink); cursor: pointer; }
.qh-go svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; }
.qh-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qh-x { padding: 4px 10px; border: 0; background: none; font-size: 17px; color: var(--muted); cursor: pointer; }
.qh-x:hover { color: #b42318; }
.adv-wrap { margin-top: 8px; }

.adv-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 12.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.adv-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.adv-toggle:hover, .adv-toggle.on { border-color: var(--accent); color: var(--accent); }
.adv-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); animation: dd-in .14s ease-out; }
.adv-box[hidden] { display: none; }
.adv-box label { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-width: 0; font: 600 12px var(--sans); color: var(--ink-2); }
.adv-box label > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adv-box small { font-weight: 400; color: var(--muted); }
.adv-box input { width: 100%; box-sizing: border-box; height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); font: 14px var(--sans); }
.adv-box input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
@media (max-width: 760px) { .adv-box { grid-template-columns: 1fr; } }

/* ---------- refine with counts ---------- */
.facets { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.facets[hidden] { display: none; }
.facets-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; font: 600 13.5px var(--sans); color: var(--ink); cursor: pointer; }
.facets-toggle svg { width: 17px; height: 17px; fill: none; stroke: var(--brass); stroke-width: 2; }
.facets-toggle small { font-weight: 400; color: var(--muted); }
.facets-toggle.on, .facets-toggle:hover { background: var(--surface-2); }
.facets-body { padding: 4px 14px 12px; border-top: 1px solid var(--line); }
.fc-group { margin-top: 10px; }
.fc-group h5 { margin: 0 0 6px; font: 700 11px var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 12.5px var(--sans); color: var(--ink-2); cursor: pointer; }
.fc-chip small { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-weight: 700; text-align: center; }
.fc-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.fc-chip:disabled, .fc-year:disabled { opacity: .4; cursor: default; }
.fc-years { display: flex; align-items: flex-end; gap: 6px; height: 128px; padding-top: 4px; }
.fc-year { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; padding: 0; border: 0; background: none; cursor: pointer; }
.fc-year small { font: 600 10.5px var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-bar { display: block; width: 100%; max-width: 38px; height: var(--h); min-height: 2px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #a78bfa, #7c3aed); transition: height .4s cubic-bezier(.2, .8, .2, 1), filter .15s; }
.fc-year:hover:not(:disabled) .fc-bar { filter: brightness(1.15); }
.fc-year em { font: 600 11px var(--sans); font-style: normal; color: var(--ink-2); }
.fc-wait { display: inline-block; width: 18px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--line), var(--surface-2), var(--line)); background-size: 200% 100%; animation: fc-shimmer 1s linear infinite; vertical-align: middle; }
@keyframes fc-shimmer { to { background-position: -200% 0; } }
.fc-note { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }
.fc-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fc-range h5 { width: 100%; }
.fc-range input { width: 96px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); font: 14px var(--sans); }
.fc-range span { font-size: 12.5px; color: var(--muted); }

/* the AI "Meaning" of a headnote statute, in Arial */
.hs-answer, .hs-answer * { font-family: Arial, Helvetica, sans-serif !important; }

/* "Judgment at a glance" lists, in Arial */
.gl-sheet, .gl-sheet * { font-family: Arial, Helvetica, sans-serif !important; }

/* key for "Colour by part" */
.aid-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: -2px 0 6px 41px; font-size: 11px; color: var(--ink-2); }
.aid-legend span { display: inline-flex; align-items: center; gap: 5px; }
.aid-legend span::before { content: ""; width: 14px; height: 3px; border-radius: 2px; background: var(--pc); }

/* ---------- your rating, star and note ---------- */
.d-mine { display: flex; align-items: center; gap: 4px; }
.rate { display: inline-flex; padding: 2px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.rate button { padding: 0 2px; border: 0; background: none; font-size: 19px; line-height: 1.2; color: color-mix(in srgb, var(--muted) 45%, transparent); cursor: pointer; transition: color .12s, transform .12s; }
.rate button.on { color: #f59e0b; }
.rate:hover button { color: #fbbf24; }
.rate button:hover ~ button { color: color-mix(in srgb, var(--muted) 45%, transparent); }
.rate button:hover { transform: scale(1.18); }
.star-btn svg { fill: none; transition: fill .15s, color .15s; }
.star-btn.on { color: #f59e0b; border-color: #f59e0b; }
.star-btn.on svg { fill: #f59e0b; stroke: #f59e0b; }
@media (max-width: 700px) { .rate button { font-size: 16px; } }
.my-badges { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.my-star { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, #f59e0b 16%, transparent); color: #b45309; font: 700 10.5px var(--sans); letter-spacing: .03em; }
.my-rate { font-size: 13px; letter-spacing: 1px; color: #f59e0b; }
.my-rate i { font-style: normal; color: color-mix(in srgb, var(--muted) 40%, transparent); }
.star-body { padding: 0 6px 10px; }
.star-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.star-list li { display: flex; align-items: flex-start; gap: 4px; }
.st-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; cursor: pointer; }
.st-open:hover { border-color: #f59e0b; }
.st-open .r-title { font-size: 12.5px; font-weight: 600; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-open .r-meta { font-size: 11px; color: var(--muted); }
.st-x { padding: 4px 6px; border: 0; background: none; font-size: 16px; line-height: 1; color: var(--muted); cursor: pointer; }
.st-x:hover { color: #b42318; }
.side-badge { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, #f59e0b 18%, var(--surface-2)); color: #b45309; font: 700 11px var(--sans); text-align: center; }
.side-sec summary .side-badge + .chev { margin-left: 6px; }

/* ---------- "Load more" ---------- */

/* bare Act text in "Statutes in the headnote" */
.hs-bare { white-space: pre-line; font: 12.5px/1.5 Arial, Helvetica, sans-serif; color: var(--ink); }
.hs-barenote { display: block; margin-top: 6px; font: 11px var(--sans); color: var(--muted); }


/* AI Assistant button in the judgment toolbar */
.ai-bar-btn { color: #7c4dcc; border-color: color-mix(in srgb, #7c4dcc 35%, var(--line)); }
.ai-bar-btn svg { fill: currentColor; stroke: none; }
.ai-bar-btn:hover { background: color-mix(in srgb, #7c4dcc 10%, var(--surface)); }
.ai-bar-btn.active { background: #7c4dcc; border-color: #7c4dcc; color: #fff; }

/* "Please wait" card */
.wait-pop { position: fixed; inset: 0; z-index: 58; display: grid; place-items: center; padding: 16px; background: rgba(8, 11, 18, .35); animation: fade .15s; }
.wait-pop[hidden] { display: none; }
.wait-card { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 260px; max-width: 420px; padding: 22px 26px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; }
.wait-card b { font: 600 17px var(--serif); color: var(--ink); }
.wait-card > span:last-child { font-size: 13px; color: var(--muted); }
.wait-card .spinner { width: 26px; height: 26px; border-width: 3px; color: var(--accent); }

.fc-chip { padding: 5px 12px; }
.fc-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }

/* ---------- paragraph numbers down the right of the judgment, next to the AI Assistant ---------- */
.para-rail { position: absolute; z-index: 4; right: 0; top: 0; bottom: 0; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 24px; overflow-y: auto; scrollbar-width: thin; background: var(--surface-2); border-left: 1px solid var(--line); }
.para-rail[hidden] { display: none; }
.para-rail small { flex: none; margin-bottom: 2px; font: 700 9.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.para-rail button { flex: none; width: 38px; min-height: 26px; padding: 2px 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font: 600 12px var(--sans); color: var(--ink-2); cursor: pointer; font-variant-numeric: tabular-nums; transition: background .12s, color .12s, border-color .12s; }
.para-rail button:hover { border-color: var(--accent); color: var(--accent); }
.para-rail button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.pane-main.has-rail iframe { margin-right: 52px; width: calc(100% - 52px); }
.d-body.split .pane-main.has-rail .para-rail { top: 29px; } /* below the "pane label" in side by side */
@media (max-width: 600px) {
  .para-rail { width: 40px; }
  .para-rail button { width: 32px; font-size: 11px; }
  .pane-main.has-rail iframe { margin-right: 40px; width: calc(100% - 40px); }
}
/* the AI Assistant tab sits just left of the paragraph numbers */
.d-main:has(.pane-main.has-rail) .ai-handle { margin-right: 58px; }
@media (max-width: 600px) { .d-main:has(.pane-main.has-rail) .ai-handle { margin-right: 44px; } }

/* ---------- Top / Bottom buttons while scrolling the judgment ---------- */
.top-down { position: absolute; z-index: 6; right: 30px; bottom: 22px; display: flex; flex-direction: column; gap: 6px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.top-down[hidden] { display: none; }
.top-down.on { opacity: 1; transform: none; pointer-events: auto; }
.top-down button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 9px; border: 1px solid #1d4ed8; border-radius: 999px; background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 8px 18px -8px rgba(29, 78, 216, .75); font: 700 12.5px var(--sans); color: #fff; cursor: pointer; }
.top-down button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.top-down button:hover:not(:disabled) { background: linear-gradient(135deg, #1d4ed8, #1e40af); color: #fff; transform: translateY(-1px); }
.top-down button:disabled { opacity: .4; cursor: default; box-shadow: none; }
.pane-main.has-rail .top-down { right: 82px; } /* clear of the paragraph numbers */
@media (max-width: 600px) { .top-down { right: 14px; bottom: 14px; } .pane-main.has-rail .top-down { right: 54px; } .top-down button span { display: none; } .top-down button { padding: 8px; } }

.wait-card { position: relative; overflow: hidden; animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
.wait-card b { animation: wait-pulse 1.4s ease-in-out infinite; }
.wait-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--accent) 18%, transparent); overflow: hidden; }
.wait-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--accent); border-radius: 3px; animation: wait-slide 1.1s ease-in-out infinite; }
@keyframes wait-slide { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes wait-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- text settings (Aa) ---------- */
.ts-wrap { position: relative; display: inline-flex; }
.ts-btn { gap: 2px; }
.ts-btn svg { width: 12px; height: 12px; }
.ts-pop { width: 300px; left: auto; right: auto; }
.ts-row { display: flex; flex-direction: column; gap: 5px; margin: 0 0 10px; }
.ts-row > span { font: 600 11.5px var(--sans); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.ts-seg { display: flex; gap: 4px; }
.ts-seg button { flex: 1; padding: 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; color: var(--ink); cursor: pointer; }
.ts-seg button:hover { border-color: var(--accent); }
.ts-seg button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.ts-reset { width: 100%; padding: 6px; border: 1px dashed var(--line); border-radius: 8px; background: none; font: 600 12px var(--sans); color: var(--muted); cursor: pointer; }
.ts-reset:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- "You are here" bar ---------- */
.here-bar { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 5px 16px; font: 600 12.5px var(--sans); color: var(--ink); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); opacity: 0; transform: translateY(-100%); pointer-events: none; transition: opacity .2s, transform .2s; }
.here-bar.on { opacity: 1; transform: none; }
.pane-main.has-rail .here-bar { right: 52px; }
.here-bar b { color: var(--accent); }
.here-bar .hb-sep { color: var(--muted); }
.hb-part { padding: 1px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.hb-head { color: #1d4ed8; }
.hb-facts { color: #0e7490; } .hb-issues { color: #b45309; } .hb-pet { color: #7c3aed; } .hb-resp { color: #be185d; }
.hb-law { color: #1d4ed8; } .hb-reason { color: #047857; } .hb-order { color: #b91c1c; }
@media (max-width: 600px) { .pane-main.has-rail .here-bar { right: 40px; } }

/* Previous / Next: busy until the judgment opens */
#dPrev.busy, #dNext.busy { position: relative; color: transparent !important; pointer-events: none; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
#dPrev.busy svg, #dNext.busy svg { opacity: 0; }
#dPrev.busy::after, #dNext.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 15px; height: 15px; margin: -9.5px 0 0 -9.5px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.drawer.stepping #dPrev:not(.busy), .drawer.stepping #dNext:not(.busy) { opacity: .45; pointer-events: none; }

/* ---------- section / rule panel, docked on the left of the judgment ---------- */
.sec-panel { position: absolute; z-index: 7; left: 12px; top: 40px; width: min(360px, calc(100% - 90px)); max-height: calc(100% - 56px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid color-mix(in srgb, #7c3aed 35%, var(--line)); border-left: 4px solid #7c3aed; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
.sec-panel[hidden] { display: none; }
.sp-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, #7c3aed 6%, var(--surface)); }
.sp-head > div { flex: 1; min-width: 0; }
.sp-head b { display: block; font: 700 15px var(--sans); color: #6d28d9; }
.sp-head span { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-2); }
.sp-eq { display: flex; flex-direction: column; gap: 3px; padding: 8px 14px; border-bottom: 1px dashed var(--line); font: 600 13px var(--sans); }
.sp-eq small { display: inline-block; min-width: 58px; font: 700 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #7c3aed; }
.sp-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px; }
.sp-label { display: block; margin-bottom: 4px; font: 700 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sp-bare { white-space: pre-line; font: 13px/1.5 Tahoma, Verdana, sans-serif; color: var(--ink); }
.sp-note { display: block; margin-top: 8px; font-size: 11px; color: var(--muted); }
.sp-search { margin: 0 12px 12px; justify-content: center; background: #7c3aed; color: #fff; border-color: #7c3aed; }
.sp-search svg { width: 16px; height: 16px; }
.sp-search:hover { background: #6d28d9; }
@media (max-width: 600px) { .sec-panel { left: 8px; right: 48px; width: auto; top: 36px; } }

/* ---------- "Searching database…" and "N judgments found" cards ---------- */
.search-card { justify-content: flex-start; padding: 16px 20px; border-style: solid; border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface)); box-shadow: var(--shadow); }
.sc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-text b { font: 600 17px var(--serif); color: var(--ink); }
.sc-text small { font: 13px var(--sans); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.found-card { list-style: none; display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 16px; border: 1px solid color-mix(in srgb, #15803d 35%, var(--line)); border-left: 4px solid #15803d; border-radius: var(--radius); background: color-mix(in srgb, #15803d 6%, var(--surface)); box-shadow: var(--shadow); animation: rise .3s ease-out; }
.found-card svg { flex: none; width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: #15803d; color: #fff; fill: none; stroke: currentColor; stroke-width: 3; }
.found-card span { min-width: 0; font: 15px var(--sans); color: var(--ink); }
.found-card b { font: 700 18px var(--sans); color: #15803d; }
.found-card small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list.compact .found-card { border-radius: 0; margin: 0; }
.sc-text small em, .found-card small em { font-style: normal; font-weight: 600; color: var(--ink-2); padding: 0 6px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* Clear, next to Search */
.searchbar .clear-btn { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; }
.searchbar .clear-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
/* Bare Acts, at the top of the left panel on the home page */
.side-acts { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; padding: 12px 12px; border: 1px solid color-mix(in srgb, var(--brass) 40%, transparent); border-radius: 14px; background: var(--brass-soft); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.side-acts:hover { border-color: var(--brass); transform: translateY(-1px); box-shadow: var(--shadow); }
.side-acts .sa-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #1f3a5f; }
.side-acts .sa-ic svg { width: 21px; height: 21px; fill: none; stroke: #e9c98b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-acts .sa-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-acts b { font: 700 15.5px var(--serif); }
.side-acts small { font-size: 12px; color: var(--muted); }
.side-acts .chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }

/* "Adding links & paragraph numbers…" while a long judgment's extras are added */
.enh-pill { position: absolute; z-index: 6; left: 50%; bottom: 18px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-lg); font: 600 12.5px var(--sans); color: var(--ink-2); pointer-events: none; animation: rise .2s ease-out; }
.enh-pill[hidden] { display: none; }
.enh-pill .spinner { width: 14px; height: 14px; color: var(--accent); }
.search-modes[hidden] { display: none !important; }

/* Keyword / Case Name / Full Text Search: a row of chips under the search bar (scrolls sideways on a phone) */
.search-type { display: flex; align-items: center; gap: 6px 12px; margin: 10px 0 0; min-width: 0; }
.st-seg { display: flex; gap: 8px; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding: 2px; }
.st-seg::-webkit-scrollbar { display: none; }
.st-seg label { position: relative; flex: none; cursor: pointer; scroll-snap-align: start; }
.st-seg input { position: absolute; opacity: 0; pointer-events: none; }
.st-seg span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 13px var(--sans); color: var(--ink-2); white-space: nowrap; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: background .2s, color .2s, border-color .2s, box-shadow .2s, transform .15s; }
.st-seg span svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.st-seg label:hover span { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--ink); }
.st-seg input:checked + span { color: #fff; border-color: var(--accent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent)); box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 32%, transparent); }
.st-seg input:checked + span svg { opacity: 1; }
.st-seg input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.st-seg label:active span { transform: scale(.97); }
.st-hint { flex: none; font: italic 12.5px var(--serif); color: var(--muted); }
.search-type:has(input[value="keyword"]:checked) .st-hint::before { content: "→ " attr(data-hint-keyword); }
.search-type:has(input[value="casename"]:checked) .st-hint::before { content: "→ " attr(data-hint-casename); }
.search-type:has(input[value="fulltext"]:checked) .st-hint::before { content: "→ " attr(data-hint-fulltext); }
@media (max-width: 640px) { .st-seg span { padding: 6px 12px 6px 10px; font-size: 12.5px; } .st-hint { display: none; } }
.c-title .c-vs { text-transform: none; font-weight: 500; font-style: italic; font-size: .82em; color: var(--muted); }

/* ---------- Previous / Next: a small light-blue card at the top-left of the judgment ---------- */
.doc-nav { position: absolute; z-index: 6; top: 8px; left: 12px; display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 4px 5px 4px 9px; border: 1px solid #93c5fd; border-left: 3px solid #2563eb; border-radius: 11px; background: linear-gradient(150deg, #dbeafe, #eff6ff 85%); box-shadow: 0 6px 16px rgba(37, 99, 235, .18); transition: top .2s; }
.here-bar.on ~ .doc-nav { top: 40px; }
.dn-pos { padding: 0; font: 700 9.5px var(--sans); white-space: nowrap; letter-spacing: .08em; text-transform: uppercase; color: #1d4ed8; }
.dn-pos[hidden] { display: none; }
.dn-row { display: flex; gap: 5px; }
.dn-btn { position: relative; display: inline-flex; align-items: center; gap: 3px; padding: 3px 10px 3px 7px; border: 1px solid #93c5fd; border-radius: 999px; background: #fff; font: 600 12px var(--sans); color: #1e3a8a; cursor: pointer; box-shadow: 0 1px 2px rgba(30, 58, 138, .08); transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.dn-btn#dNext { padding: 3px 7px 3px 10px; }
.dn-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.3; }
.dn-btn:hover:not(:disabled) { border-color: #2563eb; color: #fff; background: #2563eb; box-shadow: 0 3px 10px rgba(37, 99, 235, .3); }
.dn-btn:disabled { opacity: .45; cursor: default; }
.dn-btn.dn-back { border-color: #60a5fa; color: #1d4ed8; background: #eff6ff; }
.dn-btn[hidden] { display: none; }
#dPrev.busy, #dNext.busy { background: #eff6ff; border-color: #2563eb; }
#dPrev.busy::after, #dNext.busy::after { border-color: #2563eb; border-right-color: transparent; }
@media (max-width: 900px) {
  .doc-nav { top: 6px; left: 6px; padding: 4px 5px 5px; border-radius: 10px; }
  .dn-pos { display: none; }
  .dn-btn span { display: none; }
  .dn-btn, .dn-btn#dNext { padding: 5px 7px; }
}
/* while reading, the card shrinks to its two arrows (hover or go back to the top for the full card) */
.doc-nav.dn-mini:not(:hover) { padding: 3px; gap: 0; opacity: .88; }
.doc-nav.dn-mini:not(:hover) .dn-pos, .doc-nav.dn-mini:not(:hover) .dn-btn span { display: none; }
.doc-nav.dn-mini:not(:hover) .dn-btn, .doc-nav.dn-mini:not(:hover) .dn-btn#dNext { padding: 5px 7px; }

/* ---------- Digest under "Statutes in the headnote" (no AI) ---------- */
.hs-dg { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid #93c5fd; border-radius: 999px; background: #eff6ff; font: 600 12.5px var(--sans); color: #1d4ed8; cursor: pointer; }
.hs-dg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.hs-dg:hover, .hs-dg[aria-expanded="true"] { background: #2563eb; border-color: #2563eb; color: #fff; }
.hs-digest-out { margin-top: 8px; }
.dg-head { margin: 0 0 6px; font: 700 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #1d4ed8; }
.dg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dg-list button { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border: 1px solid var(--line); border-left: 3px solid #60a5fa; border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; }
.dg-list button:hover { border-color: #2563eb; background: color-mix(in srgb, #2563eb 5%, var(--surface)); }
.dg-name { font: 700 12px/1.35 var(--serif); color: var(--ink); }
.dg-name .c-vs { font-style: italic; font-weight: 500; color: var(--muted); }
.dg-meta { font-size: 11px; color: var(--muted); }
.dg-snip { font-size: 11.5px; line-height: 1.4; color: var(--ink-2); }
.dg-all { margin-top: 8px; width: 100%; padding: 6px; border: 1px dashed #60a5fa; border-radius: 8px; background: none; font: 600 12px var(--sans); color: #1d4ed8; cursor: pointer; }
.dg-all:hover { background: #eff6ff; }
.dg-wait, .dg-none { margin: 4px 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dg-short .dg-more { display: none; }
.dg-toggle { margin-top: 6px; width: 100%; padding: 6px; border: 1px solid #93c5fd; border-radius: 8px; background: #eff6ff; font: 600 12px var(--sans); color: #1d4ed8; cursor: pointer; }
.dg-toggle:hover { background: #2563eb; border-color: #2563eb; color: #fff; }

/* Back, at the top right of the judgment */
.back-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 11px; border: 1px solid #93c5fd; border-radius: 999px; background: linear-gradient(150deg, #dbeafe, #eff6ff); font: 600 13.5px var(--sans); color: #1e3a8a; cursor: pointer; box-shadow: 0 2px 6px rgba(37, 99, 235, .12); transition: background .15s, color .15s, border-color .15s, box-shadow .15s; }
.back-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.back-btn:hover { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }
@media (max-width: 600px) { .back-btn svg { display: none; } .back-btn span { display: inline; } .back-btn { padding: 0 12px; } } /* phones: the word "Back" instead of the arrow */

/* ---------- Back: "Want to clear the recent search?" ---------- */
.ask-box { width: min(360px, calc(100vw - 32px)); padding: 18px 18px 14px; border: 1px solid #93c5fd; border-top: 4px solid #2563eb; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 50px rgba(15, 23, 42, .28); font-family: var(--sans); }
.ask-box::backdrop { background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }
.ask-box[open] { animation: askIn .16s ease-out; }
@keyframes askIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.ask-t { margin: 0 0 6px; font: 700 15.5px var(--sans); color: #1e3a8a; }
.ask-s { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ask-btns { display: flex; justify-content: flex-end; gap: 8px; }
.ask-btns button { padding: 7px 16px; border-radius: 999px; font: 600 13px var(--sans); cursor: pointer; }
.ask-no { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.ask-no:hover { border-color: #93c5fd; background: #eff6ff; }
.ask-yes { border: 1px solid #2563eb; background: #2563eb; color: #fff; }
.ask-yes:hover { background: #1d4ed8; }

/* ---------- Where cited ---------- */
.cited-pop { width: min(520px, calc(100vw - 48px)); max-height: 460px; }
.cited-pop .cases-head small { margin-left: 6px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.ct-courts { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 2px 8px; }
.cases-pop .ct-court { display: inline-block; width: auto; padding: 3px 10px; border: 1px solid #93c5fd; border-radius: 999px; background: #eff6ff; font: 600 11.5px var(--sans); color: #1d4ed8; }
.cases-pop .ct-court[aria-pressed="true"] { background: #2563eb; border-color: #2563eb; color: #fff; }
.ct-item + .ct-item { border-top: 1px solid var(--line); }
.ct-how { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--ink-2); }
.ct-wait { color: var(--muted); align-items: center; }
.ct-text { flex: 1 1 100%; padding: 5px 8px; border-left: 3px solid #93c5fd; border-radius: 0 6px 6px 0; background: color-mix(in srgb, #2563eb 5%, var(--surface)); font: 12.5px/1.45 "Times New Roman", Times, serif; color: var(--ink); }
.ct-tag { padding: 1px 8px; border-radius: 999px; font: 700 10.5px var(--sans); letter-spacing: .03em; text-transform: uppercase; }
.ct-pos { background: #dcfce7; color: #166534; }
.ct-neg { background: #fee2e2; color: #b91c1c; }
.ct-dist { background: #fef3c7; color: #92400e; }
.ct-ref { background: #e0e7ff; color: #3730a3; }
.cases-pop .ct-more { margin-top: 6px; display: block; text-align: center; border: 1px dashed #60a5fa; color: #1d4ed8; font: 600 12px var(--sans); }
.ct-text mark { padding: 0 2px; border-radius: 3px; background: #fde68a; color: inherit; font-weight: 700; }

/* "Cited in" while the library is being searched */
#tCited.ct-loading { opacity: 1; cursor: progress; border-color: #93c5fd; background: linear-gradient(90deg, #eff6ff 0%, #dbeafe 50%, #eff6ff 100%); background-size: 200% 100%; animation: ctShimmer 1.4s linear infinite; color: #1d4ed8; }
#tCited.ct-loading .pill { display: inline-grid; place-items: center; min-width: 20px; background: transparent; }
.ct-spin { width: 13px; height: 13px; border: 2px solid #93c5fd; border-top-color: #1d4ed8; border-radius: 50%; animation: ctSpin .7s linear infinite; }
@keyframes ctSpin { to { transform: rotate(360deg); } }
@keyframes ctShimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { #tCited.ct-loading, .ct-spin { animation-duration: 2.5s; } }

/* ---------- History (side panel) ---------- */
.hist-tabs { display: flex; gap: 4px; margin: 0 0 8px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.hist-tab { flex: 1; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; font: 600 12px var(--sans); color: var(--muted); cursor: pointer; }
.hist-tab[aria-selected="true"] { background: var(--surface); color: #1d4ed8; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.r-when { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.r-read { position: relative; overflow: hidden; padding: 0 7px; border-radius: 999px; background: linear-gradient(90deg, #bfdbfe var(--p), #eff6ff var(--p)); color: #1e3a8a; font-style: normal; font-weight: 600; }
.recent-list .hs-row { display: flex; align-items: stretch; }
.recent-list .hs-row > button:first-child { flex: 1; min-width: 0; }
.hs-x { flex: none; width: 28px; border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; border-radius: 8px; }
.hs-x:hover { color: #b91c1c; background: #fee2e2; }
.recent-list .r-title .c-vs { text-transform: none; font-style: italic; font-weight: 500; }

/* ---------- Similar judgments ---------- */
.sim-why { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.sim-why b { padding: 1px 7px; border-radius: 999px; background: #eef2ff; color: #3730a3; font: 600 10.5px var(--sans); }

/* ---------- Overruled? (found in later judgments) ---------- */
.ov-banner.ov-later { background: linear-gradient(90deg, #9a3412, #c2410c 55%, #ea580c); font-size: 13px; line-height: 1.4; }
.ov-banner.ov-later q { font-family: "Times New Roman", Times, serif; font-style: italic; }
.ov-banner.ov-later q::before { content: "“"; } .ov-banner.ov-later q::after { content: "”"; }
.ov-banner.ov-later .c-vs { text-transform: none; font-style: italic; }
.cases-pop .ct-more small { font-weight: 500; color: var(--muted); }
.cases-pop .ct-more[disabled] { cursor: progress; opacity: .8; }

/* ---------- Judgment Analysis (centre of the screen) ---------- */
.tool-btn.an-btn { border-color: #93c5fd; background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #1d4ed8; font-weight: 700; }
.tool-btn.an-btn:hover:not(:disabled) { background: #2563eb; border-color: #2563eb; color: #fff; }
.an-box { width: min(860px, calc(100vw - 32px)); max-height: min(86vh, 900px); padding: 0; border: 1px solid #93c5fd; border-top: 4px solid #2563eb; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(15, 23, 42, .35); overflow: hidden; }
.an-box[open] { display: flex; flex-direction: column; animation: askIn .18s ease-out; }
.an-box::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.an-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px 8px; }
.an-head h2 { margin: 0; font: 700 18px var(--sans); color: #1e3a8a; }
.an-sub { margin: 3px 0 0; font: 600 13px var(--serif); color: var(--ink-2); }
.an-sub .c-vs { text-transform: none; font-style: italic; font-weight: 500; }
.an-close { flex: none; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.an-close:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.an-tabs { display: flex; gap: 6px; padding: 0 18px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.an-tabs button { flex: none; padding: 7px 14px; border: 1px solid #bfdbfe; border-radius: 999px; background: #eff6ff; font: 600 12.5px var(--sans); color: #1d4ed8; cursor: pointer; }
.an-tabs button[aria-selected="true"] { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 3px 10px rgba(37, 99, 235, .3); }
.an-body { flex: 1; overflow: auto; padding: 14px 18px; font: 14.5px/1.55 "Times New Roman", Times, serif; }
.an-foot { margin: 0; padding: 8px 18px; border-top: 1px solid var(--line); font: 11.5px var(--sans); color: var(--muted); }
.an-list, .an-qa { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.an-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; padding: 9px 12px; border: 1px solid var(--line); border-left: 4px solid #60a5fa; border-radius: 10px; background: color-mix(in srgb, #2563eb 3%, var(--surface)); }
.an-list li > span { flex: 1 1 420px; }
.an-para { flex: none; padding: 1px 9px; border: 1px solid #c4b5fd; border-radius: 999px; background: #f5f3ff; font: 700 11px var(--sans); color: #6d28d9; cursor: pointer; }
.an-para:hover { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.an-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid #86efac; border-left: 5px solid #16a34a; border-radius: 10px; background: #f0fdf4; }
.an-result b, .an-q b, .an-a b, .an-tag { flex: none; padding: 1px 8px; border-radius: 999px; font: 700 10.5px var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.an-result b { background: #16a34a; color: #fff; }
.an-result span { flex: 1 1 400px; font-weight: 700; }
.an-qa > li { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.an-q, .an-a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; padding: 9px 12px; }
.an-q { background: #fffbeb; border-bottom: 1px dashed #fcd34d; }
.an-q b { background: #f59e0b; color: #fff; }
.an-q span { flex: 1 1 400px; font-weight: 700; }
.an-a b { background: #2563eb; color: #fff; }
.an-a span { flex: 1 1 400px; }
.an-a.an-none span { color: var(--muted); font-style: italic; }
.an-note { margin: 4px 0 8px; font: 600 12px var(--sans); color: var(--muted); }
.an-ratio li { border-left-color: #1d4ed8; }
.an-ratio .an-tag { background: #1d4ed8; color: #fff; }
.an-obiter li { border-left-color: #a8a29e; }
.an-obiter .an-tag { background: #e7e5e4; color: #44403c; }
.an-bar { display: flex; height: 12px; margin: 2px 0 12px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.an-seg { display: block; }
.an-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 9px; }
.an-part { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-left: 5px solid var(--pc, #64748b); border-radius: 10px; background: var(--surface); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.an-part:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .12); }
.an-part b { font: 700 13px var(--sans); color: var(--pc, #334155); }
.an-part small { font: 11px var(--sans); color: var(--muted); }
.an-part span { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.an-facts { --pc: #0891b2; } .an-issues { --pc: #d97706; } .an-pet { --pc: #7c3aed; } .an-resp { --pc: #db2777; }
.an-law { --pc: #2563eb; } .an-reason { --pc: #16a34a; } .an-order { --pc: #b91c1c; }
.an-seg.an-facts { background: #0891b2; } .an-seg.an-issues { background: #d97706; } .an-seg.an-pet { background: #7c3aed; } .an-seg.an-resp { background: #db2777; }
.an-seg.an-law { background: #2563eb; } .an-seg.an-reason { background: #16a34a; } .an-seg.an-order { background: #b91c1c; }
@media (max-width: 640px) { .an-box { max-height: 92vh; } .an-body { padding: 12px; font-size: 14px; } }

.an-tabs[hidden], .tool-btn.an-btn[hidden] { display: none; }

/* ---------- Reading checklist ---------- */
.ck-types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ck-type { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 12px var(--sans); color: var(--muted); cursor: pointer; }
.ck-type.ck-found { border-color: #86efac; color: #166534; background: #f0fdf4; }
.ck-type small { margin-left: 3px; padding: 0 6px; border-radius: 999px; background: #16a34a; color: #fff; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
.ck-type[aria-pressed="true"] { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 3px 10px rgba(37, 99, 235, .3); }
.ck-score { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font: 13px var(--sans); color: var(--ink-2); }
.ck-score b { color: #166534; font-size: 15px; }
.ck-meter { flex: 1; max-width: 220px; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ck-meter i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); }
.ck-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.ck-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ck-icon { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 700 14px var(--sans); }
.ck-yes .ck-icon { background: #dcfce7; color: #166534; }
.ck-argued .ck-icon { background: #fef3c7; color: #92400e; }
.ck-no .ck-icon { background: #fee2e2; color: #b91c1c; }
.ck-yes { border-left: 4px solid #16a34a !important; } .ck-argued { border-left: 4px solid #f59e0b !important; } .ck-no { border-left: 4px solid #fca5a5 !important; opacity: .85; }
.ck-label { flex: 1; display: flex; flex-direction: column; font-family: var(--sans); }
.ck-label b { font-size: 13.5px; color: var(--ink); }
.ck-label small { font-size: 11px; color: var(--muted); }
.ck-paras { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }


/* Reading checklist in the reading panel */
.rs-ck h4 small { margin-left: 4px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.rs-ck-btn { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; padding: 10px 12px; border: 1px solid #86efac; border-left: 4px solid #16a34a; border-radius: 10px; background: linear-gradient(135deg, #f0fdf4, var(--surface)); text-align: left; cursor: pointer; transition: box-shadow .12s, transform .12s; }
.rs-ck-btn:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(22, 163, 74, .2); transform: translateY(-1px); }
.rs-ck-btn:disabled { opacity: .55; cursor: default; }
.rs-ck-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12.5px; color: var(--ink-2); }
.rs-ck-info b { color: #166534; }
.rs-ck-info .ck-meter { flex: 1 1 100%; max-width: none; height: 6px; }
.rs-ck-btn > b { display: inline-flex; align-items: center; gap: 4px; font: 700 12.5px var(--sans); color: #15803d; }
.rs-ck-btn > b svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; }


/* ---------- My Library: Bookmarks, History, Saved Results ---------- */
.lib-nav { display: flex; align-items: center; gap: 6px; }
.lib-btn { position: relative; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 600 12.5px var(--sans); color: var(--ink-2); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.lib-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.lib-btn:hover { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }
.lib-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #2563eb; color: #fff; font: 700 10.5px/18px var(--sans); text-align: center; }
.lib-count[hidden] { display: none; }
/* the bell on the News button: new or updated stories since the news was last opened */
.nw-bell { position: relative; flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: #fef3c7; color: #b45309; animation: nwRing 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
.lib-btn .nw-bell svg { width: 14px; height: 14px; stroke-width: 2.2; }
.nw-bell i { position: absolute; top: -1px; right: -1px; width: 8px; height: 8px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 2px #fff; }
@keyframes nwRing { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-5deg); } }
@media (prefers-reduced-motion: reduce) { .nw-bell { animation: none; } }
html[data-theme="dark"] .nw-bell { background: #451a03; color: #fbbf24; }
html[data-theme="dark"] .nw-bell i { box-shadow: 0 0 0 2px #0f172a; }
@media (max-width: 760px) { .lib-btn span { display: none; } .lib-btn { padding: 7px; } }
.lib-box { width: min(720px, calc(100vw - 32px)); }
.lib-tools { display: flex; align-items: center; gap: 10px; padding: 10px 18px 0; }
.lib-tools input { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: 13.5px var(--sans); color: var(--ink); }
.lib-tools input:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.lib-tools .link-small[hidden] { display: none; }
.lib-body { font-family: var(--sans); }
.lib-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lib-list li { display: flex; align-items: stretch; border: 1px solid var(--line); border-left: 4px solid #60a5fa; border-radius: 10px; background: var(--surface); overflow: hidden; }
.lib-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.lib-open:hover { background: color-mix(in srgb, #2563eb 6%, var(--surface)); }
.lib-open .c-name { font: 700 13.5px var(--serif); color: var(--ink); }
.lib-open .c-name .c-vs { text-transform: none; font-style: italic; font-weight: 500; }
.lib-open .lib-q { font-family: var(--sans); font-weight: 600; }
.lib-open .c-cit { font-size: 12px; color: var(--muted); }
.lib-x { flex: none; width: 38px; border: 0; border-left: 1px solid var(--line); background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.lib-x:hover { background: #fee2e2; color: #b91c1c; }
#saveRes.active { background: #2563eb; border-color: #2563eb; color: #fff; }
#saveRes[hidden] { display: none; }

/* Previous / Next: centred at the top of the judgment */
.doc-nav { left: 50%; transform: translateX(-50%); }
@media (max-width: 900px) { .doc-nav { left: 50%; } }
/* the bar stays exactly where it is, full size, while the judgment scrolls */
.here-bar.on ~ .doc-nav { top: 8px; }
.here-bar { top: 50px; }
.doc-nav.dn-mini:not(:hover) { padding: 4px 5px 4px 9px; gap: 8px; opacity: 1; }
.doc-nav.dn-mini:not(:hover) .dn-btn { padding: 3px 10px 3px 7px; }
.doc-nav.dn-mini:not(:hover) .dn-btn#dNext { padding: 3px 7px 3px 10px; }
@media (min-width: 901px) {
  .doc-nav.dn-mini:not(:hover) .dn-pos:not([hidden]) { display: inline; }
  .doc-nav.dn-mini:not(:hover) .dn-btn span { display: inline; }
}

/* ---------- Previous / Next: a panel along the top of the judgment, in the reading colours ---------- */
.pane-main { --navdock: 50px; }
.pane-main iframe { margin-top: var(--navdock); height: calc(100% - var(--navdock)); }
.nav-dock { position: absolute; z-index: 6; left: 0; right: 0; top: 0; height: var(--navdock); display: flex; align-items: center; justify-content: center; padding: 0 12px;
  --nd-bg: #eef2f7; --nd-line: #cbd5e1; --nd-card: #ffffff; --nd-ink: #0f172a; --nd-acc: #1d4ed8; --nd-soft: #dbeafe; --nd-btn: #ffffff;
  background: var(--nd-bg); border-bottom: 1px solid var(--nd-line); box-shadow: 0 3px 10px rgba(15, 23, 42, .08); }
.pane-main.has-rail .nav-dock { right: 52px; }
.para-rail { top: var(--navdock, 0); }
.drawer[data-rt="sepia"] .nav-dock { --nd-bg: #e6d5ae; --nd-line: #c9b385; --nd-card: #f6eedc; --nd-ink: #2e2414; --nd-acc: #7a4e12; --nd-soft: #efdfb9; --nd-btn: #fffaf0; box-shadow: 0 3px 10px rgba(80, 55, 15, .15); }
.drawer[data-rt="dark"] .nav-dock { --nd-bg: #0b0e14; --nd-line: #334155; --nd-card: #1a202c; --nd-ink: #f1f5f9; --nd-acc: #93c5fd; --nd-soft: #1e3a5f; --nd-btn: #273142; box-shadow: 0 3px 12px rgba(0, 0, 0, .45); }
.nav-dock .doc-nav { position: static; transform: none; top: auto; left: auto; padding: 4px 6px 4px 12px; border: 1px solid var(--nd-line); border-left: 4px solid var(--nd-acc); border-radius: 12px; background: var(--nd-card); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.nav-dock .dn-pos { color: var(--nd-acc); font-size: 10px; font-weight: 800; }
.nav-dock .dn-btn { border-color: var(--nd-line); background: var(--nd-btn); color: var(--nd-ink); font-weight: 700; box-shadow: none; }
.nav-dock .dn-btn:hover:not(:disabled) { background: var(--nd-acc); border-color: var(--nd-acc); color: var(--nd-card); }
.nav-dock .dn-btn:disabled { opacity: .55; }
.nav-dock .dn-btn.dn-back { background: var(--nd-soft); color: var(--nd-acc); border-color: var(--nd-acc); }
.nav-dock #dPrev.busy, .nav-dock #dNext.busy { background: var(--nd-soft); border-color: var(--nd-acc); }
.top-down { bottom: 22px; }
@media (max-width: 600px) { .top-down { bottom: 14px; } }

/* ---------- The case title at the top of the judgment ---------- */
.d-head { position: relative; padding-left: 26px; background: linear-gradient(90deg, color-mix(in srgb, #2563eb 9%, var(--surface)) 0%, var(--surface) 65%); border-bottom: 1px solid color-mix(in srgb, #2563eb 22%, var(--line)); }
.d-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, #2563eb, #7c3aed); }
.d-head h2#dTitle { font: 700 21px/1.3 var(--serif); letter-spacing: .01em; color: var(--accent); text-shadow: 0 1px 0 color-mix(in srgb, var(--surface) 70%, transparent); }
.dt-party { display: inline; }
.dt-vs { display: inline-block; margin: 0 3px; padding: 1px 9px 2px; border-radius: 999px; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font: italic 700 12px/1.6 var(--sans); letter-spacing: .03em; vertical-align: 3px; box-shadow: 0 2px 6px rgba(37, 99, 235, .3); }
.drawer.is-overruled .dt-vs { background: #dc2626; box-shadow: none; }
@media (max-width: 640px) { .d-head { padding-left: 18px; } .d-head h2#dTitle { font-size: 18px; } .dt-vs { margin: 0 6px; font-size: 11px; } }

/* ---------- Section / Rule panel: Judgments or Bare Act (typewriter) ---------- */
.sp-tabs { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.sp-tabs button { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: 600 12px var(--sans); color: var(--ink-2); cursor: pointer; }
.sp-tabs button[aria-selected="true"] { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.sp-tabs button[data-sp-tab="judg"][aria-selected="true"] { background: #2563eb; border-color: #2563eb; }
.sp-bare.typing::after { content: "▍"; margin-left: 1px; color: #7c3aed; animation: spBlink .8s steps(1) infinite; }
.sp-bare:empty::before { content: "Writing the bare Act text…"; color: var(--muted); font-style: italic; }
@keyframes spBlink { 50% { opacity: 0; } }
.sec-panel .sp-body .dg-list { margin-top: 4px; }

/* the Section panel in the judgment's own reading style */
.sec-panel { background: var(--sp-bg, var(--surface)); color: var(--sp-ink, var(--ink)); border-color: color-mix(in srgb, #7c3aed 35%, var(--sp-line, var(--line))); }
.sec-panel .sp-head { background: color-mix(in srgb, #7c3aed 8%, var(--sp-bg, var(--surface))); border-bottom-color: var(--sp-line, var(--line)); }
.sec-panel .sp-head span, .sec-panel .sp-eq { color: var(--sp-ink, var(--ink-2)); }
.sec-panel .sp-tabs { background: color-mix(in srgb, var(--sp-ink, #000) 4%, var(--sp-bg, var(--surface))); border-bottom-color: var(--sp-line, var(--line)); }
.sec-panel .sp-tabs button:not([aria-selected="true"]) { background: var(--sp-bg, var(--surface)); color: var(--sp-ink, var(--ink-2)); border-color: var(--sp-line, var(--line)); }
.sec-panel .sp-bare { font-family: var(--sp-font, "Times New Roman", serif); font-size: var(--sp-size, 15px); line-height: var(--sp-lh, 1.2); color: var(--sp-ink, var(--ink)); text-align: justify; }
.sec-panel .dg-list button { background: var(--sp-bg, var(--surface)); border-color: var(--sp-line, var(--line)); }
.sec-panel .dg-name { font-family: var(--sp-font, var(--serif)); font-size: calc(var(--sp-size, 15px) * .9); line-height: var(--sp-lh, 1.3); color: var(--sp-ink, var(--ink)); }
.sec-panel .dg-snip { font-family: var(--sp-font, inherit); font-size: calc(var(--sp-size, 15px) * .82); line-height: var(--sp-lh, 1.4); color: var(--sp-ink, var(--ink-2)); opacity: .85; }
.sec-panel .dg-meta, .sec-panel .sp-note, .sec-panel .sp-label, .sec-panel .dg-head { color: color-mix(in srgb, var(--sp-ink, var(--ink)) 65%, transparent); }
.sec-panel[data-rt="dark"] .sp-head b { color: #c4b5fd; }
.sec-panel[data-rt="dark"] .dg-list button:hover { background: color-mix(in srgb, #2563eb 18%, var(--sp-bg)); }

/* case-name suggestions under the search box */
.qh-sug { flex-wrap: wrap; row-gap: 1px; }
.qh-sug .qh-sname { flex: 1 1 60%; font: 600 13.5px var(--serif); text-transform: uppercase; }
.qh-sug .qh-sname b { color: #1d4ed8; }
.qh-sug .qh-smeta { flex: none; margin-left: auto; font: 11.5px var(--sans); color: var(--muted); white-space: nowrap; }
.qh-sug.on, .qh-sug:hover { background: color-mix(in srgb, #2563eb 8%, var(--surface)); border-radius: 9px; }
.qh-wait { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.qh-more { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.qh-more .spinner, .qh-wait .spinner { width: 12px; height: 12px; }

/* Previous / Next: bigger buttons and text */
.pane-main { --navdock: 60px; }
.nav-dock .doc-nav { gap: 12px; padding: 6px 8px 6px 16px; border-radius: 14px; }
.nav-dock .dn-pos { font-size: 12.5px; letter-spacing: .07em; }
.nav-dock .dn-row { gap: 8px; }
.nav-dock .dn-btn, .nav-dock .dn-btn#dNext, .doc-nav.dn-mini:not(:hover) .dn-btn, .doc-nav.dn-mini:not(:hover) .dn-btn#dNext { padding: 8px 18px 8px 13px; font-size: 15px; border-radius: 999px; gap: 6px; }
.nav-dock .dn-btn#dNext, .doc-nav.dn-mini:not(:hover) .dn-btn#dNext { padding: 8px 13px 8px 18px; }
.nav-dock .dn-btn svg { width: 17px; height: 17px; }
@media (max-width: 900px) { .nav-dock .dn-btn, .nav-dock .dn-btn#dNext { padding: 8px 12px; } }

/* ---------- fitting the screen ---------- */
/* big screens (1600 px and wider): the page uses the width instead of a narrow column in the middle */
@media (min-width: 1500px) {
  .wrap { max-width: min(1680px, 94vw); }
  .layout { grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
}
/* very big or high-resolution screens (2K, 4K): everything a little larger, so text is not tiny */
@media (min-width: 2200px) {
  .topbar .wrap, .hero .wrap, .layout { zoom: 1.15; }
}
@media (min-width: 3000px) {
  .topbar .wrap, .hero .wrap, .layout { zoom: 1.35; }
}
/* short laptop screens (768 px high and less): a slimmer judgment header, so more of the judgment shows */
@media (min-width: 901px) and (max-height: 820px) {
  .d-head { padding: 10px 18px 8px; }
  .d-head h2 { font-size: 19px; }
  .d-tools { padding-top: 5px; padding-bottom: 5px; }
  .drawer .pane-main { --navdock: 46px; }
}
/* phones: the reading panel is a drawer over the judgment, opened with the small "Show" tab on the left edge */
@media (max-width: 760px) {
  .read-side { position: absolute; z-index: 12; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .35), var(--shadow-lg); }
  .rs-handle { z-index: 13; padding: 10px 4px; border-radius: 0 10px 10px 0; background: #1d4ed8; color: #ffffff; box-shadow: 0 4px 14px rgba(29, 78, 216, .35); }
  .rs-handle:hover { background: #1e3a8a; color: #ffffff; }
  .drawer.rs-open .rs-handle { left: min(320px, 86vw); }
}

/* the "Please wait" box: ✕ to close it (and stop), and "Stop and close" when it takes long */
.wait-x { position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 14px; cursor: pointer; }
.wait-x:hover { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.wait-card .wait-text { padding: 0 18px; font-size: 13px; color: var(--muted); }
.wait-card .wait-text small { display: block; margin-top: 6px; color: #b45309; font-weight: 600; }
.wait-stop { margin-top: 10px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 13px var(--sans); cursor: pointer; }
.wait-stop:hover { border-color: var(--danger); color: var(--danger); }

.push-toast { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: #0f172a; color: #fff; font: 600 14px var(--sans); box-shadow: var(--shadow-lg); }
/* a long case name: at most two lines, ending in "…" (the full name shows on hover) */
.d-head h2#dTitle { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
/* Citation Search pop-up */
.cs-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); animation: fade .15s ease-out; }
.cs-back[hidden] { display: none; }
.cs-dlg { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 18px; background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); animation: rise .2s ease-out; }
.cs-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px; background: linear-gradient(135deg, #1f3a5f, #14253d); color: #fff; }
.cs-logo { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 1px solid rgba(233, 201, 139, .45); border-radius: 11px; background: rgba(255, 255, 255, .08); }
.cs-logo svg { width: 21px; height: 21px; fill: none; stroke: #e9c98b; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cs-head div { flex: 1; min-width: 0; }
.cs-head h2 { margin: 0; font: 600 20px var(--serif); }
.cs-head p { margin: 2px 0 0; font-size: 13px; color: #cbd5e1; }
.cs-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 15px; cursor: pointer; }
.cs-x:hover { background: rgba(255, 255, 255, .26); }
.cs-form { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.cs-form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; font: 600 13px var(--sans); color: var(--ink-2); }
.cs-form input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 15px var(--sans); }
.cs-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.cs-row { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 10px; }
.cs-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.cs-err { margin: 0; padding: 8px 11px; border-radius: 9px; background: #fef2f2; color: #b91c1c; font-size: 13px; }
.cs-acts { display: flex; justify-content: flex-end; gap: 8px; }
.cs-acts .btn { padding: 9px 18px; }
.cs-acts .btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (max-width: 420px) { .cs-row { grid-template-columns: 1fr 1fr; } .cs-row label:first-child { grid-column: 1 / -1; } }
.cs-req { color: #dc2626; font-weight: 700; }
.cs-opt { font-weight: 500; color: var(--muted); }

/* ---------- AI Search (next to Full Text Search) ---------- */
.aif-btn { flex: none; scroll-snap-align: start; position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 7px 16px 7px 12px; border: 0; border-radius: 999px; cursor: pointer; color: #fff; font: 700 13px var(--sans); letter-spacing: .01em; white-space: nowrap; background: linear-gradient(120deg, #1e3a8a, #6d28d9, #c026d3, #1e3a8a); background-size: 300% 100%; box-shadow: 0 4px 14px rgba(109, 40, 217, .35); animation: aifShift 6s ease infinite; transition: transform .15s, box-shadow .2s; overflow: hidden; }
.aif-btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-120%); animation: aifShine 3.2s ease-in-out infinite; }
.aif-btn svg { width: 17px; height: 17px; fill: #fde68a; stroke: #fde68a; stroke-width: 1.2; animation: aifTwinkle 2.4s ease-in-out infinite; }
.aif-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(109, 40, 217, .45); }
.aif-btn:active { transform: scale(.97); }
@keyframes aifShift { 0%, 100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }
@keyframes aifShine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes aifTwinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(12deg); } }
@media (max-width: 1100px) { .search-type .st-hint { display: none; } } /* room for the search types and AI Features */
@media (max-width: 640px) { .aif-btn { padding: 6px 12px 6px 9px; font-size: 12.5px; } }
@media (prefers-reduced-motion: reduce) { .aif-btn, .aif-btn::after, .aif-btn svg { animation: none; } }

/* the pop-up */
.aif-back { position: fixed; inset: 0; z-index: 95; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 14px; background: rgba(10, 15, 35, .6); backdrop-filter: blur(3px); animation: fade .18s ease-out; }
.aif-back[hidden] { display: none; }
.aif-dlg { width: min(540px, 100%); min-width: 0; max-width: 100%; max-height: calc(100vh - 28px); overflow: auto; border-radius: 20px; background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, .4); animation: aifPop .28s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes aifPop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.aif-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 14px 12px 16px; color: #fff; background: linear-gradient(120deg, #0f1e45, #1e3a8a 45%, #5b21b6); background-size: 200% 100%; animation: aifShift 8s ease infinite; overflow: hidden; }
.aif-head::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(192, 38, 211, .45), transparent 65%); pointer-events: none; }
.aif-orb { position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(253, 230, 138, .5); box-shadow: 0 0 22px rgba(253, 230, 138, .35); }
.aif-orb svg { width: 21px; height: 21px; fill: #fde68a; stroke: #fde68a; stroke-width: 1; animation: aifTwinkle 2.4s ease-in-out infinite; }
.aif-head div { position: relative; flex: 1; min-width: 0; }
.aif-head h2 { margin: 0; font: 600 18px var(--serif); }
.aif-head h2 em { font-style: italic; font-weight: 500; color: #fde68a; }
.aif-head p { margin: 2px 0 0; font-size: 12.5px; color: #c7d2fe; }
.aif-x { position: relative; flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 15px; cursor: pointer; }
.aif-x:hover { background: rgba(255, 255, 255, .28); }
.aif-form { display: flex; flex-direction: column; gap: 11px; padding: 14px 16px 13px; }
.aif-ask { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 3px; border-radius: 16px; background: linear-gradient(120deg, #3b82f6, #8b5cf6, #d946ef, #3b82f6); background-size: 300% 100%; animation: aifShift 6s ease infinite; }
.aif-ask textarea { width: 100%; min-height: 64px; resize: vertical; padding: 11px 14px 46px; border: 0; border-radius: 13px; background: var(--surface); color: var(--ink); font: 16px/1.5 var(--serif); outline: none; }
.aif-ask textarea::placeholder { color: var(--muted); font-style: italic; }
.aif-go { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border: 0; border-radius: 999px; cursor: pointer; color: #fff; font: 700 14px var(--sans); background: linear-gradient(120deg, #1e3a8a, #6d28d9); box-shadow: 0 6px 18px rgba(109, 40, 217, .4); transition: transform .15s; }
.aif-go:hover { transform: translateY(-1px); }
.aif-go svg { width: 16px; height: 16px; fill: #fde68a; stroke: #fde68a; }
.aif-err { margin: 0; padding: 8px 12px; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-size: 13px; }
.aif-recent b { display: block; margin-bottom: 7px; font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.aif-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.aif-chip { max-width: 100%; min-width: 0; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 12.5px var(--sans); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.aif-chip:hover { border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 10%, var(--surface)); color: var(--ink); transform: translateY(-1px); }
.aif-chip.recent::before { content: "↺ "; color: #8b5cf6; }
.aif-note { margin: 0; font-size: 11.5px; color: var(--muted); }
@media (max-width: 520px) { .aif-form { padding: 14px; } .aif-head { padding: 14px; } .aif-head h2 { font-size: 18px; } .aif-chip { white-space: normal; } }
@media (prefers-reduced-motion: reduce) { .aif-head, .aif-ask, .aif-orb svg, .aif-dlg { animation: none; } }

/* phones: the top bar fits the screen (it used to make the whole page wider than the phone, which then zoomed out) */
@media (max-width: 520px) {
  .topbar-inner { min-width: 0; }
  .topbar-right { gap: 5px; min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
  .lib-nav { gap: 3px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; }
  .lib-nav::-webkit-scrollbar { display: none; }
  .lib-btn { padding: 6px; flex: none; }
  .topbar-right .icon-btn { width: 34px; height: 34px; flex: none; }
  .acct-btn, .acct-logout { height: 34px !important; }
  .acct-logout { padding: 0 9px !important; }
}
/* the AI panel while Law365 AI researches: a sweeping scale, changing phrases, and the five sections filling in */
.ai-skel { display: grid; gap: 10px; padding: 0 4px 22px; }
.ai-skel-row { display: grid; gap: 7px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); opacity: 0; animation: aiSkelIn .45s ease-out forwards; animation-delay: calc(var(--i) * 260ms); }
.ai-skel-row b { font: 700 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: color-mix(in srgb, #6d28d9 70%, var(--muted)); }
.ai-skel-row i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--line) 70%, transparent) 25%, color-mix(in srgb, #8b5cf6 22%, var(--surface)) 50%, color-mix(in srgb, var(--line) 70%, transparent) 75%); background-size: 200% 100%; animation: aiShimmer 1.4s linear infinite; }
.ai-skel-row i.short { width: 62%; }
@keyframes aiSkelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes aiShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .ai-skel-row { animation: none; opacity: 1; } .ai-skel-row i { animation: none; } }
/* the search types under the search box: six equal buttons across the width on a wide window;
   on a narrower window they become chips that scroll sideways (the rules above) */
@media (min-width: 1100px) {
  .search-type .st-hint { display: none; }
  .search-type .st-seg { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); flex: 1; overflow: visible; }
  .st-seg > label, .st-seg > .st-act, .st-seg > .aif-btn { min-width: 0; }
  .st-seg > label > span, .st-seg > .st-act > span { width: 100%; justify-content: center; height: 38px; padding: 0 10px; }
  .st-seg > .aif-btn { width: 100%; justify-content: center; height: 38px; padding: 0 10px; }
}
/* AI Search sits among the search types: its label is plain text, not one of their white chips */
.st-seg .aif-btn span { display: inline; padding: 0; border: 0; background: none; box-shadow: none; color: inherit; font: inherit; }
.lib-btn { white-space: nowrap; } /* "Bare Acts", "Saved Results" stay on one line */
/* Top / Down while reading a long AI answer */
.ai-jump { position: fixed; z-index: 60; right: 18px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; animation: fade .2s ease-out; }
.ai-jump[hidden] { display: none; }
.ai-jump button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: linear-gradient(135deg, #1e3a8a, #6d28d9); box-shadow: 0 6px 18px rgba(109, 40, 217, .35); font: 700 9.5px var(--sans); letter-spacing: .04em; text-transform: uppercase; transition: transform .15s, box-shadow .2s; }
.ai-jump button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(109, 40, 217, .45); }
.ai-jump svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) { .ai-jump { right: 12px; bottom: 14px; } .ai-jump button { width: 42px; height: 42px; } }
@media print { .ai-jump { display: none !important; } }

/* ================= AI answer: interactive design ================= */
#aiBody { padding: 0 16px 6px; }
/* the section bar (stays in view while reading) */
.ai-nav { position: sticky; top: 64px; z-index: 5; display: flex; align-items: center; gap: 8px; margin: 0 -16px 6px; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.ai-nav-pills { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ai-nav-pills::-webkit-scrollbar { display: none; }
.ai-nav button { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--sans); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.ai-nav button:hover { border-color: #8b5cf6; color: var(--ink); transform: translateY(-1px); }
.ai-nav button.on { background: linear-gradient(135deg, #1e3a8a, #6d28d9); border-color: transparent; color: #fff; }
.ai-nav button b { min-width: 20px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, #8b5cf6 16%, transparent); font-size: 11px; line-height: 18px; text-align: center; }
.ai-nav button.on b { background: rgba(255, 255, 255, .25); }
.ai-nav .ai-si { width: 22px; height: 22px; }
.ai-nav .ai-si svg { width: 13px; height: 13px; }
.ai-nav-acts { display: flex; gap: 6px; flex: none; }
.ai-nav-acts button { padding: 6px 12px; }
.ai-nav-acts svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-nav .ai-again { border: 0; color: #fff; background: linear-gradient(120deg, #1e3a8a, #6d28d9); }
.ai-nav .ai-again svg { fill: #fde68a; stroke: #fde68a; stroke-width: 1; }
@media (max-width: 760px) { .ai-nav { flex-wrap: wrap; } .ai-nav-acts { width: 100%; justify-content: flex-end; } .ai-nav-pills span { display: none; } .ai-nav-pills button { padding: 5px 9px 5px 5px; } }

/* sections */
#aiBody .ai-sec { scroll-margin-top: 130px; border-bottom: 0; margin: 10px 0; border-radius: 14px; background: var(--surface); }
#aiBody .ai-sec summary { gap: 10px; padding: 10px 4px; font-size: 12.5px; }
.ai-si { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: linear-gradient(135deg, #1e3a8a, #6d28d9); font-style: normal; }
.ai-si svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-main .ai-si { background: linear-gradient(135deg, #0369a1, #2563eb); }
.ai-key .ai-si { background: linear-gradient(135deg, #6d28d9, #a21caf); }
.ai-analysis .ai-si { background: linear-gradient(135deg, #0f766e, #059669); }
.ai-conclusion .ai-si { background: linear-gradient(135deg, #b45309, #d97706); }
.ai-cases .ai-si { background: linear-gradient(135deg, #1e3a8a, #475569); }
#aiBody .ai-sec-body { padding: 2px 4px 12px 44px; }
@media (max-width: 640px) { #aiBody .ai-sec-body { padding-left: 4px; } }

/* Main Finding and Conclusion: highlighted cards */
.ai-callout { position: relative; padding: 16px 48px 14px 18px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, #2563eb 7%, var(--surface)), color-mix(in srgb, #8b5cf6 7%, var(--surface))); border: 1px solid color-mix(in srgb, #6d28d9 22%, var(--line)); box-shadow: inset 4px 0 0 #2563eb; font-size: 16px; color: var(--ink); animation: aiCardIn .4s ease-out both; }
.ai-conclusion .ai-callout { background: linear-gradient(135deg, color-mix(in srgb, #d97706 8%, var(--surface)), color-mix(in srgb, #fde68a 18%, var(--surface))); border-color: color-mix(in srgb, #d97706 30%, var(--line)); box-shadow: inset 4px 0 0 #d97706; }
#aiBody .ai-callout p { margin: 0 0 8px; padding: 0; border: 0; background: none; }
#aiBody .ai-callout p:last-of-type { margin-bottom: 0; }

/* copy buttons */
.ai-copy { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; opacity: .55; transition: opacity .15s, color .15s, border-color .15s; }
.ai-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-copy:hover { opacity: 1; color: #6d28d9; border-color: #8b5cf6; }
@media (hover: hover) { .ai-principles li .ai-copy { opacity: 0; } .ai-principles li:hover .ai-copy { opacity: .7; } }

/* Key Principles: numbered cards */
#aiBody .ai-principles { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
#aiBody .ai-principles li { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 46px 14px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .2s, transform .15s; animation: aiCardIn .4s ease-out both; animation-delay: calc(var(--i) * 70ms); }
#aiBody .ai-principles li::before { display: none; }
#aiBody .ai-principles li:hover { border-color: color-mix(in srgb, #8b5cf6 45%, var(--line)); box-shadow: 0 8px 22px rgba(30, 58, 138, .08); transform: translateY(-1px); }
.ai-pn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #6d28d9, #a21caf); color: #fff; font: 700 13px var(--sans); }
.ai-pt { min-width: 0; font: 15.5px/1.7 var(--serif); color: var(--ink); }

/* citations: chips that open the judgment */
#aiBody .ai-cite { display: inline-flex; align-items: center; gap: 6px; margin: 6px 4px 0 0; padding: 4px 6px 4px 10px; border: 1px solid color-mix(in srgb, #2563eb 30%, var(--line)); border-radius: 999px; background: color-mix(in srgb, #2563eb 6%, var(--surface)); color: #1e3a8a; font: 600 13px/1.35 var(--serif); text-align: left; cursor: pointer; transition: background .15s, border-color .15s, transform .15s, box-shadow .15s; }
#aiBody .ai-cite span { padding: 1px 8px; border-radius: 999px; background: #1e3a8a; color: #fff; font: 700 10.5px var(--sans); letter-spacing: .03em; }
#aiBody .ai-cite:hover, #aiBody .ai-cite.ai-hl { background: color-mix(in srgb, #2563eb 14%, var(--surface)); border-color: #2563eb; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, .18); text-decoration: none; }
html[data-theme="dark"] #aiBody .ai-cite { color: #bfdbfe; }

/* Analysis: shortened, "Show full analysis" */
#aiBody .ai-analysis .ai-sec-body p { font-size: 15.5px; }
.ai-folded { display: none; }
.ai-folded.show { display: block; animation: aiCardIn .3s ease-out both; }
.ai-more { margin-top: 4px; padding: 7px 14px; border: 1px dashed color-mix(in srgb, #059669 50%, var(--line)); border-radius: 999px; background: color-mix(in srgb, #059669 6%, var(--surface)); color: #047857; font: 600 13px var(--sans); cursor: pointer; }
.ai-more:hover { border-style: solid; }

/* Cases Referenced: numbered cards */
#aiBody div.ai-cases { gap: 12px; }
#aiBody .ai-case { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "n name" "n meta"; gap: 4px 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .2s, transform .15s; animation: aiCardIn .4s ease-out both; animation-delay: calc(var(--i) * 50ms); }
#aiBody .ai-case:hover, #aiBody .ai-case.ai-hl { border-color: #2563eb; box-shadow: 0 10px 26px rgba(30, 58, 138, .12); transform: translateY(-2px); }
.ai-cn { grid-area: n; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: color-mix(in srgb, #1e3a8a 10%, var(--surface)); color: #1e3a8a; font: 700 12.5px var(--sans); }
#aiBody .ai-case .c-name { grid-area: name; font: 600 14.5px/1.4 var(--serif); color: var(--ink); }
.ai-cmeta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-used { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, #6d28d9 12%, var(--surface)); color: #6d28d9; font: 700 11px var(--sans); }
#aiBody .ai-case .c-cit { font: 600 12px var(--sans); color: #1d4ed8; }

@keyframes aiCardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ai-callout, #aiBody .ai-principles li, #aiBody .ai-case, .ai-folded.show { animation: none; } }
@media print { .ai-nav, .ai-copy, .ai-more { display: none !important; } .ai-folded { display: block !important; } }

/* ---------- the search buttons under the search box: one blue style for all, in plain colours ----------
   (no color-mix() or other newer CSS here, so they look the same on older browsers too: before, the chosen
   button lost its background there and showed white text on white) */
.st-seg > label > span,
.st-seg > .st-act > span {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  box-shadow: none;
}
.st-seg > label > span svg,
.st-seg > .st-act > span svg { stroke: #1d4ed8; opacity: 1; }
.st-seg > label:hover > span,
.st-seg > .st-act:hover > span { background: #dbeafe; border-color: #3b82f6; color: #1e3a8a; }
/* the chosen search type */
.st-seg > label > input:checked + span {
  background: #1d4ed8;
  background-image: linear-gradient(135deg, #2563eb, #1e3a8a);
  border-color: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(29, 78, 216, .35);
}
.st-seg > label > input:checked + span svg { stroke: #ffffff; }
/* AI Search: the same blue family, a little deeper, with its gold sparkle */
.st-seg > .aif-btn {
  background: #1e40af;
  background-image: linear-gradient(120deg, #1e3a8a, #2563eb, #1d4ed8, #1e3a8a);
  background-size: 300% 100%;
  color: #ffffff;
  border: 1px solid #1e3a8a;
  box-shadow: 0 3px 10px rgba(29, 78, 216, .35);
}
html[data-theme="dark"] .st-seg > label > span,
html[data-theme="dark"] .st-seg > .st-act > span { background: #172554; border-color: #1d4ed8; color: #dbeafe; }
html[data-theme="dark"] .st-seg > label > span svg,
html[data-theme="dark"] .st-seg > .st-act > span svg { stroke: #93c5fd; }
html[data-theme="dark"] .st-seg > label > input:checked + span { background: #2563eb; color: #ffffff; }

/* Previous / Next / Back to result: square buttons with a thin line between them */
.doc-nav, .nav-dock .doc-nav { border-radius: 8px; }
.dn-row, .nav-dock .dn-row { gap: 13px; }
.dn-btn, .nav-dock .dn-btn, .doc-nav.dn-mini:not(:hover) .dn-btn, #dPrev, #dNext, #dBackRes { border-radius: 4px !important; }
.dn-row > .dn-btn ~ .dn-btn:not([hidden])::before {
  content: ""; position: absolute; left: -8px; top: 18%; bottom: 18%; width: 1px;
  background: var(--nd-line, #93c5fd); pointer-events: none;
}

/* the search buttons on every system:
   - the page's own dark mode (from the computer's setting): the same light-blue buttons stay readable
   - Windows High Contrast / Contrast themes: the system's own colours, with clear borders and the chosen one marked */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .st-seg > label > span,
  html:not([data-theme="light"]) .st-seg > .st-act > span { background: #172554; border-color: #3b82f6; color: #dbeafe; }
  html:not([data-theme="light"]) .st-seg > label > span svg,
  html:not([data-theme="light"]) .st-seg > .st-act > span svg { stroke: #93c5fd; }
  html:not([data-theme="light"]) .st-seg > label > input:checked + span { background: #2563eb; border-color: #93c5fd; color: #ffffff; }
}
@media (forced-colors: active) {
  .st-seg > label > span, .st-seg > .st-act > span, .st-seg > .aif-btn {
    forced-color-adjust: none;
    background: ButtonFace; color: ButtonText; border: 2px solid ButtonText; box-shadow: none;
  }
  .st-seg > label > span svg, .st-seg > .st-act > span svg, .st-seg > .aif-btn svg { stroke: ButtonText; fill: none; }
  .st-seg > label > input:checked + span { background: Highlight; color: HighlightText; border-color: Highlight; }
  .st-seg > label > input:checked + span svg { stroke: HighlightText; }
  .st-seg > label > input:focus-visible + span, .st-seg > .st-act:focus-visible > span, .st-seg > .aif-btn:focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
  .aif-btn::after { display: none; }
}

/* ---------- home page: Today in the library · Most read · My recent searches ---------- */
.today-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 0; padding: 8px 14px; border: 1px solid #bfdbfe; border-radius: 12px; background: #eff6ff; color: #1e3a8a; font: 500 13.5px var(--sans); animation: rise .3s ease-out; }
.today-strip[hidden] { display: none; }
.ts-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: tsPulse 2s ease-out infinite; }
@keyframes tsPulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.ts-lbl { font-weight: 700; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: #1d4ed8; }
.ts-date { font-weight: 700; color: #0f172a; }
.ts-n { padding: 3px 10px; border: 1px solid #93c5fd; border-radius: 999px; background: #ffffff; color: #1e3a8a; font: 500 13px var(--sans); cursor: pointer; }
.ts-n b { font-weight: 800; color: #1d4ed8; }
button.ts-n:hover:not(:disabled) { background: #1d4ed8; border-color: #1d4ed8; color: #ffffff; }
button.ts-n:hover:not(:disabled) b { color: #ffffff; }
.ts-n:disabled, .ts-plain { cursor: default; }
.ts-sep { width: 1px; height: 18px; background: #93c5fd; }
.ts-at { margin-left: auto; font-size: 12px; color: #475569; }
@media (max-width: 640px) { .ts-at { margin-left: 0; width: 100%; } .ts-sep { display: none; } }
html[data-theme="dark"] .today-strip { background: #172554; border-color: #1d4ed8; color: #dbeafe; }
html[data-theme="dark"] .ts-date { color: #ffffff; }
html[data-theme="dark"] .ts-n { background: #0f172a; color: #dbeafe; }
html[data-theme="dark"] .ts-n b { color: #93c5fd; }
html[data-theme="dark"] .ts-at { color: #94a3b8; }
.tag-hot { padding: 1px 8px; border-radius: 999px; background: #fff7ed; border: 1px solid #fdba74; color: #c2410c; font: 700 11px var(--sans); letter-spacing: .02em; }
.side-recent { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-recent[hidden] { display: none; }
.sr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sr-head b { font: 700 11.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sr-head a { font-size: 12.5px; color: #1d4ed8; text-decoration: none; }
.sr-head a:hover { text-decoration: underline; }
.sr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sr-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: 14px var(--sans); text-align: left; cursor: pointer; }
.sr-list button:hover { background: #eff6ff; color: #1e3a8a; }
.sr-list svg { flex: none; width: 15px; height: 15px; fill: none; stroke: #64748b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-list span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-list small { margin-right: 6px; padding: 0 6px; border-radius: 6px; background: #e0e7ff; color: #3730a3; font: 700 10.5px var(--sans); }
.ts-x { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-left: 4px; padding: 0; border: 1px solid #93c5fd; border-radius: 50%; background: #ffffff; color: #1e3a8a; font: 700 12px var(--sans); cursor: pointer; }
.ts-x:hover { background: #1d4ed8; border-color: #1d4ed8; color: #ffffff; }
.ts-at + .ts-x, .ts-x:only-child { margin-left: 4px; }
.today-strip:not(:has(.ts-at)) .ts-x { margin-left: auto; }
@media (max-width: 640px) { .ts-x { position: absolute; top: 8px; right: 8px; } .today-strip { position: relative; padding-right: 42px; } }
html[data-theme="dark"] .ts-x { background: #0f172a; color: #dbeafe; border-color: #1d4ed8; }
/* the left panel never scrolls sideways (a long recent search is shortened with "…") */
.side, #sidePanel { overflow-x: hidden; }
.side-recent, .sr-list, .sr-list li { min-width: 0; max-width: 100%; }
/* "Install app": the steps for this device (iPhone / iPad / Mac Safari / Android / Firefox / plain http) */
.ih-back { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.ih-back[hidden] { display: none; }
.ih-card { width: min(440px, 100%); padding: 18px 18px 16px; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); animation: rise .2s ease-out; }
.ih-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ih-head img { flex: none; border-radius: 11px; }
.ih-head div { flex: 1; min-width: 0; }
.ih-head b { display: block; font: 600 17px var(--serif); color: var(--ink); }
.ih-head small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.ih-x { flex: none; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; }
.ih-card ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 9px; font: 14.5px/1.5 var(--sans); color: var(--ink-2); }
.ih-card ol svg { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: #1d4ed8; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ih-ok { width: 100%; justify-content: center; }
@media (max-width: 520px) { .install-btn span { display: none; } .install-btn { padding: 0 9px; } }

/* ---------- phones: the judgment window ---------- */
@media (max-width: 760px) {
  /* no paragraph-number column on the right: the judgment uses the whole width */
  .para-rail { display: none !important; }
  .pane-main.has-rail iframe { margin-right: 0; width: 100%; }
  .pane-main.has-rail .nav-dock { right: 0; }
  .d-main:has(.pane-main.has-rail) .ai-handle { margin-right: 6px; }
  .pane-main.has-rail .top-down { right: 14px; }
  .pane-main.has-rail .here-bar { right: 8px; }
  .sec-panel { right: 8px; }
  /* small buttons in the title bar and the reading tools */
  .d-head { gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .d-actions { gap: 4px; }
  .d-actions .icon-btn { width: 32px; height: 32px; border-radius: 8px; }
  .d-actions .icon-btn svg { width: 16px; height: 16px; }
  .d-actions .back-btn { height: 32px; padding: 0 9px; }
  .d-actions .dd-btn { height: 30px; max-width: 150px; padding: 0 7px; font-size: 11.5px; gap: 4px; }
  .d-tools { gap: 4px; padding: 5px 8px; }
  .d-tools .tool-btn { height: 28px; min-width: 28px; padding: 0 8px; font-size: 11.5px; gap: 4px; }
  .d-tools .tool-btn svg { width: 15px; height: 15px; }
  .d-tools .tool-group { padding: 1px; }
  .d-tools .refine { height: 28px; }
  .d-tools .refine input { font-size: 12px; }
  .d-tools .dd-btn { height: 28px; font-size: 11.5px; }
}

/* home page footer: a slim line, the address and email, then the price in big type */
.foot-hr { width: min(720px, 100%); height: 0; margin: 14px auto 12px; border: 0; border-top: 1px solid var(--line); }
.foot-addr { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.foot-addr b { color: var(--ink); font-weight: 700; }
.foot-addr a { color: #1d4ed8; font-weight: 600; text-decoration: none; }
.foot-addr a:hover { text-decoration: underline; }
.foot-sep { margin: 0 8px; color: var(--muted); }
.foot-price { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 8px; margin: 8px 0 0; color: var(--ink); }
.fp-label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.fp-amount { font: 800 19px/1.2 var(--serif, Georgia, serif); color: #1d4ed8; letter-spacing: .01em; }
.fp-term { font-size: 13.5px; font-weight: 700; color: #b45309; }
html[data-theme="dark"] .fp-amount, html[data-theme="dark"] .foot-addr a { color: #93c5fd; }
html[data-theme="dark"] .fp-term { color: #fbbf24; }
@media (max-width: 640px) { .foot-sep { display: none; } .foot-addr span.foot-sep + b { display: inline-block; } .fp-amount { font-size: 17px; } }

/* phones: the search box — smaller text, and small Search / Clear buttons on a line below it, on the right */
@media (max-width: 640px) {
  .searchbar { flex-wrap: wrap; gap: 6px; padding: 6px 8px 8px; border-radius: 14px; }
  .searchbar .search-icon { width: 18px; height: 18px; }
  .searchbar input { flex: 1 1 calc(100% - 34px); padding: 7px 4px; font-size: 14px; }
  .searchbar input::placeholder { font-size: 13px; }
  .searchbar #searchBtn { margin-left: auto; }
  .searchbar #searchBtn, .searchbar .clear-btn { height: 32px; min-height: 0; padding: 0 14px; border-radius: 9px; font-size: 13px; }
}

/* Bookmarks / History / Saved Results: in the top bar on computers; on phones on their own line below it, on the right */
.lib-row { display: none; }
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; height: auto; min-height: 56px; row-gap: 0; }
  .topbar-inner > .brand, .topbar-inner > .topbar-right { min-height: 56px; }
  .topbar-right > .lib-nav { display: none; }
  .lib-row { display: flex; flex: 1 0 100%; justify-content: flex-end; gap: 6px; padding: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
  .lib-row::-webkit-scrollbar { display: none; }
  .lib-row .lib-btn { flex: none; padding: 5px 10px; font-size: 12px; }
  .lib-row .lib-btn span { display: inline !important; }
  .lib-row .lib-btn svg { width: 15px; height: 15px; }
  .side { top: 104px; max-height: calc(100vh - 120px); }
}

/* ‹ › on the search types row when it scrolls sideways (narrow windows and phones) */
.court-scroll[hidden] { display: none !important; }
.search-type .st-scroll { align-self: center; }
@media (min-width: 1100px) { .search-type .st-scroll { display: none !important; } }

/* the outcome on a result card, when its headnote states it */
.tag-out { padding: 2px 8px; border: 1px solid; border-radius: 999px; font: 700 10.5px/1.5 var(--sans); letter-spacing: .02em; }
.tag-out.o-allowed { background: #dcfce7; border-color: #86efac; color: #14532d; }
.tag-out.o-dismissed { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.tag-out.o-partly { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.tag-out.o-disposed { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }

/* phones: no Refine box in the judgment window */
@media (max-width: 760px) { #refineForm { display: none !important; } }

/* Print, next to PDF: the same shape (icon + "Print"), in the app blue */
.print-btn { display: inline-flex; align-items: center; width: auto; gap: 5px; padding: 0 11px; font-size: 12.5px; font-weight: 700; color: #1d4ed8; border-color: color-mix(in srgb, #1d4ed8 30%, var(--line)); }
.print-btn:hover { color: #1d4ed8; background: color-mix(in srgb, #1d4ed8 8%, var(--surface)); }
@media (max-width: 640px) { .d-actions .print-btn { width: auto; padding: 0 9px; } }


/* phones: the text size (A− 14 A+ Aa) at the top, right of Back (app.js moves it); its Aa settings open as a sheet */
.d-actions .size-top { display: inline-flex; align-items: center; height: 32px; padding: 1px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.d-actions .size-top .tool-btn { height: 28px; min-width: 26px; padding: 0 6px; font-size: 11.5px; gap: 3px; border: 0; background: none; }
.d-actions .size-top .tool-val { min-width: 20px; text-align: center; font-size: 12px; }
.d-actions .size-top .pop { position: fixed; z-index: 70; top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 60vh; overflow: auto; }
/* phones: room for the text size beside Back — the language button shows only its icon (the list still opens),
   and the size buttons are a little tighter */
@media (max-width: 760px) {
  .d-actions .lang-wrap .dd-btn { max-width: none; width: auto; padding: 0 5px; gap: 2px; }
  .d-actions .lang-wrap .dd-label { display: none; }
  .d-actions .size-top .tool-btn { min-width: 22px; padding: 0 4px; }
  .d-actions .size-top .tool-val { min-width: 18px; }
}

/* ⚖ Conflicting views: animated like AI Search — a moving blue gradient, a light sweep, and the scales swinging */
#conflictBtn { position: relative; overflow: hidden; border: 1px solid #1e3a8a; color: #fff; background: #1e40af linear-gradient(120deg, #1e3a8a, #2563eb, #4f46e5, #1e3a8a); background-size: 300% 100%; box-shadow: 0 4px 14px rgba(37, 99, 235, .35); animation: aifShift 6s ease infinite; transition: transform .15s, box-shadow .2s; }
#conflictBtn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-120%); animation: aifShine 3.2s ease-in-out infinite; pointer-events: none; }
#conflictBtn svg { stroke: #fde68a; transform-origin: 50% 20%; animation: cvSwing 2.4s ease-in-out infinite; }
#conflictBtn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(37, 99, 235, .45); }
#conflictBtn:active { transform: scale(.97); }
@keyframes cvSwing { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
@media (prefers-reduced-motion: reduce) { #conflictBtn, #conflictBtn::after, #conflictBtn svg { animation: none; } }


/* ▶ Video Tutorial: the button next to the logo, and its player */
.vt-btn { display: inline-flex; align-items: center; gap: 7px; margin-left: 14px; padding: 6px 13px 6px 9px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; font: 700 13px var(--sans); cursor: pointer; white-space: nowrap; box-shadow: 0 6px 16px -8px rgba(185, 28, 28, .8); transition: transform .15s, box-shadow .15s; }
.vt-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 20px -8px rgba(185, 28, 28, .9); }
.vt-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.vt-btn svg path { fill: #fff; stroke: none; }
.vt-dlg { width: min(1000px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 16px; background: #0b0e14; color: #fff; box-shadow: var(--shadow-lg); overflow: hidden; }
.vt-dlg::backdrop { background: rgba(5, 8, 14, .78); }
.vt-dlg[open] { animation: vtIn .2s ease-out; }
@keyframes vtIn { from { opacity: 0; transform: scale(.97); } }
.vt-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; background: #111827; }
.vt-head h2 { flex: 1; margin: 0; font: 700 15px var(--sans); color: #fff; }
.vt-head small { margin-left: 6px; font-weight: 500; color: #9ca3af; }
.vt-x { width: 34px; height: 34px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.vt-x:hover { background: #dc2626; }
.vt-dlg video { display: block; width: 100%; max-height: calc(100vh - 120px); background: #000; }
.vt-err { padding: 40px 20px; text-align: center; color: #fca5a5; font: 600 15px var(--sans); }
@media (max-width: 760px) {
  .vt-btn { margin-left: 8px; padding: 6px 8px; }
  .vt-btn span { display: none; }
  .vt-head small { display: none; }
}

/* 📰 Legal News: the button next to Video Tutorial, and the news window. Each court type has its own colour (--k). */
.nw-btn { display: inline-flex; align-items: center; gap: 7px; margin-left: 8px; margin-right: auto; padding: 6px 13px 6px 9px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font: 700 13px var(--sans); cursor: pointer; white-space: nowrap; box-shadow: 0 6px 16px -8px rgba(29, 78, 216, .8); transition: transform .15s, box-shadow .15s; }
.nw-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 20px -8px rgba(29, 78, 216, .9); }
.nw-btn { position: relative; }
.nw-count { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border: 2px solid var(--surface); border-radius: 999px; background: #dc2626; color: #fff; font: 800 10.5px/15px var(--sans); text-align: center; box-shadow: 0 3px 8px -2px rgba(220, 38, 38, .7); animation: nwPop .35s ease-out; }
@keyframes nwPop { from { transform: scale(.3); } 70% { transform: scale(1.15); } }
.nw-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* a window of its own over the whole app (not a popup); the page behind does not scroll */
.nw-dlg { --k: #475569; position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: var(--surface-2); color: var(--ink); animation: nwIn .22s ease-out; }
.nw-dlg[hidden] { display: none; }
@keyframes nwIn { from { opacity: 0; transform: translateY(14px); } }
html.nw-on, html.nw-on body { overflow: hidden; }
.nw-back { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 4px; flex: none; align-self: center; height: 38px; padding: 0 14px 0 9px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .16); color: #fff; font: 700 13.5px var(--sans); cursor: pointer; }
.nw-back:hover { background: rgba(255, 255, 255, .28); }
.nw-back svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nw-head { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 18px max(20px, calc((100% - 980px) / 2)) 16px; background: linear-gradient(120deg, #0f1f3d 0%, #1d4ed8 55%, #7c3aed 100%); color: #fff; overflow: hidden; }
.nw-head::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%); pointer-events: none; }
.nw-logo { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 13px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.nw-logo svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.nw-htext { flex: 1; min-width: 0; }
.nw-head h2 { margin: 0; font: 700 23px/1.15 var(--serif); letter-spacing: .01em; color: #fff; }
.nw-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nw-stats > span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); font: 500 12px var(--sans); color: #fff; }
.nw-stats b { font-weight: 800; }
.nw-writing { background: rgba(250, 204, 21, .22) !important; }
.nw-x { position: relative; z-index: 1; width: 36px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.nw-x:hover { background: #dc2626; }
.nw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 12px max(20px, calc((100% - 980px) / 2)); border-bottom: 1px solid var(--line); background: var(--surface); }
.nw-chip { --c: #475569; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 12.5px var(--sans); cursor: pointer; transition: background .15s, border-color .15s; }
.nw-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.nw-chip b { padding: 0 7px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 11.5px; color: var(--muted); }
.nw-chip:hover { border-color: var(--c); }
.nw-chip[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.nw-chip[aria-pressed="true"] i { background: #fff; }
.nw-chip[aria-pressed="true"] b { background: rgba(255, 255, 255, .22); color: #fff; }
.nw-chip.g-all { --c: #1d4ed8; }
.nw-chip.g-sc, .nw-art.k-sc { --c: #b91c1c; --k: #b91c1c; }
.nw-chip.g-hc, .nw-art.k-hc { --c: #1d4ed8; --k: #1d4ed8; }
.nw-chip.g-tribunal, .nw-art.k-tribunal { --c: #7c3aed; --k: #7c3aed; }
.nw-chip.g-consumer, .nw-art.k-consumer { --c: #0d9488; --k: #0d9488; }
.nw-q { flex: 1 1 200px; min-width: 0; margin-left: auto; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink); font: 13px var(--sans); }
.nw-q:focus { outline: 2px solid #1d4ed8; outline-offset: 1px; }
.nw-list { flex: 1; overflow-y: auto; padding: 18px max(20px, calc((100% - 980px) / 2)) 30px; overscroll-behavior: contain; background: var(--surface-2); }
.nw-art { position: relative; margin-bottom: 14px; padding: 16px 18px 14px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 10px -6px rgba(0, 0, 0, .18); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.nw-art::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--k); }
.nw-art:hover { box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .35); }
.nw-art.top { padding-top: 34px; background: linear-gradient(160deg, rgba(29, 78, 216, .09), transparent 55%), var(--surface); border-color: rgba(29, 78, 216, .35); }
.nw-top { position: absolute; top: 0; left: 0; padding: 4px 14px 4px 18px; border-bottom-right-radius: 12px; background: linear-gradient(90deg, #f59e0b, #ef4444); color: #fff; font: 800 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.nw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 600 11.5px var(--sans); color: var(--muted); }
.nw-court { padding: 3px 9px; border-radius: 6px; background: var(--k); color: #fff; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 10.5px; }
.nw-out { padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.nw-out.ok { background: rgba(22, 163, 74, .15); color: #16a34a; }
.nw-out.no { background: rgba(220, 38, 38, .13); color: #dc2626; }
.nw-out.part { background: rgba(234, 88, 12, .14); color: #ea580c; }
.nw-out.mid { background: rgba(71, 85, 105, .14); color: var(--muted); }
.nw-when { margin-left: auto; }
.nw-art h3 { margin: 9px 0 5px; font: 700 19px/1.4 var(--serif); color: var(--ink); cursor: pointer; }
.nw-art.top h3 { font-size: 21px; }
.nw-art h3:hover { color: var(--k); }
.nw-party { margin: 0 0 2px; font: 600 13px var(--sans); color: var(--muted); }
.nw-party span { color: var(--k); }
.nw-bench { margin: 0 0 8px; font: italic 13px var(--serif); color: var(--muted); }
.nw-sum { margin: 8px 0 4px; font: 15.5px/1.65 var(--serif); color: var(--ink); cursor: pointer; }
.nw-body { display: none; }
.nw-art.open .nw-body { display: grid; gap: 10px; margin-top: 12px; animation: vtIn .2s ease-out; }
.nw-sec { --s: #475569; padding: 11px 14px 10px; border-radius: 11px; background: rgba(71, 85, 105, .06); border-left: 3px solid var(--s); }
.nw-sec h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 5px; font: 800 11.5px var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--s); }
.nw-sec h4 svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.nw-sec p { margin: 0; font: 15px/1.65 var(--serif); color: var(--ink); }
.s-facts { --s: #d97706; background: rgba(217, 119, 6, .07); }
.s-issue { --s: #2563eb; background: rgba(37, 99, 235, .07); }
.s-args { --s: #4f46e5; background: rgba(79, 70, 229, .06); }
.s-reason { --s: #0f766e; background: rgba(15, 118, 110, .07); }
.s-held { --s: #16a34a; background: rgba(22, 163, 74, .08); }
.s-impact { --s: #c026d3; background: linear-gradient(90deg, rgba(192, 38, 211, .1), rgba(234, 88, 12, .06)); }
.s-points { --s: #0369a1; background: rgba(3, 105, 161, .06); }
.s-law { --s: #9333ea; background: rgba(147, 51, 234, .06); }
.nw-args { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nw-side { padding: 9px 11px; border-radius: 9px; background: var(--surface); }
.nw-side b { display: block; margin-bottom: 3px; font: 700 12px var(--sans); }
.nw-side.pet b { color: #4f46e5; }
.nw-side.res b { color: #e11d48; }
.nw-side p { font-size: 14.5px; }
.nw-quote { position: relative; margin: 2px 0; padding: 14px 18px 14px 52px; border-radius: 12px; background: linear-gradient(120deg, rgba(124, 58, 237, .12), rgba(37, 99, 235, .08)); font: italic 16.5px/1.6 var(--serif); color: var(--ink); }
.nw-quote::before { content: "\201C"; position: absolute; left: 14px; top: 2px; font: 700 48px/1 var(--serif); color: #7c3aed; }
.nw-sec ol { margin: 0; padding: 0; list-style: none; counter-reset: p; }
.nw-sec ol li { position: relative; margin: 5px 0; padding-left: 32px; font: 14.5px/1.55 var(--serif); counter-increment: p; }
.nw-sec ol li::before { content: counter(p); position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #0369a1; color: #fff; font: 700 11.5px var(--sans); }
.nw-provs { display: flex; flex-wrap: wrap; gap: 6px; }
.nw-provs span { padding: 4px 10px; border-radius: 7px; background: rgba(147, 51, 234, .13); color: #9333ea; font: 700 12px var(--sans); }
.nw-precs { margin: 8px 0 0; padding-left: 20px; font: italic 14px/1.55 var(--serif); }
.nw-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line); }
.nw-tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.nw-tag { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); font: 600 11.5px var(--sans); color: var(--k); }
.nw-acts { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nw-toggle { padding: 7px 13px; border: 1px solid var(--k); border-radius: 9px; background: transparent; color: var(--k); font: 700 12.5px var(--sans); cursor: pointer; white-space: nowrap; }
.nw-toggle:hover { background: var(--k); color: #fff; }
.nw-read { padding: 8px 15px; border: 0; border-radius: 9px; background: linear-gradient(135deg, var(--k), #1e293b); color: #fff; font: 700 12.5px var(--sans); cursor: pointer; white-space: nowrap; box-shadow: 0 6px 14px -8px var(--k); }
.nw-read:hover { filter: brightness(1.12); }
.nw-more { display: block; margin: 6px auto 0; padding: 9px 24px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #1d4ed8, #7c3aed); color: #fff; font: 700 13px var(--sans); cursor: pointer; }
.nw-empty { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 60px 10px; text-align: center; color: var(--muted); font: 15px/1.6 var(--sans); }
.nw-spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: nwSpin .8s linear infinite; }
@keyframes nwSpin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .nw-btn { margin-left: 6px; padding: 6px 12px; font-size: 12.5px; }
  .nw-btn svg { display: none; }
  .nw-back { height: 34px; padding: 0 10px 0 6px; }
  .nw-back span { display: none; }
  .nw-head { padding: 14px 12px 12px 14px; gap: 10px; }
  .nw-logo { width: 38px; height: 38px; }
  .nw-head h2 { font-size: 20px; }
  .nw-tools { flex-wrap: nowrap; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; }
  .nw-tools::-webkit-scrollbar { display: none; }
  .nw-chip { flex: none; }
  .nw-q { flex: 0 0 170px; }
  .nw-list { padding: 12px 10px 18px; }
  .nw-art { padding: 14px 13px 12px 16px; }
  .nw-art.top { padding-top: 32px; }
  .nw-art h3, .nw-art.top h3 { font-size: 17px; }
  .nw-sum, .nw-sec p { font-size: 14.5px; }
  .nw-args { grid-template-columns: 1fr; }
  .nw-when { margin-left: 0; }
  /* phones: Read full story and Read full judgment side by side */
  .nw-acts { width: 100%; }
  .nw-toggle, .nw-read { flex: 1 1 0; min-width: 0; height: 42px; margin-left: 0; padding: 0 8px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .nw-dlg, .nw-art.open .nw-body { animation: none; } .nw-spin { animation-duration: 2s; } }

/* 📰 the news ticker under the top bar: PC, laptop and tablet only */
.nw-tick { display: flex; align-items: center; height: 32px; margin: -12px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: 0 4px 14px -10px rgba(0, 0, 0, .35); overflow: hidden; }
.nw-tick[hidden] { display: none; }
.nw-tk-label { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 100%; padding: 0 14px 0 12px; border: 0; background: linear-gradient(120deg, #1d4ed8, #7c3aed); color: #fff; font: 800 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.nw-tk-dot { width: 7px; height: 7px; border-radius: 50%; background: #f87171; box-shadow: 0 0 0 0 rgba(248, 113, 113, .8); animation: nwLive 1.6s infinite; }
@keyframes nwLive { 70% { box-shadow: 0 0 0 7px rgba(248, 113, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); } }
.nw-tk-track { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.nw-tk-run { display: flex; align-items: center; flex: none; padding-right: 18px; will-change: transform; } /* moved by app.js */
@keyframes nwTick { to { transform: translateX(-100%); } }
.nw-tk-item { --k: #475569; display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 0 4px; border: 0; background: none; color: var(--ink); font: 600 13px var(--sans); white-space: nowrap; cursor: pointer; }
.nw-tk-item i { width: 7px; height: 7px; border-radius: 2px; background: var(--k); }
.nw-tk-item:hover { color: var(--k); text-decoration: underline; text-underline-offset: 3px; }
.nw-tk-item.k-sc { --k: #b91c1c; }
.nw-tk-item.k-hc { --k: #1d4ed8; }
.nw-tk-item.k-tribunal { --k: #7c3aed; }
.nw-tk-item.k-consumer { --k: #0d9488; }
.nw-tk-sep { flex: none; margin: 0 14px; font-size: 8px; color: var(--muted); opacity: .6; }
.nw-tk-x { flex: none; width: 32px; height: 100%; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.nw-tk-x:hover { background: #dc2626; color: #fff; }
/* phones: a shorter label and smaller text */
@media (max-width: 760px) {
  .nw-tick { height: 30px; margin: -14px 0 10px; }
  .nw-tk-label { padding: 0 11px; gap: 0; font-size: 0; letter-spacing: 0; } /* only the red dot: the words "Latest News" take too much room */
  .nw-tk-item { font-size: 12.5px; }
  .nw-tk-x { width: 28px; }
}
@media (prefers-reduced-motion: reduce) { .nw-tk-run { animation-duration: 240s; } .nw-tk-dot { animation: none; } }

/* lighter top buttons (Video Tutorial, News, the Latest News label) and the chosen search type in the same light
   blue as Citation Search, marked by a stronger blue border */
.vt-btn { background: #fee2e2; border: 1px solid #fca5a5; color: #b91c1c; box-shadow: none; }
.vt-btn:hover { background: #fecaca; box-shadow: 0 6px 14px -8px rgba(220, 38, 38, .45); }
.vt-btn svg { stroke: #dc2626; }
.vt-btn svg path { fill: #dc2626; }
.nw-btn { background: #dbeafe; border: 1px solid #93c5fd; color: #1d4ed8; box-shadow: none; }
.nw-btn:hover { background: #bfdbfe; box-shadow: 0 6px 14px -8px rgba(29, 78, 216, .45); }
.nw-btn svg { stroke: #1d4ed8; }
.nw-tk-label { background: #eff6ff; color: #1d4ed8; border-right: 1px solid #bfdbfe; }
.st-seg > label > input:checked + span {
  background: #dbeafe;
  background-image: none;
  border-color: #2563eb;
  color: #1e3a8a;
  box-shadow: 0 0 0 1px #2563eb inset;
}
.st-seg > label > input:checked + span svg { stroke: #1d4ed8; }
html[data-theme="dark"] .vt-btn { background: #450a0a; border-color: #b91c1c; color: #fecaca; }
html[data-theme="dark"] .vt-btn svg { stroke: #fca5a5; }
html[data-theme="dark"] .vt-btn svg path { fill: #fca5a5; }
html[data-theme="dark"] .nw-btn, html[data-theme="dark"] .nw-tk-label { background: #172554; border-color: #1d4ed8; color: #dbeafe; }
html[data-theme="dark"] .nw-btn svg { stroke: #93c5fd; }
html[data-theme="dark"] .st-seg > label > input:checked + span { background: #1e3a8a; border-color: #60a5fa; color: #ffffff; box-shadow: 0 0 0 1px #60a5fa inset; }
html[data-theme="dark"] .st-seg > label > input:checked + span svg { stroke: #bfdbfe; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .vt-btn { background: #450a0a; border-color: #b91c1c; color: #fecaca; }
  html:not([data-theme="light"]) .vt-btn svg { stroke: #fca5a5; }
  html:not([data-theme="light"]) .vt-btn svg path { fill: #fca5a5; }
  html:not([data-theme="light"]) .nw-btn, html:not([data-theme="light"]) .nw-tk-label { background: #172554; border-color: #1d4ed8; color: #dbeafe; }
  html:not([data-theme="light"]) .nw-btn svg { stroke: #93c5fd; }
  html:not([data-theme="light"]) .st-seg > label > input:checked + span { background: #1e3a8a; border-color: #60a5fa; color: #ffffff; box-shadow: 0 0 0 1px #60a5fa inset; }
  html:not([data-theme="light"]) .st-seg > label > input:checked + span svg { stroke: #bfdbfe; }
}
/* ☰ before the logo opens the search options drawer (where the panel is a drawer); replaces the "Search options" button */
.menu-btn { display: none; place-items: center; flex: none; width: 38px; height: 38px; margin-right: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.menu-btn:hover { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }
@media (max-width: 960px) {
  .menu-btn { display: inline-grid; }
  .side-open { display: none !important; }
}
/* phones: no "Read headnote" button on the result cards */
@media (max-width: 760px) { [data-headnote] { display: none !important; } }

/* top bar chips: when the window is too narrow they scroll sideways (‹ › appear), so none is cut off */
.topbar-inner { min-width: 0; gap: 8px; }
.topbar-right { min-width: 0; flex: 0 1 auto; }
.lib-nav { min-width: 0; flex: 0 1 auto; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 3px 2px; }
.lib-nav::-webkit-scrollbar { display: none; }
.lib-nav > .lib-btn { flex: none; }
.lib-btn .lib-count { flex: none; }
.topbar-right > *:not(.lib-nav):not(.nav-scroll) { flex: none; }
.nav-scroll { width: 28px; height: 28px; }
.nav-scroll svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* narrower screens (up to 1400px): Bookmarks, History, Bare Acts, Saved Results on their own row under the top bar,
   so none is squeezed or cut; ‹ › when even that row does not fit */
.lib-rowbox { display: none; }
@media (max-width: 1400px) {
  .topbar-inner { flex-wrap: wrap; height: auto; min-height: 60px; row-gap: 0; }
  .topbar-inner > .brand, .topbar-inner > .topbar-right { min-height: 56px; }
  .topbar-right > .lib-nav, .topbar-right > .nav-scroll { display: none !important; }
  .lib-rowbox { display: flex; flex: 1 0 100%; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; padding: 0 0 8px; }
  .lib-rowbox .lib-row { display: flex; flex: 0 1 auto; min-width: 0; justify-content: flex-start; gap: 6px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
  .lib-rowbox .lib-row::-webkit-scrollbar { display: none; }
  .lib-rowbox .lib-row .lib-btn { flex: none; }
  .lib-rowbox .lib-row .lib-btn span { display: inline !important; }
}
@media (max-width: 760px) { .lib-rowbox .lib-row .lib-btn { padding: 5px 10px; font-size: 12px; } }

/* computers and laptops: the news in two columns (the top story, and a story opened in full, across both) */
@media (min-width: 1100px) {
  .nw-head { padding-left: max(20px, calc((100% - 1320px) / 2)); padding-right: max(20px, calc((100% - 1320px) / 2)); }
  .nw-tools { padding-left: max(20px, calc((100% - 1320px) / 2)); padding-right: max(20px, calc((100% - 1320px) / 2)); }
  .nw-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 14px; align-content: start; align-items: start;
    padding-left: max(20px, calc((100% - 1320px) / 2)); padding-right: max(20px, calc((100% - 1320px) / 2)); }
  .nw-list > .nw-art { margin-bottom: 0; }
  .nw-list > .nw-art.top, .nw-list > .nw-art.open, .nw-list > .nw-more, .nw-list > .nw-empty { grid-column: 1 / -1; }
}

/* 📰 News in the Magazine style: a big top story across the page, then a grid of smaller cards, each with a coloured
   band on top for its court (red Supreme Court, blue High Courts, purple tribunals, teal consumer); a story opened in
   full goes across the page */
.nw-art { padding-top: 18px; padding-left: 18px; border-radius: 12px; }
.nw-art::before { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 4px; }
.nw-art.top::before { height: 5px; background: linear-gradient(90deg, #f59e0b, #ef4444, var(--k)); }
.nw-art.top { padding: 38px 26px 18px; background: linear-gradient(160deg, rgba(245, 158, 11, .08), transparent 45%), var(--surface); border-color: rgba(245, 158, 11, .45); }
.nw-art.top .nw-top { top: 5px; border-top-left-radius: 0; }
.nw-art.top h3 { font-size: 26px; line-height: 1.3; }
.nw-art.top .nw-sum { font-size: 16.5px; }
.nw-art:not(.top):not(.open) h3 { font-size: 17px; line-height: 1.35; }
.nw-art:not(.top):not(.open) .nw-sum { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 14.5px; }
.nw-art:not(.top):not(.open) .nw-tags { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.nw-art:not(.top):not(.open) { display: flex; flex-direction: column; }
.nw-art:not(.top):not(.open) .nw-foot { margin-top: auto; }
.nw-art:not(.top):not(.open) .nw-acts { width: 100%; margin-left: 0; }
.nw-art:not(.top):not(.open) .nw-toggle, .nw-art:not(.top):not(.open) .nw-read { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; font-size: 12px; }
.nw-art:hover { transform: translateY(-2px); }
@media (min-width: 761px) and (max-width: 1099px) {
  .nw-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 12px; align-content: start; align-items: stretch; }
  .nw-list > .nw-art { margin-bottom: 0; }
  .nw-list > .nw-art.top, .nw-list > .nw-art.open, .nw-list > .nw-more, .nw-list > .nw-empty { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .nw-list { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
}
@media (max-width: 760px) {
  .nw-art.top { padding: 34px 14px 14px; }
  .nw-art.top h3 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .nw-art:hover { transform: none; } }

/* News: more stories load by themselves at the end of the list */
.nw-list > .nw-loading { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 8px auto 0; padding: 18px; border: 0; border-radius: 0; background: none; color: var(--muted); font: 600 13.5px var(--sans); cursor: default; }
.nw-end { grid-column: 1 / -1; margin: 10px 0 0; text-align: center; font: 600 12.5px var(--sans); color: var(--muted); }

/* News: a story opened in a popup over the list */
.nw-story { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 16px; background: transparent; overflow: auto; overscroll-behavior: contain; }
.nw-story::backdrop { background: rgba(5, 8, 14, .6); }
.nw-story[open] { animation: vtIn .2s ease-out; }
.nw-story .nw-art { margin: 0; border-radius: 16px; padding: 28px 30px 20px; transform: none !important; }
.nw-story .nw-art h3 { font-size: 24px; line-height: 1.3; padding-right: 30px; }
.nw-story .nw-art .nw-sum { display: block; -webkit-line-clamp: unset; font-size: 16px; }
.nw-story .nw-art .nw-tags { display: flex; -webkit-line-clamp: unset; }
.nw-story .nw-art .nw-acts { width: auto; margin-left: auto; }
.nw-story .nw-art .nw-read { flex: none; padding: 9px 18px; font-size: 13.5px; }
.nw-sx { position: sticky; top: 10px; float: right; z-index: 2; margin: 10px 10px -46px 0; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px -3px rgba(0, 0, 0, .3); }
.nw-sx:hover { background: #dc2626; color: #fff; }
@media (max-width: 760px) {
  .nw-story { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .nw-story .nw-art { border-radius: 0; padding: 22px 16px 16px; min-height: 100%; }
  .nw-story .nw-art h3 { font-size: 20px; }
}
