:root {
  color-scheme: dark;
  --bg: #08131d;
  --bg-elevated: #0d1b27;
  --surface: #102230;
  --surface-2: #142a39;
  --surface-3: #193343;
  --surface-soft: rgba(255,255,255,.045);
  --border: rgba(203, 220, 231, .13);
  --border-strong: rgba(203, 220, 231, .22);
  --text: #f1f5f7;
  --muted: #91a5b2;
  --muted-2: #6f8593;
  --nav-text: #b6c5ce;
  --gold: #d4b36d;
  --gold-bright: #efd18d;
  --gold-soft: rgba(212, 179, 109, .13);
  --blue: #6db5d6;
  --green: #58c49a;
  --red: #e17878;
  --violet: #9c8ee8;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
  --sidebar-width: 282px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --font: "Noto Sans Arabic", "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f3;
  --bg-elevated: #f6f8f8;
  --surface: #ffffff;
  --surface-2: #f4f7f7;
  --surface-3: #e8eff1;
  --surface-soft: rgba(13, 38, 53, .045);
  --border: rgba(20, 46, 61, .12);
  --border-strong: rgba(20, 46, 61, .2);
  --text: #102634;
  --muted: #5f7480;
  --muted-2: #81919a;
  --nav-text: #59707d;
  --gold: #9b762f;
  --gold-bright: #795816;
  --gold-soft: rgba(155, 118, 47, .1);
  --blue: #347f9f;
  --green: #258561;
  --red: #ba5353;
  --violet: #685ab3;
  --shadow: 0 16px 42px rgba(30, 50, 62, .1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, select, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip-link {
  position: fixed;
  z-index: 1000;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  translate: 0 -180%;
  background: var(--gold);
  color: #09141d;
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  font-weight: 800;
}
.skip-link:focus { translate: 0; }
.sr-only, .skip-link:not(:focus) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 0 0 auto;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  background:
    radial-gradient(circle at 85% 8%, rgba(212,179,109,.09), transparent 22%),
    linear-gradient(180deg, #0b1b28 0%, #091721 100%);
  border-inline-start: 1px solid rgba(255,255,255,.07);
  color: #eef4f6;
  overflow-y: auto;
  scrollbar-width: thin;
}

html[data-theme="light"] .sidebar {
  background:
    radial-gradient(circle at 85% 8%, rgba(212,179,109,.08), transparent 22%),
    linear-gradient(180deg, #102938 0%, #0c202d 100%);
}

.brand-block { display: flex; align-items: center; gap: 12px; padding: 2px 8px 17px; }
.brand-home { width: 100%; border: 0; background: transparent; color: inherit; text-align: start; cursor: pointer; }
.brand-home:hover .brand-mark { border-color: rgba(239,209,141,.65); transform: translateY(-1px); }
.brand-mark { transition: .18s ease; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(239,209,141,.4);
  border-radius: 15px 15px 7px 15px;
  background: linear-gradient(145deg, rgba(212,179,109,.2), rgba(212,179,109,.055));
  color: var(--gold-bright);
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 12px 30px rgba(0,0,0,.14);
}
.brand-mark svg { width: 31px; height: 31px; stroke-width: 1.7; }
.brand-block > div:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.brand-name { font-size: 1.55rem; letter-spacing: .04em; color: #fff; }
.brand-subtitle { font-size: .75rem; color: #91a5b2; }

.environment-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 8px 23px;
  padding: 6px 10px;
  border: 1px solid rgba(88,196,154,.18);
  border-radius: 999px;
  background: rgba(88,196,154,.075);
  color: #a9dbc7;
  font-size: .76rem;
  font-weight: 700;
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #58c49a; box-shadow: 0 0 0 4px rgba(88,196,154,.1); }

.side-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-label { margin: 14px 11px 6px; color: #647d8b; font-size: .72rem; font-weight: 800; letter-spacing: .05em; }
.nav-item {
  width: 100%;
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #aebfc8;
  text-align: right;
  font-size: .9rem;
  transition: .18s ease;
}
.nav-item svg { width: 20px; height: 20px; color: #728c99; }
.nav-item span:nth-of-type(1) { flex: 1; }
.nav-item kbd, .nav-count {
  min-width: 25px;
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  background: rgba(255,255,255,.045);
  color: #78909d;
  font: 600 .65rem/1.4 var(--font);
  text-align: center;
}
.nav-new { padding: 2px 7px; border: 1px solid rgba(88,196,154,.2); border-radius: 999px; background: rgba(88,196,154,.09); color: #8dd8ba; font-size: .57rem; font-weight: 850; }
.nav-item:hover { background: rgba(255,255,255,.045); color: #fff; }
.nav-item.active {
  border-color: rgba(212,179,109,.16);
  background: linear-gradient(90deg, rgba(212,179,109,.04), rgba(212,179,109,.12));
  color: #fff;
  box-shadow: inset -3px 0 var(--gold);
}
.nav-item.active svg { color: var(--gold-bright); }

.sidebar-footer { margin-top: auto; padding-top: 28px; }
.security-note {
  display: flex;
  gap: 9px;
  margin: 0 4px 12px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.security-note svg { flex: 0 0 auto; width: 18px; height: 18px; color: #8ab8ca; }
.security-note div { display: flex; flex-direction: column; line-height: 1.45; }
.security-note strong { font-size: .72rem; color: #d9e4e8; }
.security-note span { font-size: .65rem; color: #78909d; }
.profile-card {
  width: 100%;
  display: grid;
  grid-template-columns: 37px 1fr 20px;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  text-align: right;
}
.profile-card:hover { background: rgba(255,255,255,.06); }
.profile-card .avatar {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-weight: 900;
}
.profile-card > span:nth-child(2) { display: flex; flex-direction: column; line-height: 1.4; }
.profile-card strong { font-size: .78rem; color: #f1f5f7; }
.profile-card small { font-size: .65rem; color: #78909d; }
.profile-card svg { width: 17px; height: 17px; color: #728c99; }

.workspace { min-height: 100vh; margin-inline-start: var(--sidebar-width); display: flex; flex-direction: column; }
.topbar {
  height: 70px;
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 3.1vw, 52px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}
.topbar-start, .topbar-actions { display: flex; align-items: center; gap: 13px; }
.history-controls { display: flex; align-items: center; gap: 5px; padding-inline-end: 12px; border-inline-end: 1px solid var(--border); }
.history-controls .icon-button { width: 34px; height: 34px; }
.history-controls .icon-button:disabled { opacity: .32; cursor: not-allowed; background: transparent; }
.history-controls .icon-button:disabled:hover { border-color: var(--border); color: var(--muted); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.breadcrumbs i { color: var(--muted-2); font-style: normal; }
.breadcrumbs strong { color: var(--text); font-weight: 700; }
.icon-button, .plain-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  transition: .18s ease;
}
.icon-button:hover, .plain-icon:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.icon-button svg, .plain-icon svg { width: 19px; height: 19px; }
.sun-icon { display: none; }
html[data-theme="light"] .sun-icon { display: block; }
html[data-theme="light"] .moon-icon { display: none; }
.notification-button { position: relative; }
.notification-button > span { position: absolute; inset: 7px 7px auto auto; width: 7px; height: 7px; border: 1.5px solid var(--bg); border-radius: 50%; background: var(--gold); }
.system-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-inline: 5px 13px;
  border-inline-end: 1px solid var(--border);
  color: var(--muted);
  font-size: .73rem;
}
.system-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 12%, transparent); }
.mobile-menu { display: none; }

main { width: min(1640px, 100%); flex: 1; margin: 0 auto; padding: 34px clamp(20px, 3.1vw, 52px) 64px; }

.site-footer {
  width: min(1640px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  padding: 18px clamp(20px, 3.1vw, 52px) 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.visitor-counter { display: inline-flex; align-items: center; gap: 11px; }
.visitor-counter-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(212,179,109,.24);
  border-radius: 12px;
  background: var(--gold-soft);
  color: var(--gold-bright);
}
.visitor-counter-icon svg { width: 21px; height: 21px; }
.visitor-counter-copy { display: flex; flex-direction: column; line-height: 1.35; }
.visitor-counter-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; font-weight: 700; }
.visitor-counter-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); transition: .2s ease; }
.visitor-counter[data-state="ready"] .visitor-counter-label i { background: var(--green); box-shadow: 0 0 0 4px rgba(88,196,154,.11); }
.visitor-counter[data-state="error"] .visitor-counter-label i { background: var(--red); }
.visitor-counter-value { display: flex; align-items: baseline; gap: 7px; color: var(--text); }
.visitor-counter-value strong { min-width: 1.2ch; color: var(--gold-bright); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.visitor-counter-value span { font-size: .9rem; font-weight: 800; }
.view { animation: fadeUp .28s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}
.page-heading h1 { margin: 2px 0 4px; font-size: clamp(1.65rem, 2.3vw, 2.35rem); line-height: 1.35; letter-spacing: -.025em; }
.page-heading p { max-width: 730px; margin: 0; color: var(--muted); font-size: .93rem; }
.eyebrow { color: var(--gold); font-size: .72rem; font-weight: 850; letter-spacing: .08em; }
.demo-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}
.demo-badge svg { width: 14px; height: 14px; color: var(--gold); }

.home-hero {
  position: relative;
  isolation: isolate;
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  align-items: center;
  gap: clamp(30px, 5vw, 80px);
  overflow: hidden;
  padding: clamp(32px, 5vw, 68px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 18%, rgba(109,181,214,.13), transparent 28%),
    radial-gradient(circle at 86% 78%, rgba(212,179,109,.15), transparent 32%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface-2) 78%, var(--bg)));
  box-shadow: var(--shadow);
}
.home-hero::after { content: ""; position: absolute; z-index: -1; inset: auto -90px -120px auto; width: 350px; height: 350px; border: 1px solid rgba(212,179,109,.12); border-radius: 50%; box-shadow: 0 0 0 42px rgba(212,179,109,.035), 0 0 0 90px rgba(212,179,109,.02); }
.home-hero-copy h1 { max-width: 780px; margin: 7px 0 12px; font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.25; letter-spacing: -.045em; }
.home-hero-copy > p { max-width: 800px; margin: 0; color: var(--muted); font-size: .96rem; line-height: 1.95; }
.home-search { max-width: 820px; min-height: 61px; display: grid; grid-template-columns: 27px minmax(0,1fr) auto; align-items: center; gap: 10px; margin-top: 24px; padding: 7px 9px 7px 15px; border: 1px solid color-mix(in srgb, var(--gold) 34%, var(--border)); border-radius: 15px; background: color-mix(in srgb, var(--bg-elevated) 88%, transparent); box-shadow: 0 14px 34px rgba(0,0,0,.14); }
.home-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft), 0 14px 34px rgba(0,0,0,.14); }
.home-search > svg { width: 21px; color: var(--gold); }
.home-search input { min-width: 0; height: 42px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .85rem; }
.home-search input::placeholder { color: var(--muted-2); }
.home-search button { height: 45px; padding: 0 20px; border: 0; border-radius: 10px; background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #13212a; font-size: .78rem; font-weight: 850; }
.home-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.home-actions .primary-button svg { transform: scaleX(-1); }
.home-index-card { align-self: stretch; min-height: 285px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 26px; border: 1px solid rgba(212,179,109,.2); border-radius: 20px; background: rgba(7,18,27,.45); text-align: center; backdrop-filter: blur(10px); }
html[data-theme="light"] .home-index-card { background: rgba(255,255,255,.58); }
.index-seal { width: 66px; height: 66px; display: grid; place-items: center; margin-bottom: 12px; border: 1px solid rgba(212,179,109,.32); border-radius: 19px 19px 8px 19px; background: var(--gold-soft); color: var(--gold); }
.index-seal svg { width: 40px; height: 40px; }
.home-index-card > span { color: var(--muted); font-size: .7rem; font-weight: 800; }
.home-index-card > strong { margin-top: 3px; color: var(--gold-bright); font-size: 3.7rem; line-height: 1.1; letter-spacing: -.04em; }
.home-index-card > p { margin: 0 0 17px; color: var(--text); font-size: .78rem; }
.home-index-card > div:last-child { width: 100%; display: grid; gap: 7px; padding-top: 13px; border-top: 1px solid var(--border); text-align: start; }
.home-index-card > div:last-child span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .68rem; }
.home-index-card i { width: 7px; height: 7px; border-radius: 50%; }
.home-index-card b { color: var(--text); }
.court-dot { background: var(--green); }
.demo-dot { background: var(--gold); }
.home-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 34px 2px 15px; }
.home-section-head h2, .home-panel h2 { margin: 2px 0 0; font-size: 1.15rem; }
.home-section-head > button, .home-panel header > button { border: 0; background: transparent; color: var(--gold); font-size: .72rem; font-weight: 850; }
.court-route-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 11px; }
.court-route-grid > button { min-width: 0; min-height: 174px; display: flex; flex-direction: column; align-items: flex-start; padding: 17px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--text); text-align: start; transition: .18s ease; }
.court-route-grid > button:hover { border-color: color-mix(in srgb, var(--gold) 40%, var(--border)); transform: translateY(-3px); box-shadow: var(--shadow); }
.route-icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 10px; }
.route-icon svg { width: 19px; height: 19px; }
.route-icon.red { background: rgba(225,120,120,.09); color: var(--red); }
.route-icon.gold { background: var(--gold-soft); color: var(--gold); }
.route-icon.blue { background: rgba(109,181,214,.09); color: var(--blue); }
.route-icon.violet { background: rgba(156,142,232,.09); color: var(--violet); }
.route-icon.green { background: rgba(88,196,154,.09); color: var(--green); }
.route-icon.teal { background: rgba(93,190,190,.09); color: #64c5c5; }
.court-route-grid strong { font-size: .82rem; }
.court-route-grid small { min-height: 43px; margin-top: 3px; color: var(--muted); font-size: .65rem; line-height: 1.65; }
.court-route-grid b { margin-top: auto; color: var(--gold); font-size: .62rem; }
.home-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(280px,.5fr); gap: 15px; margin-top: 28px; }
.home-panel { overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.home-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.home-panel > header p { margin: 3px 0 0; color: var(--muted); font-size: .68rem; }
.latest-case-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; background: var(--border); }
.latest-case-card { min-height: 165px; display: flex; flex-direction: column; align-items: flex-start; padding: 17px; border: 0; background: var(--surface); color: var(--text); text-align: start; }
.latest-case-card:hover { background: var(--surface-2); }
.latest-case-card > span { display: flex; align-items: center; gap: 6px; color: var(--green); font-size: .61rem; font-weight: 800; }
.latest-case-card > span i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.latest-case-card strong { margin-top: 8px; font-size: .77rem; line-height: 1.75; }
.latest-case-card small { margin-top: 5px; color: var(--muted); font-size: .62rem; }
.latest-case-card b { margin-top: auto; padding-top: 9px; color: var(--gold); font-size: .61rem; }
.trust-panel { padding: 22px; }
.trust-icon { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 17px; border-radius: 13px; background: rgba(88,196,154,.09); color: var(--green); }
.trust-icon svg { width: 24px; }
.trust-panel > p { margin: 7px 0 14px; color: var(--muted); font-size: .72rem; line-height: 1.8; }
.trust-panel ul { display: grid; gap: 8px; margin: 0 0 17px; padding: 0; list-style: none; }
.trust-panel li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .68rem; }
.trust-panel li i { width: 15px; height: 15px; position: relative; border-radius: 50%; background: rgba(88,196,154,.12); }
.trust-panel li i::after { content: ""; position: absolute; width: 6px; height: 3px; inset: 5px 4px; border: solid var(--green); border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg); }
.prototype-note { display: inline-flex; padding-top: 13px; border-top: 1px solid var(--border); color: var(--gold); font-size: .68rem; font-weight: 800; line-height: 1.7; }

.search-studio {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.025);
}
.search-studio:focus-within { border-color: color-mix(in srgb, var(--gold) 56%, var(--border)); box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow); }
.search-input-wrap {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}
.search-symbol { align-self: start; width: 36px; height: 36px; display: grid; place-items: center; color: var(--gold); }
.search-symbol svg { width: 23px; height: 23px; }
.search-input-wrap textarea {
  width: 100%;
  min-height: 54px;
  max-height: 128px;
  resize: vertical;
  padding: 7px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
}
.search-input-wrap textarea::placeholder { color: var(--muted-2); }
.query-hint { direction: ltr; align-self: end; margin-bottom: 7px; color: var(--muted-2); font-size: .65rem; }
.primary-button, .secondary-button, .small-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-size: .84rem;
  transition: .18s ease;
}
.primary-button, .small-primary { border: 1px solid transparent; background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #13212a; box-shadow: 0 8px 22px color-mix(in srgb, var(--gold) 18%, transparent); }
.primary-button:hover, .small-primary:hover { filter: brightness(1.055); transform: translateY(-1px); }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }
.search-button { min-width: 152px; border-radius: 12px; }
.search-button svg { transform: scaleX(-1); }
.autocomplete-panel {
  position: absolute;
  z-index: 80;
  inset: calc(100% + 9px) 0 auto;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, var(--border-strong));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elevated) 96%, transparent);
  box-shadow: 0 24px 65px rgba(0,0,0,.34);
  backdrop-filter: blur(18px);
}
.autocomplete-panel[hidden] { display: none !important; }
.autocomplete-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(110deg, var(--gold-soft), transparent 45%); }
.autocomplete-head span { color: var(--gold); font-size: .7rem; font-weight: 850; }
.autocomplete-head small { color: var(--muted-2); font-size: .62rem; }
.autocomplete-panel > button { width: 100%; display: grid; grid-template-columns: 34px 1fr 22px; align-items: center; gap: 10px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: start; }
.autocomplete-panel > button:hover, .autocomplete-panel > button:focus-visible { outline: 0; background: var(--surface-soft); }
.autocomplete-panel > button > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.autocomplete-panel > button strong { overflow: hidden; color: var(--text); font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.autocomplete-panel > button small { overflow: hidden; color: var(--muted); font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.autocomplete-panel > button i { color: var(--muted-2); font-size: .72rem; font-style: normal; }
.suggestion-icon { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--gold); font-size: .6rem; font-weight: 900; }
.autocomplete-foot { padding: 8px 14px; background: var(--surface-soft); color: var(--muted-2); font-size: .6rem; }
.search-intelligence { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 34px; padding: 7px 11px; color: var(--muted); font-size: .66rem; }
.search-mode, .index-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.search-mode strong { color: var(--text); font-size: .68rem; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 13%, transparent); }
.search-intelligence.related .live-dot { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.index-stats span, .index-stats a { padding: 3px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-soft); color: var(--muted); text-decoration: none; }
.index-stats a { color: var(--blue); }
.index-stats a:hover { border-color: color-mix(in srgb, var(--blue) 35%, var(--border)); color: var(--text); }
.secondary-button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.secondary-button:hover { border-color: color-mix(in srgb, var(--gold) 36%, var(--border)); background: var(--surface-2); }
.small-primary { min-height: 35px; padding: 6px 15px; }

