/* Ontario Dockets — public interface */

:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --bg-elev: #ffffff;
  --bg-soft: #eef2ef;
  --bg-muted: #e5ebe7;
  --text: #14201c;
  --text-soft: #4c5a54;
  --text-faint: #6f7d77;
  --line: #d9e1dc;
  --line-strong: #c3cec8;
  --accent: #0d5c4d;
  --accent-strong: #08483c;
  --accent-soft: #dcefe8;
  --on-accent: #ffffff;
  --ocj-bg: #e4eefc;
  --ocj-text: #1d4f91;
  --scj-bg: #f4e8d7;
  --scj-text: #8a5a16;
  --danger: #a33232;
  --danger-soft: #fbeaea;
  --danger-line: #f0c9c9;
  --shadow-sm: 0 1px 2px rgba(16, 32, 26, 0.06), 0 1px 3px rgba(16, 32, 26, 0.08);
  --shadow-md: 0 10px 30px rgba(16, 32, 26, 0.1);
  --shadow-lg: 0 24px 60px rgba(16, 32, 26, 0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
  --shell: 1200px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1210;
  --bg-elev: #111b17;
  --bg-soft: #16221d;
  --bg-muted: #1d2c26;
  --text: #e8f0ec;
  --text-soft: #b3c2bb;
  --text-faint: #84958d;
  --line: #26372f;
  --line-strong: #354a40;
  --accent: #5fc9a8;
  --accent-strong: #7fd8bb;
  --accent-soft: #173a2f;
  --on-accent: #06231b;
  --ocj-bg: #16304f;
  --ocj-text: #a9ccff;
  --scj-bg: #3a2a16;
  --scj-text: #f0c98a;
  --danger: #ff9b9b;
  --danger-soft: #3a1c1c;
  --danger-line: #5a2a2a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1210;
    --bg-elev: #111b17;
    --bg-soft: #16221d;
    --bg-muted: #1d2c26;
    --text: #e8f0ec;
    --text-soft: #b3c2bb;
    --text-faint: #84958d;
    --line: #26372f;
    --line-strong: #354a40;
    --accent: #5fc9a8;
    --accent-strong: #7fd8bb;
    --accent-soft: #173a2f;
    --on-accent: #06231b;
    --ocj-bg: #16304f;
    --ocj-text: #a9ccff;
    --scj-bg: #3a2a16;
    --scj-text: #f0c98a;
    --danger: #ff9b9b;
    --danger-soft: #3a1c1c;
    --danger-line: #5a2a2a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.drawer-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.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;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  border-radius: 0 0 8px 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.icon-small {
  width: 1em;
  height: 1em;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

@supports (backdrop-filter: blur(12px)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}

.brand-mark .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.brand-text span {
  margin-top: 0.12rem;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-left: auto;
  font-size: 0.88rem;
  font-weight: 650;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-soft);
}

.header-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text-soft);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-icon-moon {
    display: none;
  }
}

/* Hero and search */

.hero {
  padding: 2.6rem 0 1.4rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 18ch;
  margin: 0 0 0.8rem;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 62ch;
  margin: 0 0 1.6rem;
  color: var(--text-soft);
  font-size: 1.04rem;
}

.search-bar {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  max-width: 920px;
  padding: 0.42rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  width: 1.2rem;
  height: 1.2rem;
  color: var(--text-faint);
  pointer-events: none;
}

#q {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.8rem 0.75rem 2.6rem;
  border: 0;
  border-radius: 10px;
  outline: none;
  background: transparent;
  font-size: 1rem;
}

#q::placeholder {
  color: var(--text-faint);
}

.scope-select {
  max-width: 11rem;
  padding: 0.5rem 0.8rem;
  border: 0;
  border-left: 1px solid var(--line);
  outline: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.88rem;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.62rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--bg-elev);
  color: var(--text-soft);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.search-submit {
  white-space: nowrap;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.45rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.15;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}

