/*
 * Travis County Specialty Courts Portal
 *
 * Self-contained: no CDN, no webfont host, no external asset of any kind, so the
 * Content-Security-Policy in Program.cs can stay strict and the portal works on a
 * server with no outbound internet access at all.
 */

:root {
  color-scheme: light;

  /* Palette carried over from the previous build so the portal reads as the same
     product. Teal for authority, gold for emphasis, on a soft off-white canvas —
     institutional rather than corporate, which is the right register for a court. */
  --ink: #142d2a;
  --ink-soft: #4a5f5b;
  --ink-faint: #657672;

  --page: #f3f6f5;
  --surface: #ffffff;
  --surface-sunken: #eef3f2;
  --line: #dce5e2;
  --line-strong: #cdd9d6;

  --accent: #0d6b60;
  --accent-strong: #074c45;
  --accent-ink: #ffffff;
  --accent-soft: #e8f3f0;

  --gold: #c9922c;
  --gold-soft: #fbf4e4;
  --gold-ink: #8b641a;

  /* The sidebar is its own near-black teal against the light canvas; it anchors the page. */
  --nav: #0a2f2b;
  --nav-ink: #b9ccc8;
  --nav-ink-strong: #ffffff;
  --nav-label: #76948e;
  --nav-icon: #8fb1aa;

  --good: #1c6b46;
  --good-soft: #e4f3ec;
  --warn: #8b641a;
  --warn-soft: #fbf4e4;
  --bad: #a8452a;
  --bad-soft: #fbeae5;

  --radius: 7px;
  --radius-lg: 9px;
  --shadow: 0 2px 9px rgb(24 55 49 / 4.5%);

  --font: Inter, "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Serif headings were the previous build's most distinctive choice. They read as
     considered rather than generic, and they are what makes this look like itself. */
  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--page); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

h1, h2, h3, h4 {
  margin: 0 0 0.5rem;
  line-height: 1.25;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; letter-spacing: -0.01em; }
p { margin: 0 0 0.75rem; }

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

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

/* ---- Application shell -------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.shell__sidebar {
  flex: 0 0 250px;
  background: var(--nav);
  color: var(--nav-ink);
  display: flex;
  flex-direction: column;
}

.shell__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.shell__topbar {
  position: sticky;
  top: 0;
  z-index: 9;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.shell__content { padding: 1.75rem 2rem 2.5rem; flex: 1 1 auto; }

.brand { padding: 1.6rem 1.15rem 0.9rem; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: #f5f0e8;
  letter-spacing: -0.015em;
}
/* The gold rule under the wordmark is the previous build's signature. */
.brand__name::after {
  content: "";
  display: block;
  height: 1px;
  margin: 0.7rem 0 0.45rem;
  background: linear-gradient(90deg, var(--gold), rgb(226 164 46 / 15%));
}
.brand__sub {
  font-size: 0.5rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #d8e2df;
}

.nav { padding: 0.75rem 0.5rem; display: flex; flex-direction: column; gap: 1px; }
.nav__group {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--nav-label);
  padding: 0.9rem 0.8rem 0.45rem;
  font-weight: 700;
}
.nav a {
  display: flex;
  align-items: center;
  min-height: 2.55rem;
  padding: 0 0.8rem;
  border-radius: 8px;
  color: var(--nav-ink);
  font-size: 0.8125rem;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav a:hover {
  background: rgb(255 255 255 / 6%);
  color: var(--nav-ink-strong);
  text-decoration: none;
}
.nav a.active {
  background: rgb(255 255 255 / 11%);
  color: var(--nav-ink-strong);
  font-weight: 600;
  /* Gold spine on the active item, as before. */
  box-shadow: inset 3px 0 var(--gold);
}

.identity { font-size: 0.75rem; color: var(--ink-faint); text-align: right; }
.identity strong { color: var(--ink); font-weight: 550; }

/* ---- Cards and layout helpers ------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card__title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.card__hint { color: var(--ink-faint); font-size: 0.8125rem; }

.grid { display: grid; gap: 1rem; }
.grid--metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid--two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--fields { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }

.metric { }
.metric__label {
  font-size: 0.625rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}
.metric__value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 0.3rem;
}
.metric__note { font-size: 0.8125rem; color: var(--ink-soft); }

/* ---- Forms -------------------------------------------------------------- */

label { display: block; font-size: 0.8125rem; font-weight: 550; margin-bottom: 0.25rem; color: var(--ink-soft); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-sunken); color: var(--ink-faint); }
textarea { min-height: 5rem; resize: vertical; }

.field { margin-bottom: 0.875rem; }
.field__hint { font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.25rem; }
.field__error { font-size: 0.75rem; color: var(--bad); margin-top: 0.25rem; }