.filter-row { position: relative; z-index: 12; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.filter-popover-wrap { position: relative; }
.filter-button, .select-filter {
  height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .77rem;
  font-weight: 700;
  transition: .15s ease;
}
.filter-button:hover, .select-filter:hover, .filter-button[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.filter-button.featured { border-color: color-mix(in srgb, var(--gold) 30%, var(--border)); color: var(--text); }
.filter-button svg, .select-filter svg { width: 16px; height: 16px; color: var(--gold); }
.filter-button .chevron { width: 14px; color: var(--muted-2); transition: .2s; }
.filter-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.filter-count { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; border-radius: 6px; background: var(--gold); color: #14212a; font-size: .67rem; }
.select-filter { padding-inline-end: 6px; }
.select-filter select, .compact-select select {
  appearance: none;
  min-width: 122px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.select-filter select option, .compact-select select option { background: var(--surface); color: var(--text); }
.court-name-filter select { min-width: min(310px, 30vw); max-width: 350px; text-overflow: ellipsis; }

.court-menu {
  position: absolute;
  z-index: 60;
  inset-block-start: calc(100% + 9px);
  inset-inline-start: 0;
  width: min(720px, calc(100vw - var(--sidebar-width) - 80px));
  max-height: min(680px, calc(100vh - 180px));
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--bg-elevated);
  box-shadow: 0 25px 70px rgba(0,0,0,.32);
  overflow: hidden;
}
.menu-head, .menu-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.menu-head > div { display: flex; flex-direction: column; }
.menu-head strong { font-size: .92rem; }
.menu-head span, .menu-footer > span { color: var(--muted); font-size: .7rem; }
.menu-head > button { border: 0; background: transparent; color: var(--gold); font-size: .73rem; font-weight: 800; }
.court-option { display: flex; align-items: center; gap: 9px; min-height: 35px; color: var(--muted); font-size: .76rem; cursor: pointer; }
.court-option:hover { color: var(--text); }
.court-option input { position: absolute; opacity: 0; pointer-events: none; }
.custom-check { flex: 0 0 auto; width: 17px; height: 17px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-soft); position: relative; }
.court-option input:checked + .custom-check { border-color: var(--gold); background: var(--gold); }
.court-option input:checked + .custom-check::after { content: ""; position: absolute; width: 7px; height: 4px; top: 4px; left: 4px; border: solid #12202a; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.court-option input:focus-visible + .custom-check { outline: 2px solid var(--blue); outline-offset: 2px; }
.court-option.select-all { margin: 12px 16px 5px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.court-option.select-all > span:last-child { display: flex; flex-direction: column; }
.court-option.select-all strong { color: var(--text); font-size: .8rem; }
.court-option.select-all small { color: var(--muted); font-size: .65rem; }
.court-groups { max-height: 440px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 25px; padding: 7px 16px 16px; overflow: auto; scrollbar-width: thin; }
.court-groups fieldset { min-width: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 12px 8px 8px; border: 0; border-bottom: 1px solid var(--border); }
.court-groups legend { margin-bottom: 4px; color: var(--gold); font-size: .68rem; font-weight: 850; }
.menu-footer { border-top: 1px solid var(--border); border-bottom: 0; background: var(--surface-soft); }

.quick-queries { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 11px; color: var(--muted-2); font-size: .7rem; }
.quick-queries button { padding: 3px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .7rem; }
.quick-queries button:hover { background: var(--surface-soft); color: var(--text); }
.privacy-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(109,181,214,.13);
  border-radius: 10px;
  background: rgba(109,181,214,.055);
  color: var(--muted);
  font-size: .72rem;
}
.privacy-strip > div { display: flex; align-items: center; gap: 8px; }
.privacy-strip svg { width: 17px; height: 17px; color: var(--blue); }
.privacy-strip strong { color: var(--text); }
.privacy-strip button { flex: 0 0 auto; border: 0; background: transparent; color: var(--blue); font-size: .7rem; font-weight: 800; }

.results-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(350px, .8fr); gap: 17px; align-items: start; margin-top: 17px; }
.results-panel, .analysis-panel, .table-card, .upload-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
.panel-header, .table-card > header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--border);
}
.panel-header > div, .table-card > header > div { display: flex; flex-direction: column; }
.panel-header h2, .table-card h2 { margin: 0; font-size: .98rem; }
.panel-header > div > span, .table-card > header > div > span { color: var(--muted); font-size: .69rem; }
.result-mode { display: inline-flex; align-items: center; margin-inline-end: 5px; padding: 2px 6px; border-radius: 5px; background: rgba(88,196,154,.09); color: var(--green); font-size: .61rem; }
.result-mode.expanded { background: rgba(109,181,214,.09); color: var(--blue); }
.result-mode.related { background: var(--gold-soft); color: var(--gold); }
.result-mode.browse { background: var(--surface-3); color: var(--muted); }
.compact-select { color: var(--muted); font-size: .68rem; }
.compact-select select { min-width: 78px; color: var(--text); font-size: .68rem; font-weight: 700; }