.chip-relative {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chip-date {
  font-variant-numeric: tabular-nums;
}

.chip-all {
  justify-content: center;
  font-weight: 700;
}

.hint {
  min-height: 1.2em;
  margin: 0;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.hint.is-error {
  color: var(--danger);
  font-weight: 600;
}

/* Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 1rem auto 1.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow-sm);
}

.stat {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  background: var(--bg-elev);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-body {
  min-width: 0;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  margin-top: 0.15rem;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 650;
}

.stat-sub {
  margin-top: 0.2rem;
  color: var(--text-faint);
  font-size: 0.72rem;
}

/* Filters */

.filters-shell {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  margin-bottom: 1.2rem;
  padding: 0.75rem 0;
  border-block: 1px solid var(--line);
  background: var(--bg);
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 0.6rem;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.filter label {
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.select,
.input {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background-color: var(--bg-elev);
  color: var(--text);
  font-size: 0.86rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select {
  appearance: none;
  padding-right: 2rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-faint) 50%),
    linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position:
    calc(100% - 1rem) 55%,
    calc(100% - 0.7rem) 55%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
}

.select:focus,
.input:focus,
#q:focus,
.scope-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#q:focus,
.scope-select:focus {
  box-shadow: none;
}

.more-toggle {
  width: 100%;
}

.advanced {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 0.6rem;
}

.advanced-actions {
  justify-content: flex-end;
}

.advanced-actions .btn {
  width: 100%;
}

/* Results */

.results {
  padding-bottom: 3rem;
  scroll-margin-top: calc(var(--header-h) + 5.5rem);
}

.results-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-md);
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
}

.results-head h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.015em;
}

.results-sub {
  margin: 0.2rem 0 0;
  color: var(--text-faint);
  font-size: 0.84rem;
}