.code-input {
  font-family: var(--font-mono);
  font-size: 1.375rem;
  letter-spacing: 0.35em;
  text-align: center;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.button:hover { background: var(--surface-sunken); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 6px rgb(13 107 96 / 18%);
}
.button--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button--danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.button--quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.button--block { width: 100%; justify-content: center; }

/* ---- Tables ------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data th {
  text-align: left;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.data td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data tbody tr:hover { background: var(--surface-sunken); }
table.data td.numeric, table.data th.numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Status treatments -------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 550;
  white-space: nowrap;
}
.pill--good { background: var(--good-soft); color: var(--good); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--bad { background: var(--bad-soft); color: var(--bad); }
.pill--neutral { background: var(--surface-sunken); color: var(--ink-soft); }

.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.notice--good { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.notice--warn {
  background: linear-gradient(90deg, var(--gold-soft), color-mix(in srgb, var(--gold-soft) 40%, transparent));
  border-color: #ead6a7;
  border-left: 4px solid var(--gold);
  color: var(--gold-ink);
}
.notice--bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* The demonstration-mode and handling-restriction banners must stay legible
   regardless of theme: they are a compliance control, not decoration. */
/* Deliberately the loudest thing on the page. It is a handling restriction, not a
   hint, and it looked like this before for the same reason. */
.banner {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.55rem 1.4rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: #8f321f;
  border-bottom: 1px solid #742717;
}

.muted { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.numeric { font-variant-numeric: tabular-nums; }

/* ---- Sign-in ------------------------------------------------------------ */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth__panel { width: 100%; max-width: 26rem; }
.auth__brand { text-align: center; margin-bottom: 1.5rem; }
.auth__brand h1 { font-family: var(--font-display); font-size: 1.4rem; }
.auth__brand p { color: var(--ink-faint); font-size: 0.875rem; margin: 0; }
.auth__qr {
  display: block;
  margin: 0 auto 1rem;
  width: 190px;
  height: 190px;
  image-rendering: pixelated;
  background: #ffffff;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.auth__secret {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  word-break: break-all;
  background: var(--surface-sunken);
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  text-align: center;
}

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .shell__sidebar { flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav__group { display: none; }
  .shell__content { padding: 1rem; }
}

@media print {
  .shell__sidebar, .shell__topbar, .button { display: none; }
  body { background: #ffffff; }
}

/* ---- First-run setup ----------------------------------------------------- */

.setup {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 3rem;
}

.setup__header { text-align: center; margin-bottom: 1.5rem; }
.setup__title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
.setup__subtitle { color: var(--ink-faint); font-size: 0.875rem; margin-top: 0.125rem; }
.setup__body { width: 100%; max-width: 44rem; }
.setup__footer {
  margin-top: 2rem;
  color: var(--ink-faint);
  font-size: 0.8125rem;
  text-align: center;
  max-width: 40rem;
}

/* Progress rail. Numbers rather than an unlabelled bar, because a setup that
   fails partway through needs the operator to know which step they are on. */
.steps {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  flex-wrap: wrap;
}
.steps__item {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
.steps__marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--surface-sunken);
  color: var(--ink-faint);
}
.steps__item--current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.steps__item--current .steps__marker { background: var(--accent); color: var(--accent-ink); }
.steps__item--done { border-color: var(--good); color: var(--good); }
.steps__item--done .steps__marker { background: var(--good); color: var(--surface); }
.steps__item--pending { color: var(--ink-faint); }

@media (max-width: 560px) {
  .steps__label { display: none; }
}

/* Runnable SQL shown to an administrator to hand to a DBA. Scrolls in its own
   box so a long statement never makes the page scroll sideways. */
pre.script {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0.5rem 0 0;
  white-space: pre;
}

/* --- Judicial time reporting (Government Code § 72.0396) --- */

.metric__hint {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.detail-list > div {
  display: grid;
  grid-template-columns: minmax(140px, 12rem) minmax(0, 1fr);
  gap: 1rem;
  padding: .7rem .1rem;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--ink-faint);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.detail-list dd {
  margin: 0;
  font-size: .9rem;
}

/* The wording a judge signs. Set apart from the surrounding page on purpose:
   this is the sentence they are answerable for, not interface copy. */
.attestation {
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  color: var(--ink);
  background: var(--gold-soft);
  border: 1px solid #eadcb9;
  border-left: 4px solid var(--gold);
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: .98rem;
  line-height: 1.6;
}

.checkbox {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .55rem 0;
  cursor: pointer;
  font-size: .9rem;
}

.checkbox input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: .1rem;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

@media (max-width: 640px) {
  .detail-list > div { grid-template-columns: 1fr; gap: .25rem; }
}

/* --- Period state panel --- */

.period-state {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-faint);
  border-radius: 8px;
}

.period-state--action { border-left-color: var(--gold); background: var(--gold-soft); }
.period-state--warn   { border-left-color: #b8722a; background: #fdf5ec; }
.period-state--done   { border-left-color: var(--accent); background: var(--accent-soft); }
.period-state--quiet  { border-left-color: var(--line); }

.period-state__head {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
}

.period-state__head strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.period-state__detail {
  margin: .5rem 0 0;
  font-size: .9rem;
  line-height: 1.55;
}

.period-state__facts {
  display: flex;
  gap: .5rem 1.25rem;
  flex-wrap: wrap;
  margin-top: .6rem;
  color: var(--ink-faint);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.period-state__next {
  margin: .7rem 0 0;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}

.pill--warn { color: #7d4c14; background: #f8e6cf; }
.pill--gold { color: var(--gold-ink); background: var(--gold-soft); }