.result-list { padding: 5px 14px 14px; }
.result-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  gap: 12px;
  padding: 17px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: .15s ease;
}
.result-card:last-child { border-bottom: 0; }
.result-card:hover { padding-inline: 9px; border-radius: 10px; background: var(--surface-soft); }
.match-score { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(88,196,154,.22); border-radius: 50%; background: rgba(88,196,154,.075); color: var(--green); font-size: .69rem; font-weight: 850; direction: ltr; }
.result-content { min-width: 0; }
.result-topline { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; color: var(--muted); font-size: .67rem; }
.court-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 5px; background: var(--gold-soft); color: var(--gold); font-weight: 800; }
.court-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.source-badge { display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: .61rem; font-weight: 800; }
.stage-badge { padding: 2px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: .6rem; }
.result-card h3 { margin: 0 0 5px; color: var(--text); font-size: .91rem; line-height: 1.55; }
.result-card mark, .autocomplete-panel mark { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--gold) 26%, transparent); color: inherit; }
.result-card p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.75; }
.result-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.result-tags span { padding: 3px 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: .63rem; }
.result-tags a { padding: 3px 7px; border: 1px solid rgba(88,196,154,.2); border-radius: 5px; background: rgba(88,196,154,.06); color: var(--green); font-size: .63rem; font-weight: 800; text-decoration: none; }
.result-tags a:hover { background: rgba(88,196,154,.12); }
.save-result { width: 33px; height: 33px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted-2); }
.save-result:hover { border-color: var(--border); background: var(--surface-2); color: var(--gold); }
.save-result.saved { color: var(--gold); background: var(--gold-soft); }
.save-result.saved svg { fill: currentColor; }
.save-result svg { width: 17px; height: 17px; }

