/* Case & Ticket System (demo) — one stylesheet for every page.
   Light and dark themes follow the device setting. Declaring both stops browsers
   from recolouring the pages on their own ("auto dark mode"). */

:root {
  color-scheme: light dark;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f6;
  --ink: #0f1b2a;
  --ink-2: #344456;
  --muted: #64748b;
  --line: #e1e7ee;
  --line-strong: #cbd5e1;

  --brand: #315ce8;
  --brand-hover: #2448c5;
  --brand-ink: #294fc9;
  --brand-soft: #edf1ff;
  --on-brand: #ffffff;

  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --bad: #c42b2b;
  --bad-hover: #a92222;
  --bad-btn: #c42b2b;
  --bad-btn-hover: #a92222;
  --bad-soft: #fdeceb;
  --warn: #a95c06;
  --warn-soft: #fdf2df;
  --neutral-soft: #eef2f6;

  --focus: 0 0 0 3px rgba(49, 92, 232, 0.22);
  --shadow-sm: 0 1px 2px rgba(15, 27, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 27, 42, 0.05), 0 4px 14px rgba(15, 27, 42, 0.05);
  --radius: 12px;
  --radius-sm: 8px;

  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1218;
    --surface: #121b24;
    --surface-2: #16212c;
    --surface-3: #1b2734;
    --ink: #e7edf3;
    --ink-2: #c2ccd7;
    --muted: #8d9aab;
    --line: #233140;
    --line-strong: #31424f;

    --brand: #4469ed;
    --brand-hover: #5579ff;
    --brand-ink: #a5b8ff;
    --brand-soft: rgba(100, 131, 255, 0.14);
    --on-brand: #ffffff;

    --ok: #4ad083;
    --ok-soft: rgba(74, 208, 131, 0.13);
    --bad: #f27171;
    --bad-hover: #ff8a8a;
    --bad-btn: #c23a3a;
    --bad-btn-hover: #d64848;
    --bad-soft: rgba(242, 113, 113, 0.14);
    --warn: #f1ae4b;
    --warn-soft: rgba(241, 174, 75, 0.14);
    --neutral-soft: #1d2936;

    --focus: 0 0 0 3px rgba(100, 131, 255, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
body.with-captions { padding-bottom: 150px; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 6px; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.005em; margin: 32px 0 12px; }
p { margin: 0 0 12px; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 620; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small { font-size: 13.5px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.page-head { margin-bottom: 22px; }
.page-head p { color: var(--muted); max-width: 760px; margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 550; margin-bottom: 14px; }

/* ---------- Top bar ---------- */
header.top {
  display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap;
  padding: 0 24px; min-height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
header.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 680; letter-spacing: -0.01em; white-space: nowrap; }
header.top .brand img { width: 28px; height: 28px; border-radius: 7px; }
header.top nav { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
header.top nav::-webkit-scrollbar { display: none; }
header.top nav a {
  display: flex; align-items: center; padding: 0 12px; white-space: nowrap;
  color: var(--muted); font-weight: 550; font-size: 14.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
header.top nav a:hover { color: var(--ink); text-decoration: none; }
header.top nav a.active { color: var(--brand-ink); border-bottom-color: var(--brand); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; white-space: nowrap; }
.who .avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 13px;
}
.who .name { font-weight: 600; line-height: 1.2; }
.who .role { color: var(--muted); font-size: 12.5px; line-height: 1.2; }
.demo-badge {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em;
  color: var(--warn); background: var(--warn-soft); padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Buttons and inputs ---------- */
button.primary, button.secondary, button.danger, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
button.primary, .button.primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
button.primary:hover:not(:disabled), .button.primary:hover { background: var(--brand-hover); }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover:not(:disabled), .button.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
button.danger { background: var(--bad-btn); color: #fff; }
button.danger:hover:not(:disabled) { background: var(--bad-btn-hover); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-weight: 560; color: var(--brand-ink);
}
button.link:hover { text-decoration: underline; }
button.ghost {
  font: inherit; font-size: 13.5px; font-weight: 560; color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer;
}
button.ghost:hover { color: var(--ink); border-color: var(--line-strong); }

label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
input[type="text"], input[type="password"], textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: 15px; color: var(--ink);
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
textarea { min-height: 96px; resize: vertical; }
td input[type="text"] { margin: 0 0 4px; min-width: 150px; padding: 7px 10px; font-size: 14px; }
.password-field { position: relative; display: block; margin-top: 6px; }
.password-field input { margin-top: 0; padding-right: 46px; }
.password-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--muted); cursor: pointer;
}
.password-toggle:hover { color: var(--ink); }
.password-toggle:focus-visible { outline: none; color: var(--ink); box-shadow: var(--focus); }
.password-toggle .ui-icon { width: 20px; height: 20px; }
input[type="password"]::-ms-reveal { display: none; }

/* ---------- Cards, grid, badges ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.card .label, .metric .label {
  font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.card.info .value { font-weight: 600; }
.card.info .line { color: var(--ink-2); }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 24px; }
.badges.tight { margin: 10px 0 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.pill.green, .pill.red, .pill.amber { padding-left: 9px; }
.pill.green::before, .pill.red::before, .pill.amber::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}
.pill.green { background: var(--ok-soft); color: var(--ok); }
.pill.red { background: var(--bad-soft); color: var(--bad); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.grey { background: var(--neutral-soft); color: var(--ink-2); }
p.pill { display: flex; white-space: normal; border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0 0; }
p.pill::before { display: none; }

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  position: sticky; top: 0; background: var(--surface-2);
  font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td a { font-weight: 600; }
td.key, td.nowrap a { font-family: var(--mono); font-size: 13.5px; }
tr.hidden-item td { color: var(--muted); font-style: italic; }
td .pill + .pill { margin-left: 4px; }

/* ---------- Health screen ---------- */
.status-hero {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px;
  padding: 26px 28px; border-radius: 16px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.status-hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; }
.status-hero.up { background: linear-gradient(90deg, var(--ok-soft), transparent 70%), var(--surface); }
.status-hero.up::before { background: var(--ok); }
.status-hero.down { background: linear-gradient(90deg, var(--bad-soft), transparent 70%), var(--surface); }
.status-hero.down::before { background: var(--bad); }
.status-dot { position: relative; width: 56px; height: 56px; border-radius: 50%; flex: none; margin: 0 14px 0 10px; }
.status-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; animation: ring 2.4s ease-out infinite; }
.status-hero.up .status-dot { background: var(--ok); box-shadow: 0 0 0 8px var(--ok-soft); }
.status-hero.up .status-dot::after { border: 2px solid var(--ok); }
.status-hero.down .status-dot { background: var(--bad); box-shadow: 0 0 0 8px var(--bad-soft); animation: blink 1s steps(2, start) infinite; }
.status-hero.down .status-dot::after { border: 2px solid var(--bad); animation-duration: 1.2s; }
@keyframes ring { from { transform: scale(1); opacity: 0.55; } to { transform: scale(1.45); opacity: 0; } }
@keyframes blink { 50% { opacity: 0.55; } }
.status-text { font-size: 32px; font-weight: 720; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.status-hero.up .status-text { color: var(--ok); }
.status-hero.down .status-text { color: var(--bad); }
.status-sub { font-size: 16px; color: var(--ink-2); margin-top: 4px; }
.clock { text-align: right; font-variant-numeric: tabular-nums; padding-left: 22px; border-left: 1px solid var(--line); }
.clock .time { font-size: 30px; font-weight: 680; letter-spacing: -0.01em; }
.metric { display: flex; flex-direction: column; min-height: 118px; }
.metric .value { font-size: 21px; font-weight: 680; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.metric .detail { font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 6px; }

/* ---------- Control panel ---------- */
.action-card { display: flex; flex-direction: column; gap: 8px; }
.action-card strong { font-size: 15.5px; }
.action-card p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.action-card button { margin-top: auto; align-self: flex-start; }
.running-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius); margin-bottom: 16px;
  background: var(--warn-soft); color: var(--warn); font-weight: 650; border: 1px solid transparent;
}
.running-banner::before {
  content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sign-in ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
body.login main { width: 100%; max-width: 420px; padding: 0; }
.login-card { padding: 32px; box-shadow: var(--shadow); }
.login-card .brand-mark { width: 44px; height: 44px; border-radius: 11px; margin-bottom: 18px; }
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-card .demo-badge { margin-bottom: 14px; }
.login-card form p { margin: 0 0 16px; }
.login-card button.primary { width: 100%; min-height: 44px; margin-top: 4px; }
.login-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ---------- Phone / tablet view ---------- */
.field main { max-width: 680px; padding: 18px 16px 40px; }
.netbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 10px 16px; font-size: 14px; border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(6px);
}
.netbar #net-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.netbar #net-state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.netbar #net-queue { color: var(--ink-2); font-size: 13px; }
.netbar button { margin-left: auto; min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.netbar.online { background: color-mix(in srgb, var(--ok-soft) 88%, var(--surface)); color: var(--ok); }
.netbar.offline { background: color-mix(in srgb, var(--warn-soft) 92%, var(--surface)); color: var(--warn); }
.job {
  display: block; position: relative; text-decoration: none; color: inherit;
  margin-bottom: 12px; padding: 16px 44px 16px 18px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.job::after {
  content: ""; position: absolute; right: 20px; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-50%) rotate(-45deg);
}
.job:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow); }
.job:active { transform: scale(0.995); }
.job strong { font-size: 15.5px; }
.job .pill { margin-top: 8px; }
.section { margin-top: 26px; }
.contact, .equipment { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.contact:last-child, .equipment:last-child { border-bottom: 0; }
.list-card { padding: 4px 18px; }
.file-button { position: relative; overflow: hidden; }
.file-button input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.form-actions { display: flex; gap: 10px; margin: 10px 0 0; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; margin-bottom: 14px; }
.photos figure { margin: 0; }
.photos img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-3);
}
.photos figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.note {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 10px; font-size: 14.5px;
}
.note.pending { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.note .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.pending-tag { font-size: 12px; font-weight: 700; color: var(--warn); }
pre.preview {
  background: #0d1620; color: #d7f5ec; border: 1px solid var(--line);
  padding: 16px; border-radius: var(--radius); overflow: auto; font: 13px/1.6 var(--mono);
}

/* ---------- Caption bar for the recorded video: always at the BOTTOM of the screen ---------- */
#caption-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(8, 13, 19, 0.94); color: #fff; padding: 16px 32px 18px; text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#caption-bar .chapter { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6ee0cf; margin-bottom: 6px; }
#caption-bar .text { font-size: 27px; font-weight: 600; line-height: 1.32; max-width: 1200px; margin: 0 auto; }
#caption-bar .hint { font-size: 12px; color: #7d8a97; margin-top: 8px; font-variant-numeric: tabular-nums; }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  main { padding: 20px 16px 40px; }
  h1 { font-size: 22px; }
  header.top { padding: 10px 16px 0; gap: 8px 12px; }
  header.top .brand { order: 1; }
  .who { order: 2; }
  .who .name, .who .role { display: none; }
  header.top nav { order: 3; flex: 0 0 calc(100% + 32px); max-width: calc(100% + 32px); min-height: 44px; margin: 0 -16px; padding: 0 8px; }
  header.top .brand .demo-badge { display: none; }
  .status-hero { grid-template-columns: auto 1fr; padding: 20px; gap: 16px; }
  .status-dot { width: 42px; height: 42px; margin: 0 8px 0 6px; }
  .status-text { font-size: 24px; }
  .clock { grid-column: 1 / -1; text-align: left; border-left: 0; padding-left: 0; display: flex; gap: 12px; align-items: baseline; }
  .clock .time { font-size: 20px; }
  #caption-bar .text { font-size: 19px; }
  th, td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Workspace layout */
body.workspace { padding-left: 232px; }
.workspace main { max-width: 1600px; padding: 44px 40px 64px; }
header.top { position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 20; padding: 30px 18px 20px; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 34px; border: 0; border-right: 1px solid var(--line); box-shadow: none; }
header.top .brand { flex-wrap: wrap; gap: 10px; padding: 0 8px; font-size: 18px; }
header.top .brand img { width: 34px; height: 34px; }
header.top .brand .demo-badge { margin-left: 44px; font-size: 11px; background: var(--surface-3); color: var(--muted); }
header.top nav { flex-direction: column; gap: 7px; overflow: visible; }
header.top nav a { gap: 12px; padding: 12px 14px; min-height: 46px; margin: 0; border: 0; border-radius: 8px; font-size: 14px; }
header.top nav a:hover { background: var(--surface-2); }
header.top nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.nav-icon { width: 19px; height: 19px; flex: none; }
.who { margin: auto 0 0; flex-wrap: wrap; padding: 20px 6px 0; border-top: 1px solid var(--line); gap: 12px; }
.who .avatar { width: 38px; height: 38px; border-radius: 12px; }
.who button { width: 100%; margin-top: 6px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -.035em; margin-bottom: 10px; }
.page-head p { font-size: 15px; max-width: 680px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
h2 { font-size: 18px; margin-top: 32px; }
.card { padding: 24px; box-shadow: none; }
.grid { gap: 18px; }
.metric { min-height: 138px; }
.metric .value { font-size: 26px; }
.metric .label, .card .label { font-size: 12px; letter-spacing: .035em; }
.status-hero { box-shadow: none; padding: 30px; }
.status-hero.up { background: var(--surface); }
.status-dot { width: 28px; height: 28px; }
.status-dot::after { animation: none; }
.status-text { font-size: 28px; }
.status-sub { font-size: 14px; }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 28px; }
.summary-card { padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.summary-card span { display: block; color: var(--muted); font-size: 14px; }
.summary-card strong { display: block; font-size: 30px; letter-spacing: -.03em; margin-top: 8px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.summary-card:first-child { border-top: 3px solid var(--brand); padding-top: 18px; }
.case-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.case-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.case-filters button { border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 9px 13px; font: inherit; font-size: 14px; cursor: pointer; }
.case-filters button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.case-search { width: min(100%, 290px); }
.case-search input { margin: 0; background: var(--surface-2); font-size: 14px; }
.table-scroll { overflow-x: auto; }
.cases-table { min-width: 1050px; }
.table-wrap { box-shadow: none; }
th { font-size: 11px; padding: 10px 16px; background: var(--surface-2); }
td { padding: 10px 16px; font-size: 14px; vertical-align: middle; }
.case-title { min-width: 210px; font-weight: 600; display: block; color: var(--ink); margin-bottom: 5px; }
.case-reference { font-size: 12px; color: var(--muted); }
.pill { font-size: 12px; border-radius: 6px; }
td .pill { margin: 0; }
.table-footer { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
body.login { background: var(--bg); }
body.login main { max-width: 460px; }
.login-card { padding: 40px; border-top: 3px solid var(--brand); box-shadow: 0 16px 60px rgba(20,35,70,.06); }
.login-card h1 { font-size: 28px; letter-spacing: -.03em; }
.login-card form { margin-top: 28px; }
label { font-size: 14px; }
.action-card strong { font-size: 17px; }
.field main { max-width: 820px; }
.job { padding: 22px 44px 22px 22px; }
@media (min-width: 1400px) { .workspace main > .grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1100px) {
  body.workspace { padding-left: 206px; }
  header.top { width: 206px; padding-inline: 12px; }
  .workspace main { padding: 32px 24px 48px; }
  .summary-grid { gap: 10px; }
  .summary-card { padding: 16px; }
  .summary-card:first-child { padding-top: 14px; }
}
@media (max-width: 760px) {
  body.workspace { padding-left: 0; }
  header.top { position: static; width: auto; padding: 16px 16px 0; flex-direction: row; flex-wrap: wrap; gap: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  header.top .brand { padding: 0; font-size: 17px; }
  header.top .brand img { width: 30px; height: 30px; }
  header.top nav { flex-direction: row; overflow-x: auto; gap: 4px; padding: 0 12px 10px; }
  header.top nav a { min-height: 40px; padding: 8px 10px; font-size: 13px; }
  .nav-icon { width: 16px; height: 16px; }
  .who { margin: 0 0 0 auto; border: 0; padding: 0; gap: 8px; flex-wrap: nowrap; }
  .who .avatar { display: none; }
  .who button { width: auto; margin: 0; }
  .workspace main { padding: 28px 16px 40px; }
  .page-head h1 { font-size: 28px; }
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 20px; }
  .summary-card strong { font-size: 26px; }
  .case-toolbar { align-items: stretch; flex-direction: column; gap: 12px; padding: 16px; }
  .case-search { width: 100%; }
  .login-card { padding: 28px; }
  .status-text { font-size: 23px; }
}

@media (max-width: 760px) {
  .cases-table { min-width: 0; }
  .cases-table thead { display: none; }
  .cases-table tbody { display: block; }
  .cases-table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 14px 16px; gap: 10px 16px; border-bottom: 1px solid var(--line); }
  .cases-table tr:last-child { border-bottom: 0; }
  .cases-table td { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; }
  .cases-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
  .cases-table td:nth-child(1), .cases-table td:nth-child(2), .cases-table td:nth-child(7), .cases-table td[colspan] { grid-column: 1 / -1; }
  .cases-table td:nth-child(1)::before, .cases-table td:nth-child(2)::before { display: none; }
  .cases-table td:nth-child(2) { margin-top: -6px; }
  .case-title { min-width: 0; font-size: 16px; }
  .cases-table td .pill { white-space: normal; }
}

/* Control-panel actions: descriptive controls with stable keyboard focus. */
#buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.control-action { padding: 24px; gap: 0; transition: border-color .18s, box-shadow .18s; }
.control-action:hover, .control-action:focus-within { border-color: var(--line-strong); box-shadow: 0 6px 20px rgba(20,35,70,.05); }
.action-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.action-symbol { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); }
.action-symbol svg { width: 22px; height: 22px; }
.action-category { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.control-action h2 { margin: 0 0 10px; font-size: 17px; line-height: 1.4; letter-spacing: -.015em; }
.control-action p { font-size: 14px; line-height: 1.65; margin: 0 0 24px; }
.action-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.control-action .action-button { min-height: 44px; padding: 0 16px; gap: 9px; font-size: 14px; border-radius: 9px; width: 100%; margin: 0; box-shadow: 0 2px 3px rgba(20,35,70,.06); }
.action-button svg { width: 17px; height: 17px; flex: none; }
.control-action .action-button:active:not(:disabled) { transform: translateY(1px); }
.control-action.caution .action-symbol { background: var(--bad-soft); color: var(--bad); }
.control-action.caution .action-button { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 28%, var(--line)); background: var(--surface); box-shadow: none; }
.control-action.caution .action-button:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }
.control-action .action-button:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 3px; }
.control-action .action-button:disabled { box-shadow: none; opacity: .5; }
@media (max-width: 1200px) { #buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { #buttons { grid-template-columns: 1fr; gap: 16px; } .control-action { padding: 22px; } }

/* Shared action language across all screens. */
.ui-icon { width: 18px; height: 18px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
header.top nav .ui-icon { width: 19px; height: 19px; }
button.primary, button.secondary, button.danger, .button, button.ghost, button.link, .back-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 9px;
  font: 600 14px/1.35 var(--font); text-decoration: none;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
button.primary, .button.primary { border: 1px solid var(--brand); box-shadow: 0 2px 3px rgba(20,35,70,.08); }
button.secondary, .button.secondary { border: 1px solid var(--line-strong); }
button.ghost { border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
button.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
button.link, .back-link { background: var(--brand-soft); border: 1px solid transparent; color: var(--brand-ink); min-height: 38px; padding: 8px 12px; font-size: 13px; }
button.link:hover:not(:disabled), .back-link:hover { background: var(--surface); border-color: var(--brand-ink); text-decoration: none; }
button:focus-visible, a:focus-visible, .file-button:focus-within { outline: 2px solid var(--brand-ink); outline-offset: 3px; box-shadow: none; }
button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.form-actions { flex-wrap: wrap; gap: 12px; }
td button.link { white-space: nowrap; margin-top: 4px; }
.back-link { margin-bottom: 20px; }
.page-head p a, .contact a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--brand-ink) 45%, transparent); }
.contact a { display: inline-flex; align-items: center; min-height: 36px; overflow-wrap: anywhere; }
.case-filters button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; font-weight: 550; border: 1px solid transparent; }
.case-filters button:hover { background: var(--surface-2); color: var(--ink); }
.case-filters button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.case-filters .ui-icon { width: 16px; height: 16px; }
.case-search { position: relative; }
.case-search > .ui-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.case-search input { padding-left: 38px; min-height: 44px; }
.netbar button { min-height: 42px; font-size: 14px; }
.file-button { cursor: pointer; }
.file-button:hover { background: var(--surface-2); border-color: var(--brand-ink); }
.job::after { display: none; }
.job { padding-right: 22px; }
.job:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 3px; }
@media (max-width: 760px) {
  button.link, .back-link { min-height: 44px; }
  header.top nav a { min-height: 44px; }
  .case-filters { gap: 3px; }
  .case-filters button { padding: 9px 10px; font-size: 13px; }
  .form-actions > button { flex: 1 1 auto; }
}

