:root {
  --cyan-500: #00adee;
  --cyan-600: #0087cd;
  --mint-400: #42e3b4;
  --lime-400: #a0e720;
  --yellow-400: #faed00;
  --blue-600: #276eb5;
  --blue-900: #003b85;
  --green-800: #087566;
  --green-900: #064e45;
  --ink-950: #10243e;
  --ink-800: #263d57;
  --ink-600: #52677d;
  --ink-500: #718298;
  --line: #dbe4ed;
  --line-strong: #c8d5e1;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --page: #f1f5f8;
  --success: #148664;
  --success-bg: #e4f8f1;
  --warning: #7c6500;
  --warning-bg: #fff9cf;
  --danger: #b33b4b;
  --danger-bg: #fff0f2;
  --shadow-sm: 0 1px 2px rgba(0, 59, 133, .05), 0 4px 14px rgba(16, 36, 62, .04);
  --shadow-md: 0 8px 28px rgba(16, 36, 62, .09);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font: Inter, "SB Sans Display", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 14px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 30px;
  --text-display: 34px;
}

* { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; }
body { margin: 0; color: var(--ink-950); background: var(--page); font-family: var(--font); font-size: var(--text-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
a { color: var(--cyan-600); text-decoration: none; }
a:hover { color: var(--blue-900); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: var(--text-xl); line-height: 1.15; letter-spacing: -.035em; }
h2 { color: var(--ink-950); font-size: var(--text-lg); line-height: 1.3; letter-spacing: -.018em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Brand and header */
.app-header { position: sticky; z-index: 50; top: 0; min-height: 68px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); }
.header-inner { display: flex; max-width: 1280px; min-height: 68px; margin: 0 auto; padding: 0 24px; align-items: center; gap: 28px; }
.brand-link { display: inline-flex; flex: 0 0 auto; align-items: center; }
.brand-full, .wordmark { display: block; }
.wordmark { width: 164px; height: auto; overflow: visible; }
.wordmark-letters { fill: #087c78; }
.brand-compact { display: none; }
.brand-mark { display: block; width: 42px; height: 42px; filter: drop-shadow(0 4px 8px rgba(0, 59, 133, .14)); }
.header-menu { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: space-between; gap: 24px; }
.app-nav { display: flex; align-items: center; gap: 4px; }
.nav-link { position: relative; display: flex; min-height: 38px; padding: 8px 12px; align-items: center; border-radius: var(--radius-sm); color: var(--ink-600); font-size: var(--text-md); font-weight: 650; }
.nav-link:hover { color: var(--blue-900); background: #f0f7fc; }
.nav-link.is-active { color: var(--blue-900); background: #eaf6fc; }
.nav-link.is-active::after { position: absolute; right: 12px; bottom: -16px; left: 12px; height: 2px; border-radius: 2px 2px 0 0; background: linear-gradient(90deg, var(--cyan-500), var(--mint-400)); content: ""; }
.account-menu { display: flex; align-items: center; gap: 9px; }
.role-chip, .user-chip { display: inline-flex; min-height: 36px; padding: 6px 10px; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink-600); background: var(--surface); font-size: var(--text-sm); font-weight: 650; }
.role-chip:hover { color: var(--blue-900); border-color: #a9d9ef; background: #f4fbfe; }
.role-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint-400); box-shadow: 0 0 0 3px rgba(66, 227, 180, .16); }
.user-chip { padding: 4px 10px 4px 4px; color: var(--ink-800); }
.user-avatar { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: var(--blue-900); background: linear-gradient(145deg, #dff8ff, #dff9ef); font-size: var(--text-sm); font-weight: 800; }
.account-menu form { margin: 0; }
.icon-button { display: grid; width: 36px; min-height: 36px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-600); background: var(--surface); cursor: pointer; }
.icon-button:hover { color: var(--blue-900); border-color: var(--line-strong); background: var(--surface-soft); }
.mobile-nav-toggle { display: none; width: 42px; min-height: 42px; margin-left: auto; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.menu-line { display: block; width: 20px; height: 2px; margin: 3px auto; border-radius: 2px; background: var(--blue-900); }

/* Layout and page hierarchy */
.workspace { position: relative; min-height: calc(100vh - 68px); padding: 28px 0 52px; overflow: hidden; }
.workspace::before { position: fixed; z-index: -1; top: 110px; right: -130px; width: 280px; height: 280px; border: 1px solid rgba(0, 173, 238, .08); border-radius: 50%; box-shadow: 0 0 0 38px rgba(0, 173, 238, .025), 0 0 0 76px rgba(39, 110, 181, .018); content: ""; }
.container { position: relative; width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.page-header { display: flex; margin-bottom: 22px; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-header > div:first-child { max-width: 760px; }
.page-header p { margin-bottom: 0; color: var(--ink-600); }
.centered-header { justify-content: center; text-align: center; }
.centered-header > div:first-child { max-width: 620px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--cyan-600); font-size: var(--text-xs); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow-light { color: #a8f2dc; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }

/* Controls */
button, .button { display: inline-flex; min-height: 42px; padding: 9px 16px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 720; line-height: 1.2; cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease; }
button:active, .button:active { transform: translateY(1px); }
.primary { color: white; border-color: var(--cyan-600); background: linear-gradient(135deg, var(--cyan-500), var(--cyan-600)); box-shadow: 0 5px 15px rgba(0, 135, 205, .18); }
.primary:hover { color: white; border-color: #007bbd; background: linear-gradient(135deg, #00a2df, #007fc3); box-shadow: 0 7px 18px rgba(0, 135, 205, .24); }
.secondary { color: var(--green-900); border-color: rgba(6, 78, 69, .3); background: var(--surface); }
.secondary:hover { color: var(--green-900); border-color: rgba(6, 78, 69, .52); background: rgba(66, 227, 180, .08); }
.deep-button { color: white; border-color: var(--green-900); background: var(--green-900); }
.deep-button:hover { background: var(--green-800); }
.success-button { color: #075a43; border-color: #80dfc2; background: var(--success-bg); }
.success-button:hover { color: #034d39; border-color: var(--mint-400); background: #d7f6eb; }
.danger { color: var(--danger); border-color: #efbcc3; background: var(--danger-bg); }
.danger.ghost { border-color: transparent; background: transparent; }
.danger:hover { color: #8f2837; border-color: #e49ba5; background: #ffe7ea; }
.export-button { color: var(--green-900); border-color: rgba(6, 78, 69, .28); background: rgba(66, 227, 180, .08); }
.export-button:hover { color: var(--green-900); border-color: rgba(6, 78, 69, .5); background: rgba(66, 227, 180, .14); }
.export-button span { color: var(--green-800); font-size: var(--text-lg); }
.button-wide { width: 100%; }
.button-icon { font-size: var(--text-lg); font-weight: 400; }
button:disabled, .button:disabled, select:disabled { cursor: not-allowed; opacity: .58; box-shadow: none; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(0, 173, 238, .26); outline-offset: 2px; }

/* Forms and filters */
.form-stack { display: grid; gap: 16px; }
.field { display: flex; min-width: 0; flex-direction: column; color: var(--ink-800); font-size: var(--text-sm); font-weight: 760; letter-spacing: .01em; }
input, select, textarea { width: 100%; min-height: 44px; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink-950); background: var(--surface); font-size: var(--text-md); font-weight: 500; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
input:hover, select:hover, textarea:hover { border-color: #9eb4c7; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan-500); box-shadow: 0 0 0 3px rgba(0, 173, 238, .09); }
input::placeholder, textarea::placeholder { color: #9aa8b7; }
select { padding-right: 36px; }
select:disabled { color: var(--ink-500); background: #eef2f5; }
textarea { min-height: 128px; resize: vertical; line-height: 1.55; }
.filter-panel { display: grid; margin-bottom: 22px; padding: 15px; align-items: end; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); grid-template-columns: minmax(190px, 1.1fr) repeat(2, minmax(180px, 1fr)) auto; }
.filter-panel.compact { grid-template-columns: minmax(200px, 1.2fr) minmax(200px, 1fr) auto; }
.filter-title { display: flex; align-self: center; align-items: center; gap: 10px; }
.filter-title > div { display: grid; }
.filter-title strong { color: var(--ink-950); font-size: var(--text-sm); }
.filter-title small { color: var(--ink-500); font-size: var(--text-xs); }
.filter-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--cyan-600); background: #e8f8fe; font-size: var(--text-lg); }
.filter-icon.locator { color: var(--blue-900); background: #eaf2fb; }
.court-filter { grid-template-columns: minmax(190px, .8fr) minmax(190px, .8fr) minmax(300px, 1.5fr) auto; }
.admin-filters { grid-template-columns: minmax(190px, 1.2fr) repeat(5, minmax(130px, 1fr)) auto; }
.admin-filters .filter-title { grid-column: 1 / -1; padding-bottom: 10px; border-bottom: 1px solid #eaf0f5; }
.audit-filter { grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(180px, 1fr) auto; }
.task-form { padding: 24px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: minmax(180px, .75fr) minmax(260px, 1.5fr) minmax(180px, .75fr); }
.field-full { grid-column: 1 / -1; }
.form-grid-content { grid-template-columns: 1fr; }
.form-section-head { display: flex; padding-bottom: 14px; align-items: flex-start; gap: 12px; border-bottom: 1px solid #eaf0f5; }
.form-section-head:not(:first-child) { margin-top: 8px; }
.form-section-head h2, .section-heading h2 { margin: 1px 0 2px; font-size: var(--text-md); }
.form-section-head p { margin: 0; color: var(--ink-500); font-size: var(--text-sm); }
.section-step { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--blue-900); background: linear-gradient(145deg, #dff8ff, #e3faef); font-size: var(--text-xs); font-weight: 850; }
.form-actions { display: flex; padding-top: 18px; justify-content: flex-end; gap: 10px; border-top: 1px solid #eaf0f5; }

/* Auth */
.auth-page .workspace { display: grid; min-height: calc(100vh - 68px); padding: 36px 0; align-items: center; }
.auth-shell { display: grid; max-width: 920px; margin: 0 auto; overflow: hidden; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-md); grid-template-columns: minmax(350px, .92fr) minmax(360px, 1.08fr); }
.auth-shell-compact { max-width: 480px; grid-template-columns: 1fr; }
.auth-card { padding: 36px; border: 0; border-radius: 0; box-shadow: none; }
.auth-heading { margin-bottom: 24px; }
.auth-heading h1 { font-size: var(--text-xl); }
.auth-heading p, .auth-foot { color: var(--ink-600); }
.auth-foot { margin: 22px 0 0; text-align: center; font-size: var(--text-sm); }
.auth-foot a { font-weight: 750; }
.form-divider { display: flex; align-items: center; gap: 10px; color: var(--ink-500); font-size: var(--text-xs); text-transform: uppercase; }
.form-divider::before, .form-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.auth-context { position: relative; display: flex; min-height: 520px; padding: 46px; overflow: hidden; flex-direction: column; justify-content: center; color: white; background: linear-gradient(145deg, var(--blue-900), #075fa7 64%, var(--cyan-600)); }
.auth-context::before, .auth-context::after { position: absolute; border: 1px solid rgba(255, 255, 255, .13); border-radius: 50%; content: ""; }
.auth-context::before { top: -70px; right: -90px; width: 260px; height: 260px; box-shadow: 0 0 0 42px rgba(255, 255, 255, .035), 0 0 0 84px rgba(255, 255, 255, .02); }
.auth-context::after { right: 52px; bottom: -112px; width: 210px; height: 210px; }
.auth-context > * { position: relative; z-index: 1; }
.auth-context h2 { max-width: 390px; margin: 3px 0 18px; color: white; font-size: var(--text-display); line-height: 1.12; letter-spacing: -.035em; }
.auth-context p { max-width: 410px; color: #d8eafa; font-size: var(--text-md); }
.locator-mark { position: relative; width: 42px; height: 42px; margin-bottom: 24px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 50% 50% 50% 8px; transform: rotate(-45deg); }
.locator-mark span { position: absolute; top: 12px; left: 12px; width: 16px; height: 16px; border: 3px solid var(--mint-400); border-radius: 50%; }
.context-route { display: flex; margin-top: 34px; align-items: center; gap: 9px; color: #eaf6ff; font-size: var(--text-xs); font-weight: 750; letter-spacing: .03em; }
.context-route i { width: 28px; height: 1px; background: linear-gradient(90deg, var(--mint-400), rgba(66, 227, 180, .2)); }

/* Role cards */
.role-grid { display: grid; max-width: 980px; margin: 26px auto 0; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.role-grid form { min-width: 0; }
.role-card { position: relative; display: flex; width: 100%; min-height: 280px; padding: 24px; overflow: hidden; align-items: flex-start; flex-direction: column; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink-950); background: var(--surface); box-shadow: var(--shadow-sm); }
.role-card::after { position: absolute; right: -38px; bottom: -52px; width: 130px; height: 130px; border: 1px solid rgba(0, 173, 238, .11); border-radius: 50%; box-shadow: 0 0 0 22px rgba(0, 173, 238, .025); content: ""; }
.role-card:hover { border-color: #a9d9ef; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.role-number { color: var(--ink-500); font-size: var(--text-xs); font-weight: 800; letter-spacing: .12em; }
.role-icon { display: grid; width: 46px; height: 46px; margin: 25px 0 18px; place-items: center; border-radius: 13px; color: var(--blue-900); background: linear-gradient(145deg, #e4f8fe, #e6faef); font-size: var(--text-lg); font-weight: 500; }
.role-card strong { margin-bottom: 8px; font-size: var(--text-lg); }
.role-card small { max-width: 245px; color: var(--ink-600); font-size: var(--text-sm); line-height: 1.5; }
.role-action { display: flex; width: 100%; margin-top: auto; padding-top: 20px; justify-content: space-between; color: var(--cyan-600); font-size: var(--text-sm); font-weight: 800; }
.role-action b { font-size: var(--text-lg); }

/* Task cards */
.list-toolbar { display: flex; min-height: 42px; margin: 4px 0 10px; align-items: center; justify-content: space-between; gap: 18px; color: var(--ink-600); font-size: var(--text-sm); }
.list-toolbar > div { display: flex; align-items: baseline; gap: 10px; }
.list-toolbar strong { color: var(--ink-950); font-size: var(--text-md); }
.list-toolbar span { color: var(--ink-500); }
.list-toolbar a { font-weight: 700; }
.selection-hint { padding: 5px 9px; border-radius: 14px; background: #edf5fa; }
.task-list { display: grid; gap: 11px; }
.task-card { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); grid-template-columns: minmax(0, 1fr) auto; }
.task-card:hover { border-color: #c3d9e7; box-shadow: 0 5px 18px rgba(16, 36, 62, .07); }
.task-card-main { min-width: 0; padding: 17px 19px; }
.task-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.task-title-row h2 { margin: 3px 0 0; }
.task-title-row h2 a { color: var(--ink-950); }
.task-title-row h2 a:hover { color: var(--cyan-600); }
.task-id { color: var(--ink-500); font-size: var(--text-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.court-line { display: flex; margin-top: 12px; align-items: center; gap: 7px; color: var(--ink-600); font-size: var(--text-sm); }
.court-line strong { color: var(--ink-800); }
.court-line span:last-child { padding-left: 7px; border-left: 1px solid var(--line); }
.locator-dot { width: 8px; height: 8px; flex: 0 0 auto; border: 2px solid var(--cyan-500); border-radius: 50% 50% 50% 1px; transform: rotate(-45deg); }
.task-description { display: -webkit-box; max-width: 880px; margin: 13px 0 0; overflow: hidden; color: var(--ink-600); font-size: var(--text-sm); white-space: pre-wrap; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.task-meta { display: flex; margin-top: 15px; padding-top: 12px; flex-wrap: wrap; gap: 28px; border-top: 1px solid #ebf0f4; }
.task-meta span { display: grid; gap: 1px; }
.task-meta small { color: var(--ink-500); font-size: var(--text-xs); }
.task-meta b { color: var(--ink-800); font-size: var(--text-sm); font-weight: 720; }
.actions { display: flex; min-width: 158px; padding: 14px; align-items: stretch; justify-content: center; flex-direction: column; gap: 7px; border-left: 1px solid #e8eef3; background: #fbfcfd; }
.actions form { display: flex; margin: 0; }
.actions button, .actions .button { width: 100%; white-space: nowrap; }
.admin-task-card { grid-template-columns: minmax(0, 1fr) 220px; }
.admin-actions { min-width: 220px; }
.inline-status { display: grid !important; gap: 6px; }
.inline-status select { margin: 0; }
.task-card.selectable { position: relative; padding-left: 50px; grid-template-columns: 1fr; }
.task-card.selectable > input { position: absolute; top: 19px; left: 18px; width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--cyan-600); }
.task-card.selectable:has(input:checked) { border-color: var(--cyan-500); background: #fbfeff; box-shadow: 0 0 0 2px rgba(0, 173, 238, .1); }
.bulk-action { display: flex; position: sticky; z-index: 15; bottom: 14px; max-width: 680px; margin: 16px auto 0; padding: 9px 10px 9px 16px; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #bddbea; border-radius: 12px; color: var(--ink-600); background: rgba(255, 255, 255, .96); box-shadow: var(--shadow-md); backdrop-filter: blur(12px); font-size: var(--text-xs); }
.handoff-note { display: grid; margin-top: 14px; padding: 10px 12px; gap: 2px; border-left: 3px solid var(--mint-400); border-radius: 0 8px 8px 0; background: #f1fbf7; }
.handoff-note small { color: var(--ink-500); font-size: var(--text-xs); }
.handoff-note strong { color: var(--ink-800); font-size: var(--text-sm); }

/* Statuses, messages and empty states */
.badge { display: inline-flex; min-height: 26px; padding: 4px 9px; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 16px; white-space: nowrap; font-size: var(--text-xs); font-weight: 800; letter-spacing: .015em; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-available { color: #087a68; border-color: #b5ead9; background: #e8f9f3; }
.status-in_progress { color: var(--warning); border-color: #eee39a; background: var(--warning-bg); }
.status-in_progress i { box-shadow: 0 0 0 3px rgba(250, 237, 0, .24); }
.status-completed { color: #176ba0; border-color: #b8dff2; background: #eaf7fd; }
.status-revoked { color: #80515a; border-color: #e5cfd3; background: #f8f1f2; }
.flash { display: flex; margin-bottom: 16px; padding: 11px 14px; align-items: center; gap: 10px; border: 1px solid; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 650; box-shadow: var(--shadow-sm); }
.flash-mark { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border-radius: 50%; font-size: var(--text-xs); font-weight: 900; }
.flash.success { color: #11684f; border-color: #a9dfcf; background: var(--success-bg); }
.flash.success .flash-mark { color: white; background: var(--success); }
.flash.error { color: #8c3040; border-color: #ebbac1; background: var(--danger-bg); }
.flash.error .flash-mark { color: white; background: var(--danger); }
.empty { padding: 54px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: rgba(255, 255, 255, .62); }
.empty-mark { display: grid; width: 46px; height: 46px; margin: 0 auto 15px; place-items: center; border-radius: 14px; color: var(--blue-900); background: linear-gradient(145deg, #e5f8fe, #e5faef); font-size: var(--text-lg); }
.empty h2 { margin-bottom: 6px; font-size: var(--text-lg); }
.empty p { max-width: 420px; margin: 0 auto 18px; color: var(--ink-600); font-size: var(--text-sm); }
.selection-empty { margin-top: 18px; }

/* Task details */
.task-detail-header { align-items: center; }
.detail-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); }
.detail-main, .detail-aside { padding: 22px; }
.section-heading { display: flex; margin-bottom: 20px; padding-bottom: 13px; align-items: center; gap: 10px; border-bottom: 1px solid #eaf0f5; }
.section-heading h2 { margin: 0; }
.detail-block small, .details dt { color: var(--ink-500); font-size: var(--text-xs); font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.detail-block p { margin: 8px 0 0; color: var(--ink-800); font-size: var(--text-md); }
.handoff-note.large { margin-top: 24px; padding: 14px 16px; }
.handoff-note.large strong { font-size: var(--text-md); }
.details { display: grid; margin: 0; gap: 7px; grid-template-columns: 105px 1fr; }
.details dt { padding-top: 4px; }
.details dd { margin: 0; padding: 3px 0 10px; color: var(--ink-800); font-size: var(--text-sm); overflow-wrap: anywhere; }
.preline { white-space: pre-wrap; overflow-wrap: anywhere; }
.page-footer-actions { margin-top: 16px; }

/* Audit table */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-xs); }
th { position: sticky; z-index: 2; top: 0; padding: 11px 12px; text-align: left; color: var(--ink-500); background: #f4f7fa; font-size: var(--text-xs); font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
td { max-width: 260px; padding: 12px; vertical-align: top; color: var(--ink-600); border-top: 1px solid #e9eef3; overflow-wrap: anywhere; }
tbody tr:hover td { background: #f9fcfe; }
.action-code { display: inline-block; padding: 3px 6px; border-radius: 5px; color: var(--blue-900); background: #ecf5fb; font-family: "SFMono-Regular", Consolas, monospace; font-size: var(--text-xs); }
.status-flow { white-space: nowrap; }
.status-flow b { padding: 0 3px; color: var(--cyan-600); }
.json-cell { min-width: 210px; font-family: "SFMono-Regular", Consolas, monospace; font-size: var(--text-xs); }

@media (max-width: 1050px) {
  .admin-filters { grid-template-columns: repeat(3, 1fr); }
  .admin-filters .filter-title { grid-column: 1 / -1; }
  .court-filter { grid-template-columns: 1fr 1fr; }
  .court-filter .filter-title { grid-column: 1 / -1; }
  .role-chip { display: none; }
}

@media (max-width: 820px) {
  .header-inner { min-height: 62px; padding: 0 16px; }
  .app-header { min-height: 62px; }
  .brand-full { display: none; }
  .brand-compact { display: block; }
  .nav-enabled .mobile-nav-toggle { display: block; }
  .header-menu { position: absolute; top: 62px; right: 12px; left: 12px; display: none; padding: 12px; align-items: stretch; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .98); box-shadow: var(--shadow-md); }
  .header-menu.open { display: flex; }
  .app-nav { align-items: stretch; flex-direction: column; }
  .nav-link { padding: 10px 12px; }
  .nav-link.is-active::after { top: 9px; right: auto; bottom: 9px; left: 0; width: 2px; height: auto; }
  .account-menu { padding-top: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); }
  .role-chip { display: inline-flex; }
  .user-chip { margin-right: auto; }
  .workspace { min-height: calc(100vh - 62px); padding: 20px 0 38px; }
  .container { width: min(100% - 28px, 1180px); }
  .page-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .page-header > .button { width: 100%; }
  .filter-panel, .filter-panel.compact, .court-filter, .admin-filters, .audit-filter { grid-template-columns: 1fr 1fr; }
  .filter-title, .court-filter .filter-title, .admin-filters .filter-title { grid-column: 1 / -1; }
  .filter-panel > button { width: 100%; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
  .role-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 210px; }
  .role-icon { margin: 18px 0 12px; }
  .detail-layout { grid-template-columns: 1fr; }
  .auth-shell { max-width: 480px; grid-template-columns: 1fr; }
  .auth-context { display: none; }
  .task-card, .admin-task-card { grid-template-columns: 1fr; }
  .actions { min-width: 0; padding: 11px 15px; align-items: center; flex-direction: row; flex-wrap: wrap; border-top: 1px solid #e8eef3; border-left: 0; }
  .actions form, .actions .button { flex: 1; }
  .admin-actions .inline-status { width: 100%; grid-template-columns: minmax(0, 1fr) auto; }
  .audit-table { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .audit-table table, .audit-table tbody, .audit-table tr, .audit-table td { display: block; width: 100%; }
  .audit-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .audit-table tr { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
  .audit-table td { display: grid; max-width: none; padding: 7px 0; gap: 10px; border-top: 0; border-bottom: 1px solid #edf1f4; grid-template-columns: minmax(105px, .7fr) minmax(0, 1.3fr); }
  .audit-table td:last-child { border-bottom: 0; }
  .audit-table td::before { color: var(--ink-500); content: attr(data-label); font-size: var(--text-xs); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .audit-table td[colspan] { display: block; text-align: center; }
  .audit-table td[colspan]::before { content: none; }
}

@media (max-width: 560px) {
  body { font-size: var(--text-md); }
  h1 { font-size: var(--text-xl); }
  .container { width: min(100% - 20px, 1180px); }
  .workspace { padding-top: 16px; }
  .page-header { margin-bottom: 16px; }
  .filter-panel, .filter-panel.compact, .court-filter, .admin-filters, .audit-filter { padding: 12px; grid-template-columns: 1fr; }
  .filter-title, .court-filter .filter-title, .admin-filters .filter-title { grid-column: 1; }
  .task-form { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide, .field-full { grid-column: 1; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button, .form-actions button { width: 100%; }
  .auth-page .workspace { padding: 16px 0 28px; }
  .auth-card { padding: 25px 20px; }
  .auth-heading h1 { font-size: var(--text-xl); }
  .role-card { min-height: 220px; padding: 20px; }
  .task-card-main { padding: 15px; }
  .task-title-row { flex-direction: column-reverse; gap: 8px; }
  .court-line { align-items: flex-start; flex-wrap: wrap; }
  .court-line span:last-child { width: calc(100% - 16px); margin-left: 15px; padding: 4px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .task-meta { gap: 18px; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions form, .actions .button { width: 100%; }
  .admin-actions .inline-status { grid-template-columns: 1fr; }
  .task-card.selectable { padding-left: 42px; }
  .task-card.selectable > input { left: 14px; }
  .bulk-action { bottom: 8px; padding: 8px; }
  .bulk-action > span { display: none; }
  .bulk-action .button, .bulk-action button { width: 100%; }
  .list-toolbar { align-items: flex-start; flex-direction: column; gap: 5px; }
  .list-toolbar > div { width: 100%; justify-content: space-between; }
  .selection-hint { display: none; }
  .details { grid-template-columns: 90px 1fr; }
  .detail-main, .detail-aside { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