.loading-state { min-height: 430px; padding: 22px; }
.loading-state > span { display: block; height: 82px; margin-bottom: 12px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 45%, var(--surface-2) 65%); background-size: 220% 100%; animation: shimmer 1.2s infinite; }
.loading-state p { color: var(--muted); text-align: center; font-size: .78rem; }
@keyframes shimmer { to { background-position: -220% 0; } }
.empty-state { min-height: 410px; display: grid; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-state svg { width: 40px; height: 40px; color: var(--muted-2); }
.empty-state h3 { margin: 13px 0 2px; font-size: 1rem; }
.empty-state p { max-width: 350px; margin: 0 0 15px; color: var(--muted); font-size: .77rem; }
.empty-state button { border: 0; background: transparent; color: var(--gold); font-size: .76rem; font-weight: 800; }
.search-placeholder { min-height: 410px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px; text-align: center; }
.search-placeholder > span, .analysis-welcome > span { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--gold); }
.search-placeholder svg, .analysis-welcome svg { width: 25px; height: 25px; }
.search-placeholder h3 { margin: 14px 0 4px; font-size: 1rem; }
.search-placeholder p { max-width: 480px; margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.9; }
.search-placeholder button { margin-top: 16px; padding: 7px 13px; border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--border)); border-radius: 8px; background: var(--gold-soft); color: var(--gold); font-size: .7rem; font-weight: 850; }
.analysis-welcome { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.analysis-body .analysis-welcome h3 { margin: 13px 0 3px; color: var(--text); font-size: .9rem; }
.analysis-body .analysis-welcome > p { max-width: 390px; color: var(--muted); font-size: .73rem; line-height: 1.85; }
.analysis-body .analysis-welcome ul { width: min(330px,100%); display: grid; gap: 7px; margin: 13px 0 0; padding: 0; text-align: start; }
.analysis-body .analysis-welcome li { display: list-item; margin-inline-start: 18px; color: var(--muted); font-size: .68rem; }

.analysis-panel { position: sticky; top: 88px; overflow: hidden; }
.analysis-header { min-height: 70px; display: grid; grid-template-columns: 43px 1fr 35px; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); background: linear-gradient(120deg, var(--gold-soft), transparent 40%); }
.ai-orb { position: relative; width: 41px; height: 41px; display: grid; place-items: center; border: 1px solid rgba(212,179,109,.3); border-radius: 13px; background: radial-gradient(circle at 65% 35%, var(--gold-bright), #91702e 48%, #2b3940 50%); box-shadow: 0 7px 20px rgba(0,0,0,.18); }
.ai-orb span:first-child { width: 15px; height: 1px; background: rgba(255,255,255,.7); transform: rotate(90deg); }
.ai-orb span:last-child { position: absolute; width: 15px; height: 1px; background: rgba(255,255,255,.7); }
.analysis-header > div:nth-child(2) { display: flex; flex-direction: column; line-height: 1.45; }
.analysis-header > div:nth-child(2) span { color: var(--gold); font-size: .65rem; font-weight: 850; }
.analysis-header > div:nth-child(2) strong { font-size: .84rem; }
.analysis-header .plain-icon { width: 34px; height: 34px; border: 0; }
.analysis-body { padding: 17px; }
.confidence-line { display: flex; justify-content: space-between; color: var(--muted); font-size: .68rem; }
.confidence-line strong { color: var(--green); }
.confidence-line i { font-style: normal; direction: ltr; }
.confidence-track { height: 4px; margin: 7px 0 16px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.confidence-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #85d8b8); }
.analysis-body > p { margin: 0; color: var(--text); font-size: .81rem; line-height: 1.9; }
.analysis-body h3 { margin: 20px 0 8px; color: var(--muted); font-size: .69rem; }
.analysis-body ul { display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 0; list-style: none; }
.analysis-body li { display: grid; grid-template-columns: 27px 1fr; gap: 8px; }
.analysis-body li > span { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; color: var(--gold); font-size: .6rem; font-weight: 900; }
.analysis-body li p { margin: 0; color: var(--muted); font-size: .73rem; line-height: 1.75; }
.analysis-body li button { display: inline; padding: 0 3px; border: 0; background: transparent; color: var(--gold); font-size: .66rem; font-weight: 800; }
.difference-note { display: grid; grid-template-columns: 20px 1fr; gap: 9px; margin-top: 16px; padding: 11px; border: 1px solid rgba(225,120,120,.14); border-radius: 9px; background: rgba(225,120,120,.055); }
.difference-note svg { width: 18px; color: var(--red); }
.difference-note p { display: flex; flex-direction: column; margin: 0; color: var(--muted); font-size: .69rem; }
.difference-note strong { color: var(--text); font-size: .71rem; }
.difference-note a { margin-top: 4px; color: var(--blue); font-size: .68rem; font-weight: 800; text-decoration: none; }
.analysis-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-soft); }
.analysis-footer > p { display: grid; grid-template-columns: 16px 1fr; gap: 7px; margin: 0; color: var(--muted-2); font-size: .63rem; }
.analysis-footer > p svg { width: 15px; height: 15px; }
.analysis-footer > div { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 10px; color: var(--muted); font-size: .64rem; }
.analysis-footer > div button { padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--muted); font-size: .62rem; }
.analysis-footer > div button:hover { color: var(--text); background: var(--surface-2); }