/* Casework logo (full wordmark; a light-lettering version is used in dark mode) */
header.top .brand picture { display: flex; }
header.top .brand img.brand-logo { width: auto; height: 34px; border-radius: 0; }
header.top .brand .demo-badge { margin-left: 2px; }
.login-card picture { display: block; margin-bottom: 22px; }
.login-card .login-logo { display: block; width: auto; height: 46px; }
@media (max-width: 760px) {
  header.top .brand img.brand-logo { height: 28px; }
}

/* Main menu on phones: all four tabs always visible (icon above a short label), no hidden scrolling */
header.top nav .nav-short { display: none; }
@media (max-width: 760px) {
  header.top nav {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
    flex: 0 0 100%; max-width: 100%; margin: 0; padding: 0 0 10px; overflow: visible;
  }
  header.top nav a {
    flex-direction: column; justify-content: center; gap: 4px;
    min-height: 56px; padding: 8px 4px; margin: 0;
    font-size: 12px; line-height: 1.2; text-align: center; border-radius: 10px;
  }
  header.top nav .nav-long { display: none; }
  header.top nav .nav-short { display: block; white-space: nowrap; }
  header.top nav .ui-icon { width: 21px; height: 21px; }
}

/* Security rules: notices, the authenticator step, the control-panel switch and the health-screen line */
.notice { border-radius: 10px; padding: 12px 14px; margin: 0 0 18px; background: var(--brand-soft); color: var(--ink); font-size: 14.5px; line-height: 1.5; border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.step-title { font-size: 18px; margin: 4px 0 10px; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; }
.steps li { margin-bottom: 4px; }
.qr { display: block; width: 200px; height: 200px; margin: 6px auto 12px; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
code { font-family: var(--mono); font-size: 13px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }
.security-card { margin-bottom: 20px; }
.security-card .security-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.security-card h2 { margin: 0 0 8px; font-size: 18px; }
.security-card p { max-width: 820px; }
.rules-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 18px; margin-bottom: 14px; }
.rules-bar .label { margin: 0; }
.rules-bar #rules-text { font-size: 14px; color: var(--ink-2); }
.rules-bar.on { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.rules-bar.on #rules-text { color: var(--ok); font-weight: 600; }

/* @name suggestions under the note box, and the number on a map pin shared by several jobs. */
.mention-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mention-suggest button { border: 1px solid var(--line, #e1e7ee); border-radius: 999px; padding: 4px 10px; background: var(--surface, #fff); }
.leaflet-tooltip.pin-count { background: transparent; border: 0; box-shadow: none; color: #fff; font-weight: 700; font-size: 12px; padding: 0; }
.leaflet-tooltip.pin-count::before { display: none; }
tr.off td { color: var(--muted, #64748b); }
form.stack { display: grid; gap: 6px; margin-top: 6px; }
.level-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.mention-new { display: inline-block; margin-left: 6px; }
.health-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.health-tile .health-main { font-size: 16px; font-weight: 600; margin: 6px 0 4px; }