.results-count {
  flex: none;
  padding: 0.35rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.notice {
  display: flex;
  gap: 0.7rem;
  margin: 1rem 1.3rem 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 0.85rem;
}

.notice > .icon {
  margin-top: 0.1rem;
  color: var(--accent);
}

.notice p {
  margin: 0;
}

.notice p + p {
  margin-top: 0.35rem;
}

.notice-error {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.notice-error > .icon {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.results-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

.results-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-faint);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.results-table th:first-child,
.results-table td:first-child {
  padding-left: 1.3rem;
}

.results-table th:last-child,
.results-table td:last-child {
  padding-right: 1.3rem;
}

.docket-row td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.docket-row:last-child td {
  border-bottom: 0;
}

.docket-row:hover td {
  background: var(--bg-soft);
}

.docket-row:focus-within td {
  background: var(--accent-soft);
}

.col-time {
  width: 7rem;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

.col-court {
  width: 8rem;
}

.court-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: var(--bg-muted);
  color: var(--text-soft);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.badge-ocj {
  background: var(--ocj-bg);
  color: var(--ocj-text);
}

.badge-scj {
  background: var(--scj-bg);
  color: var(--scj-text);
}

.case-type {
  color: var(--text-faint);
  font-size: 0.73rem;
}

.col-case {
  min-width: 16rem;
}

.case-title {
  color: var(--text);
  font-weight: 650;
  line-height: 1.35;
}

.case-meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
  color: var(--text-faint);
  font-size: 0.75rem;
}

.case-number {
  font-family: var(--mono);
  font-size: 0.71rem;
}

.dot {
  opacity: 0.55;
}

.col-place {
  width: 14rem;
}

.place-name {
  font-weight: 650;
}

.place-address {
  margin-top: 0.15rem;
  color: var(--text-faint);
  font-size: 0.74rem;
}

.col-matter {
  width: 12rem;
}

.matter-name {
  font-weight: 650;
}

.matter-method {
  margin-top: 0.15rem;
  color: var(--text-faint);
  font-size: 0.74rem;
}

.col-action {
  width: 6.5rem;
  text-align: right;
}

.row-open {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.row-open:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.row-open-icon {
  width: 0.9rem;
  height: 0.9rem;
  transition: transform 0.15s ease;
}

.row-open:hover .row-open-icon {
  transform: translateX(2px);
}

.empty {
  padding: 3rem 1.5rem;
  color: var(--text-soft);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-faint);
}

.empty h3 {
  margin: 0 0 0.4rem;
  color: var(--text);
  font-size: 1.1rem;
}

.empty p {
  max-width: 38ch;
  margin: 0 auto 1.2rem;
  font-size: 0.9rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.3rem;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}

.pager-info {
  color: var(--text-faint);
  font-size: 0.8rem;
}

.pager-info strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* About and footer */

.about {
  padding: 1rem 0 4rem;
}

.about-head {
  max-width: 60ch;
  margin-bottom: 1.5rem;
}

.about-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.about-card {
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}

.about-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.about-card h3 {
  margin: 0.8rem 0 0.4rem;
  font-size: 1rem;
}

.about-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.87rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  max-width: 42ch;
}

.footer-brand p {
  margin: 0.2rem 0 0;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.footer-links span {
  color: var(--text-faint);
  font-size: 0.77rem;
}

/* Drawer */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 15, 12, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(34rem, 100%);
  height: 100%;
  border-left: 1px solid var(--line);
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  outline: none;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.drawer-kicker {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.drawer-body {
  padding: 1.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.drawer-hero h2 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.drawer-sub {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
  margin: 1rem 0 0;
}

.detail-grid > div {
  min-width: 0;
}

.detail-grid dt {
  margin-bottom: 0.15rem;
  color: var(--text-faint);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 0.87rem;
  overflow-wrap: anywhere;
}

.drawer-section {
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.drawer-section h3 {
  margin: 0 0 0.5rem;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docket-line {
  margin: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

/* Toast and progress */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 120;
  max-width: min(90vw, 32rem);
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  font-weight: 650;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 130;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.progress.is-active {
  opacity: 1;
}

.progress::before {
  content: "";
  display: block;
  width: 38%;
  height: 100%;
  background: var(--accent);
  animation: progress-slide 1.1s ease-in-out infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(360%);
  }
}

.noscript {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 90;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  text-align: center;
}

.clipboard-helper {
  position: fixed;
  top: 0;
  left: -9999px;
  opacity: 0;
}

/* Responsive */

@media (max-width: 1080px) {
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .header-nav {
    display: none;
  }

  .filters-shell {
    position: static;
  }

  .results {
    scroll-margin-top: 1rem;
  }

  .table-wrap {
    overflow: visible;
  }

  .results-table {
    display: block;
    min-width: 0;
  }

  .results-table thead {
    display: none;
  }

  .results-table tbody {
    display: block;
  }

  .docket-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem 0.8rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--line);
  }

  .docket-row:last-child {
    border-bottom: 0;
  }

  .docket-row:hover {
    background: var(--bg-soft);
  }

  .docket-row:hover td,
  .docket-row:focus-within td {
    background: transparent;
  }

  .docket-row td {
    display: block;
    padding: 0;
    border: 0;
  }

  .docket-row td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.1rem;
    color: var(--text-faint);
    font-size: 0.63rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .col-time {
    grid-column: 1;
    width: auto;
  }

  .col-court {
    grid-column: 2;
    width: auto;
    text-align: right;
  }

  .col-court::before {
    text-align: right;
  }

  .col-case {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .col-place {
    grid-column: 1;
    width: auto;
  }

  .col-matter {
    grid-column: 2;
    width: auto;
    text-align: right;
  }

  .col-matter::before {
    text-align: right;
  }

  .col-action {
    grid-column: 1 / -1;
    width: auto;
    margin-top: 0.2rem;
    text-align: right;
  }

  .col-action::before {
    display: none;
  }

  .row-open {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .search-bar {
    flex-wrap: wrap;
  }

  .search-field {
    flex-basis: 100%;
  }

  .scope-select {
    flex: 1;
    max-width: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .search-submit {
    flex: 1;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .results-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6rem;
  }

  .results-count {
    align-self: flex-start;
  }

  .pager {
    flex-wrap: wrap;
  }

  .pager-info {
    order: -1;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 1.5rem, var(--shell));
  }

  .hero {
    padding-top: 1.8rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .docket-row {
    grid-template-columns: 1fr;
  }

  .col-court,
  .col-matter {
    grid-column: 1;
    text-align: left;
  }

  .col-court::before,
  .col-matter::before {
    text-align: left;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .drawer-panel {
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .hero,
  .filters-shell,
  .pager,
  .about,
  .site-footer,
  .drawer,
  .toast,
  .progress,
  .noscript {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .results-card {
    border: 0;
    box-shadow: none;
  }

  .results-table {
    min-width: 0;
  }
}