.collection-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.collection-bar button { padding: 7px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: .74rem; }
.collection-bar button span { margin-inline-start: 4px; color: var(--muted-2); }
.collection-bar button.active { border-color: color-mix(in srgb, var(--gold) 38%, var(--border)); background: var(--gold-soft); color: var(--text); }
.saved-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.saved-card { padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); transition: .18s ease; }
.saved-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.saved-card header { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.saved-card header > span { color: var(--gold); font-size: .67rem; font-weight: 800; }
.saved-card header button { border: 0; background: transparent; color: var(--gold); }
.saved-card header button svg { width: 17px; height: 17px; fill: currentColor; }
.saved-card h2 { margin: 0 0 6px; font-size: .94rem; }
.saved-card p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.8; }
.saved-card footer { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: .66rem; }

/* Judicial drafting workspace */
.draft-page-heading { align-items: center; }
.draft-heading-actions { flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.draft-status, .local-ai-badge { display: inline-flex; align-items: center; gap: 7px; width: fit-content; border-radius: 999px; font-size: .66rem; font-weight: 850; white-space: nowrap; }
.draft-status { padding: 7px 10px; border: 1px solid color-mix(in srgb, var(--gold) 26%, var(--border)); background: var(--gold-soft); color: var(--gold-bright); }
.draft-status i, .local-ai-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent); }
.draft-safety { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid rgba(109,181,214,.18); border-radius: 14px; background: linear-gradient(110deg, rgba(109,181,214,.085), var(--surface-soft)); }
.draft-safety-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; background: rgba(109,181,214,.1); color: var(--blue); }
.draft-safety-icon svg { width: 20px; height: 20px; }
.draft-safety strong { display: block; color: var(--text); font-size: .76rem; }
.draft-safety p { margin: 2px 0 0; color: var(--muted); font-size: .68rem; }
.local-ai-badge { padding: 7px 10px; border: 1px solid rgba(88,196,154,.18); background: rgba(88,196,154,.075); color: var(--green); }
.draft-steps { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 17px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--muted); font-size: .66rem; font-weight: 780; }
.draft-steps span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.draft-steps span b { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--muted); font-size: .63rem; }
.draft-steps span.active { color: var(--text); }
.draft-steps span.active b { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-bright); }
.draft-steps > i { width: min(85px, 7vw); height: 1px; background: var(--border-strong); }
.draft-layout { display: grid; grid-template-columns: minmax(0,1fr) 292px; align-items: start; gap: 16px; }
.draft-main-column { min-width: 0; display: flex; flex-direction: column; gap: 15px; }
.draft-side-column { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 12px; }
.draft-panel, .protocol-card, .assistant-scope-card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 34px rgba(0,0,0,.07); }
.draft-panel { overflow: hidden; }
.draft-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 19px; border-bottom: 1px solid var(--border); background: linear-gradient(115deg, var(--surface-soft), transparent 60%); }
.draft-panel-header > div:first-child { min-width: 0; }
.panel-step { color: var(--gold); font-size: .6rem; font-weight: 900; letter-spacing: .07em; }
.draft-panel-header h2 { margin: 1px 0 2px; font-size: .97rem; }
.draft-panel-header p { margin: 0; color: var(--muted); font-size: .66rem; }
.autosave-state { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: .62rem; white-space: nowrap; }
.autosave-state svg { width: 16px; height: 16px; }
.autosave-state.saved { color: var(--green); }
.draft-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; padding: 18px 19px 9px; }
.draft-long-fields { display: grid; gap: 13px; padding: 7px 19px 20px; }
.draft-field { min-width: 0; display: flex; flex-direction: column; gap: 6px; color: var(--text); font-size: .69rem; font-weight: 800; }
.draft-field input, .draft-field select, .draft-field textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; outline: 0; background: var(--bg-elevated); color: var(--text); transition: .18s ease; }
.draft-field input, .draft-field select { min-height: 43px; padding: 8px 11px; }
.draft-field textarea { min-height: 76px; padding: 10px 12px; line-height: 1.8; resize: vertical; }
.draft-field input::placeholder, .draft-field textarea::placeholder { color: var(--muted-2); font-weight: 500; }
.draft-field input:focus, .draft-field select:focus, .draft-field textarea:focus { border-color: color-mix(in srgb, var(--gold) 55%, var(--border)); box-shadow: 0 0 0 3px var(--gold-soft); }
.draft-field small { margin-top: -3px; color: var(--muted-2); font-size: .57rem; font-weight: 500; }
.source-count { flex: 0 0 auto; padding: 5px 9px; border: 1px solid rgba(109,181,214,.18); border-radius: 7px; background: rgba(109,181,214,.07); color: var(--blue); font-size: .62rem; font-weight: 850; }
.draft-reference-guide { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 9px; margin: 15px 18px 9px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: .63rem; }
.draft-reference-guide svg { width: 18px; color: var(--gold); }
.draft-reference-guide button { border: 0; background: transparent; color: var(--blue); font-size: .63rem; font-weight: 850; white-space: nowrap; }
.draft-source-list { display: grid; gap: 8px; padding: 6px 18px 18px; }
.draft-source-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg-elevated); transition: .17s ease; }
.draft-source-item.selected { border-color: color-mix(in srgb, var(--gold) 30%, var(--border)); background: linear-gradient(110deg, var(--gold-soft), var(--bg-elevated) 48%); }
.draft-source-item > label { min-width: 0; display: grid; grid-template-columns: 21px minmax(0,1fr); gap: 10px; cursor: pointer; }
.draft-source-item input { position: absolute; opacity: 0; pointer-events: none; }
.source-check { width: 20px; height: 20px; display: grid; place-items: center; margin-top: 2px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: #10212a; }
.draft-source-item.selected .source-check { border-color: var(--gold); background: var(--gold); }
.source-check svg { width: 14px; height: 14px; stroke-width: 2.6; }
.source-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.source-copy > span:first-child { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.source-copy strong { overflow: hidden; color: var(--text); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.source-copy small { flex: 0 0 auto; color: var(--muted-2); font-size: .55rem; }
.source-copy > span:nth-child(2) { color: var(--muted); font-size: .6rem; }
.source-copy em { overflow: hidden; color: var(--gold); font-size: .58rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.draft-source-item > button { padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--blue); font-size: .59rem; font-weight: 850; }
.draft-source-empty { display: flex; flex-direction: column; align-items: center; padding: 28px; border: 1px dashed var(--border-strong); border-radius: 11px; color: var(--muted); text-align: center; font-size: .65rem; }
.draft-source-empty strong { color: var(--text); font-size: .76rem; }
.draft-ai-panel { display: grid; grid-template-columns: 52px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 17px 18px; border: 1px solid color-mix(in srgb, var(--gold) 27%, var(--border)); border-radius: 16px; background: radial-gradient(circle at 88% 20%, rgba(212,179,109,.14), transparent 32%), var(--surface); box-shadow: var(--shadow); }
.draft-ai-orb { width: 50px; height: 50px; position: relative; display: grid; place-items: center; border: 1px solid rgba(212,179,109,.22); border-radius: 15px; background: linear-gradient(145deg, rgba(212,179,109,.18), rgba(109,181,214,.08)); }
.draft-ai-orb::before, .draft-ai-orb::after, .draft-ai-orb span { content: ""; position: absolute; border-radius: 50%; }
.draft-ai-orb::before { width: 18px; height: 18px; background: var(--gold); box-shadow: 0 0 25px rgba(212,179,109,.5); }
.draft-ai-orb::after { width: 31px; height: 31px; border: 1px solid rgba(239,209,141,.45); }
.draft-ai-orb span { width: 7px; height: 7px; inset: 7px auto auto 8px; background: var(--blue); }
.draft-ai-copy > span { color: var(--gold); font-size: .59rem; font-weight: 900; letter-spacing: .06em; }
.draft-ai-copy h2 { margin: 1px 0 2px; font-size: .94rem; }
.draft-ai-copy p { max-width: 610px; margin: 0; color: var(--muted); font-size: .62rem; }
.draft-ai-tools { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.draft-ai-tools button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: .59rem; font-weight: 780; }
.draft-ai-tools button:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.draft-ai-tools svg { width: 14px; height: 14px; color: var(--gold); }
.draft-generate-button { min-width: 195px; display: grid; grid-template-columns: 25px 1fr; align-items: center; gap: 1px 8px; padding: 10px 13px; border: 1px solid transparent; border-radius: 11px; background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #13212a; box-shadow: 0 10px 28px rgba(212,179,109,.18); text-align: start; }
.draft-generate-button svg { grid-row: 1 / 3; width: 23px; height: 23px; }
.draft-generate-button span { font-size: .72rem; font-weight: 900; }
.draft-generate-button small { opacity: .7; font-size: .53rem; font-weight: 700; }
.draft-generate-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.draft-generate-button.working svg { animation: draftPulse 1s infinite; }
@keyframes draftPulse { 50% { transform: scale(.8) rotate(15deg); opacity: .55; } }
.output-header { align-items: flex-end; }
.draft-output-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; }
.draft-output-actions button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: .59rem; font-weight: 800; }
.draft-output-actions button:hover { color: var(--text); background: var(--surface-2); }
.draft-output-actions svg { width: 14px; height: 14px; }
.draft-document-shell { width: min(100%, 860px); margin: 22px auto; overflow: hidden; border: 1px solid #d9d8d1; border-radius: 4px; background: #fdfdfb; box-shadow: 0 18px 50px rgba(0,0,0,.18); color: #17242c; }
.draft-document-mark { display: flex; align-items: center; gap: 11px; padding: 15px 20px; border-bottom: 1px solid #e7e4da; background: #f8f7f2; }
.draft-document-mark > span { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid #b69753; border-radius: 12px 12px 5px 12px; color: #8c6a25; font-size: .76rem; font-weight: 900; }
.draft-document-mark strong { font-size: .78rem; }
.draft-document-mark small { margin-inline-start: auto; color: #8a4d4d; font-size: .57rem; font-weight: 800; }
#draftOutput { width: 100%; min-height: 680px; display: block; padding: 30px 42px; border: 0; outline: 0; background: #fdfdfb; color: #17242c; font-family: "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, serif; font-size: .87rem; line-height: 2.05; resize: vertical; }
#draftOutput::placeholder { color: #8b9499; }
.draft-document-footer { display: flex; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid #e7e4da; background: #f8f7f2; color: #727d82; font-size: .55rem; }
.draft-document-footer strong { color: #8c6a25; }
.protocol-card { padding: 15px; }
.protocol-card > header { display: grid; grid-template-columns: 37px 1fr auto; align-items: center; gap: 9px; }
.protocol-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--gold-soft); color: var(--gold); }
.protocol-icon svg { width: 19px; height: 19px; }
.protocol-card header > div { display: flex; flex-direction: column; }
.protocol-card header > div span { color: var(--muted); font-size: .57rem; }
.protocol-card h2 { margin: 0; font-size: .8rem; }
.protocol-card header > strong { color: var(--gold-bright); font-size: 1.05rem; }
.protocol-progress { height: 5px; margin: 13px 0; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.protocol-progress i { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--green)); transition: width .3s ease; }
.protocol-card ul, .assistant-scope-card ul { list-style: none; margin: 0; padding: 0; }
.protocol-card li { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .63rem; }
.protocol-card li i { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 50%; }
.protocol-card li i svg { width: 12px; height: 12px; stroke-width: 2.7; }
.protocol-card li.complete { color: var(--text); }
.protocol-card li.complete i { border-color: var(--green); background: rgba(88,196,154,.12); color: var(--green); }
.protocol-card > button { width: 100%; margin-top: 13px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: .64rem; font-weight: 850; }
.draft-review-complete .protocol-card { border-color: rgba(88,196,154,.3); }
.assistant-scope-card { padding: 16px; background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 88%, var(--gold) 12%)); }
.scope-label { color: var(--gold); font-size: .58rem; font-weight: 900; letter-spacing: .06em; }
.assistant-scope-card h2 { margin: 2px 0 10px; font-size: .84rem; }
.assistant-scope-card li { display: grid; grid-template-columns: 17px 1fr; align-items: center; gap: 7px; margin: 7px 0; color: var(--muted); font-size: .62rem; }
.assistant-scope-card li svg { width: 15px; height: 15px; color: var(--green); stroke-width: 2.4; }
.assistant-scope-card li.blocked svg { color: var(--red); }
.assistant-scope-card p { margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: .57rem; line-height: 1.75; }
.new-draft-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px; border: 1px dashed var(--border-strong); border-radius: 10px; background: transparent; color: var(--muted); font-size: .65rem; font-weight: 800; }
.new-draft-button:hover { border-style: solid; color: var(--text); background: var(--surface-soft); }
.new-draft-button svg { width: 16px; height: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid article { min-height: 105px; display: flex; align-items: center; gap: 12px; position: relative; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.stat-grid article > div { display: flex; flex-direction: column; line-height: 1.35; }
.stat-grid article strong { font-size: 1.4rem; }
.stat-grid article > div > span { color: var(--muted); font-size: .7rem; }
.stat-grid article > small { position: absolute; inset: 10px auto auto 10px; color: var(--muted-2); font-size: .58rem; }
.stat-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: rgba(109,181,214,.1); color: var(--blue); }
.stat-icon.gold { background: var(--gold-soft); color: var(--gold); }
.stat-icon.green { background: rgba(88,196,154,.1); color: var(--green); }
.stat-icon.violet { background: rgba(156,142,232,.1); color: var(--violet); }
.archive-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .45fr); gap: 15px; align-items: stretch; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .73rem; }
th { padding: 11px 16px; background: var(--surface-soft); color: var(--muted); text-align: right; font-size: .64rem; font-weight: 750; white-space: nowrap; }
td { padding: 13px 16px; border-top: 1px solid var(--border); color: var(--muted); vertical-align: middle; white-space: nowrap; }
td strong { display: block; color: var(--text); font-size: .73rem; }
td small { display: block; color: var(--muted-2); font-size: .61rem; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; font-size: .62rem; font-weight: 800; }
.status-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-chip.ready { background: rgba(88,196,154,.1); color: var(--green); }
.status-chip.review { background: var(--gold-soft); color: var(--gold); }
.status-chip.indexed { background: rgba(109,181,214,.1); color: var(--blue); }
.upload-card { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; border-style: dashed; text-align: center; transition: .18s ease; }
.upload-card.dragging { border-color: var(--gold); background: var(--gold-soft); }
.upload-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: var(--gold-soft); color: var(--gold); }
.upload-icon svg { width: 24px; height: 24px; }
.upload-card h2 { margin: 13px 0 4px; font-size: .95rem; }
.upload-card p { max-width: 290px; margin: 0 0 15px; color: var(--muted); font-size: .72rem; }
.upload-card > button { padding: 7px 13px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: .7rem; font-weight: 800; }
.upload-card > small { margin-top: 9px; color: var(--muted-2); font-size: .6rem; }
.upload-progress { width: 100%; margin-top: 15px; }
.upload-progress > span { display: block; height: 5px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.upload-progress i { display: block; width: 12%; height: 100%; background: var(--gold); transition: width 1.15s ease; }
.upload-progress strong { display: block; margin-top: 6px; color: var(--muted); font-size: .65rem; }
.stat-grid.compact { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stat-grid.compact article { justify-content: space-between; }
.trend { padding: 4px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .63rem; }
.trend.up, .trend.safe { background: rgba(88,196,154,.1); color: var(--green); }
.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; margin-bottom: 16px; }
.role-cards article { position: relative; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.role-icon { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); }
.role-icon svg { width: 19px; height: 19px; }
.role-cards strong { font-size: .84rem; }
.role-cards b { position: absolute; inset: 15px auto auto 17px; font-size: 1.35rem; }
.role-cards p { margin: 3px 0 0; color: var(--muted); font-size: .69rem; }
.mini-search { width: 220px; height: 35px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); }
.mini-search svg { width: 15px; height: 15px; color: var(--muted); }
.mini-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .69rem; }
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-cell > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: var(--gold-soft); color: var(--gold); font-size: .65rem; font-weight: 850; }

.drawer-scrim { position: fixed; z-index: 90; inset: 0; background: rgba(1,8,13,.66); backdrop-filter: blur(3px); }
.case-drawer {
  position: fixed;
  z-index: 100;
  inset: 0 0 0 auto;
  width: min(680px, 100vw);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  background: var(--bg-elevated);
  border-inline-start: 1px solid var(--border-strong);
  box-shadow: -25px 0 80px rgba(0,0,0,.35);
  animation: drawerIn .25s ease;
}
@keyframes drawerIn { from { transform: translateX(100%); } }
.drawer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 22px 24px 15px; }
.drawer-top h2 { margin: 5px 0 0; font-size: 1.2rem; }
.synthetic-tag { display: inline-block; padding: 3px 7px; border-radius: 5px; background: rgba(225,120,120,.1); color: var(--red); font-size: .62rem; font-weight: 800; }
.drawer-meta { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 24px 17px; color: var(--muted); font-size: .68rem; }
.drawer-meta span { padding-inline-end: 8px; border-inline-end: 1px solid var(--border); }
.drawer-meta span:last-child { border: 0; }
.drawer-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); }
.drawer-tabs button { position: relative; padding: 10px 13px; border: 0; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 700; }
.drawer-tabs button.active { color: var(--text); }
.drawer-tabs button.active::after { content: ""; position: absolute; inset: auto 9px -1px; height: 2px; background: var(--gold); }
.drawer-content { padding: 24px; overflow-y: auto; }
.document-block { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.document-block + .document-block { margin-top: 12px; }
.document-block h3 { margin: 0 0 8px; color: var(--gold); font-size: .75rem; }
.document-block p { margin: 0; color: var(--text); font-size: .82rem; line-height: 2; }
.principle-quote { position: relative; padding-inline-start: 18px; }
.principle-quote::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; border-radius: 3px; background: var(--gold); }
.drawer-source { display: flex; align-items: flex-start; gap: 9px; margin-top: 13px; padding: 11px; border-radius: 9px; background: rgba(109,181,214,.055); color: var(--muted); font-size: .69rem; }
.drawer-source svg { flex: 0 0 auto; width: 17px; color: var(--blue); }
.drawer-source a { color: var(--blue); font-weight: 800; text-decoration: none; }
.drawer-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 24px; border-top: 1px solid var(--border); background: var(--surface-soft); }
body.drawer-open { overflow: hidden; }

.toast {
  position: fixed;
  z-index: 200;
  inset: auto 50% 24px auto;
  transform: translateX(50%);
  min-width: min(360px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: .74rem;
  animation: toastIn .22s ease;
}
.toast svg { width: 18px; height: 18px; color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translate(50%, 8px); } }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

@media (max-width: 1230px) {
  :root { --sidebar-width: 248px; }
  .court-route-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .home-grid { grid-template-columns: 1fr; }
  .results-layout { grid-template-columns: minmax(0, 1fr); }
  .analysis-panel { position: static; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-layout { grid-template-columns: 1fr; }
  .upload-card { min-height: 250px; }
  .draft-layout { grid-template-columns: minmax(0,1fr) 260px; }
  .draft-ai-panel { grid-template-columns: 44px minmax(0,1fr); }
  .draft-ai-tools { grid-column: 2; }
  .draft-generate-button { grid-column: 1 / -1; width: 100%; justify-content: center; }
}

@media (max-width: 900px) {
  .sidebar { width: min(292px, 86vw); transform: translateX(105%); transition: transform .24s ease; box-shadow: -20px 0 60px rgba(0,0,0,.4); }
  .sidebar.open { transform: none; }
  .mobile-scrim { position: fixed; z-index: 25; inset: 0; background: rgba(0,0,0,.55); }
  .workspace { margin-inline-start: 0; }
  .mobile-menu { display: grid; }
  .home-hero { grid-template-columns: 1fr; }
  .home-index-card { min-height: 240px; }
  .breadcrumbs > span, .breadcrumbs i { display: none; }
  .court-menu { position: fixed; inset: 82px 16px auto; width: auto; max-height: calc(100vh - 100px); }
  .saved-grid { grid-template-columns: 1fr; }
  .role-cards { grid-template-columns: 1fr; }
  .draft-layout { grid-template-columns: 1fr; }
  .draft-side-column { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .new-draft-button { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  .topbar { height: 62px; padding: 0 14px; }
  .system-status { display: none; }
  .topbar-start { gap: 7px; }
  .history-controls { gap: 3px; padding-inline-end: 7px; }
  .history-controls .icon-button { width: 31px; height: 31px; }
  .breadcrumbs { display: none; }
  main { padding: 24px 14px 46px; }
  .home-hero { min-height: 0; gap: 22px; padding: 24px 18px; border-radius: 18px; }
  .home-hero-copy h1 { font-size: 2rem; }
  .home-search { grid-template-columns: 24px minmax(0,1fr); padding: 8px 10px; }
  .home-search button { grid-column: 1 / -1; width: 100%; }
  .home-index-card { min-height: 220px; }
  .court-route-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .court-route-grid > button { min-height: 165px; padding: 14px; }
  .latest-case-grid { grid-template-columns: 1fr; }
  .home-panel > header, .home-section-head { align-items: flex-start; }
  .home-panel > header { flex-direction: column; }
  .page-heading { flex-direction: column; gap: 13px; margin-bottom: 19px; }
  .page-heading h1 { font-size: 1.55rem; }
  .search-studio { grid-template-columns: 1fr; padding: 7px; }
  .search-input-wrap { grid-template-columns: 30px 1fr; }
  .query-hint { display: none; }
  .search-button { min-height: 45px; width: 100%; }
  .search-intelligence { align-items: flex-start; flex-direction: column; padding-inline: 5px; }
  .search-mode { align-items: flex-start; }
  .search-mode > span:last-child { width: calc(100% - 20px); }
  .index-stats { gap: 5px; }
  .autocomplete-panel > button { grid-template-columns: 31px 1fr; padding-inline: 10px; }
  .autocomplete-panel > button > i { display: none; }
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filter-row > *, .filter-button, .select-filter { min-width: 0; width: 100%; }
  .select-filter select { min-width: 0; width: 100%; }
  .court-name-filter select { max-width: none; }
  .filter-popover-wrap { position: static; }
  .quick-queries { align-items: flex-start; }
  .quick-queries > span { width: 100%; }
  .privacy-strip { align-items: flex-start; }
  .privacy-strip > button { display: none; }
  .results-layout { gap: 12px; }
  .panel-header, .table-card > header { align-items: flex-start; }
  .compact-select { display: none; }
  .result-card { grid-template-columns: 40px minmax(0,1fr); }
  .save-result { position: absolute; inset: 14px auto auto 3px; }
  .court-groups { grid-template-columns: 1fr; max-height: calc(100vh - 315px); }
  .menu-footer > span { display: none; }
  .menu-footer { justify-content: flex-end; }
  .stat-grid, .stat-grid.compact { grid-template-columns: 1fr; }
  .stat-grid article { min-height: 92px; }
  .case-drawer { width: 100vw; }
  .drawer-top, .drawer-content { padding-inline: 16px; }
  .drawer-meta, .drawer-tabs, .drawer-actions { padding-inline: 16px; }
  .drawer-tabs { overflow-x: auto; }
  .drawer-tabs button { white-space: nowrap; }
  .drawer-actions { display: grid; grid-template-columns: 1fr; }
  .mini-search { display: none; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; padding-block: 17px 22px; }
  .draft-heading-actions { width: 100%; justify-content: flex-start; }
  .draft-safety { grid-template-columns: 34px 1fr; align-items: start; }
  .local-ai-badge { grid-column: 1 / -1; }
  .draft-steps { justify-content: flex-start; overflow-x: auto; }
  .draft-steps > i { min-width: 24px; }
  .draft-panel-header, .output-header { align-items: flex-start; flex-direction: column; gap: 9px; }
  .draft-form-grid { grid-template-columns: 1fr; }
  .draft-reference-guide { grid-template-columns: 19px 1fr; }
  .draft-reference-guide button { grid-column: 2; justify-self: start; padding: 0; }
  .draft-source-item { grid-template-columns: 1fr; }
  .draft-source-item > button { justify-self: end; }
  .source-copy > span:first-child { display: block; }
  .source-copy small { display: block; margin-top: 2px; }
  .draft-ai-panel { grid-template-columns: 41px 1fr; padding: 15px; }
  .draft-ai-orb { width: 40px; height: 40px; }
  .draft-ai-tools { grid-column: 1 / -1; }
  .draft-generate-button { grid-column: 1 / -1; }
  .draft-output-actions { width: 100%; }
  .draft-output-actions button { flex: 1; justify-content: center; }
  .draft-document-shell { margin: 12px 0; border-inline: 0; }
  .draft-document-mark { padding: 12px; }
  .draft-document-mark small { display: none; }
  #draftOutput { min-height: 590px; padding: 22px 18px; font-size: .8rem; }
  .draft-side-column { grid-template-columns: 1fr; }
  .new-draft-button { grid-column: auto; }
}

@media print {
  .sidebar, .topbar, .site-footer, .drawer-scrim, .drawer-actions, .drawer-tabs, .toast { display: none !important; }
  .workspace { margin: 0; }
  main { display: none; }
  .case-drawer { position: static; width: 100%; display: block !important; border: 0; box-shadow: none; background: #fff; color: #111; }
  .drawer-top .icon-button { display: none; }
  .drawer-content { overflow: visible; }
  .document-block { border-color: #ddd; background: #fff; }
  .document-block p { color: #111; }
  body.draft-printing main { display: block; padding: 0; }
  body.draft-printing .case-drawer { display: none !important; }
  body.draft-printing .view { display: none !important; }
  body.draft-printing #view-draft { display: block !important; }
  body.draft-printing #view-draft > * { display: none !important; }
  body.draft-printing #view-draft .draft-layout { display: block !important; }
  body.draft-printing #view-draft .draft-main-column { display: block !important; }
  body.draft-printing #view-draft .draft-side-column { display: none !important; }
  body.draft-printing #view-draft .draft-main-column > * { display: none !important; }
  body.draft-printing #view-draft .draft-output-panel { display: block !important; border: 0; box-shadow: none; }
  body.draft-printing #view-draft .draft-output-panel > header { display: none !important; }
  body.draft-printing .draft-document-shell { width: 100%; margin: 0; border: 0; box-shadow: none; }
  body.draft-printing #draftOutput { min-height: 0; overflow: visible; padding: 20px 28px; background: #fff; color: #111; font-size: 11pt; line-height: 1.9; resize: none; }
  body.draft-printing .draft-document-mark, body.draft-printing .draft-document-footer { background: #fff; }
}
