:root {
  color-scheme: light;
  --canvas: #f5f6f0;
  --surface: #fff;
  --ink: #1c2722;
  --muted: #52615a;
  --line: #d8dfd9;
  --control: #9daaa2;
  --rail: #15332a;
  --rail-accent: #29473c;
  --rail-dim: #bdcfc5;
  --green: #22634b;
  --green-dark: #164834;
  --mint: #d7e9dd;
  --focus: #23699c;
  --sidebar-width: 14rem;
  --radius: 8px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font: 14px/1.5 var(--font);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: var(--green-dark); text-underline-offset: 0.22em; }
a:hover { color: var(--green); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
button, input, details, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.app-sidebar :focus-visible, .mobile-nav-panel :focus-visible { outline-color: #ffdc9c; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: 1rem;
  left: 1rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-180%);
  border: 2px solid var(--green);
  border-radius: var(--radius);
  background: var(--surface);
}
.skip-link:focus { transform: translateY(0); }
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: 100dvh;
  overflow: auto;
  background: var(--rail);
  color: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.3rem 1.1rem;
  min-height: 5rem;
  color: var(--surface);
  text-decoration: none;
}
.brand:hover { color: var(--surface); background: var(--rail-accent); }
.brand-mark {
  display: grid;
  flex: 0 0 2.45rem;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border-radius: 45% 19% 44% 19%;
  background: #d8ed80;
  color: var(--rail);
  font-size: 0.94rem;
  font-weight: 850;
  font-style: italic;
  letter-spacing: -0.035em;
}
.brand-name { display: grid; font-size: 1.06rem; font-weight: 700; line-height: 1.2; }
.brand-name small { margin-top: 0.22rem; color: var(--rail-dim); font-size: 0.78rem; font-weight: 500; }
.app-nav { display: grid; gap: 0.24rem; padding: 0.85rem 0.75rem; border-top: 1px solid #365247; }
.app-nav a {
  display: flex;
  align-items: center;
  min-height: 2.85rem;
  padding: 0.4rem 0.65rem;
  border-inline-start: 3px solid transparent;
  border-radius: 3px;
  color: var(--rail-dim);
  text-decoration: none;
  font-weight: 550;
}
.app-nav a:hover { color: var(--surface); background: var(--rail-accent); }
.app-nav a[aria-current="page"] { border-inline-start-color: #d8ed80; background: var(--rail-accent); color: var(--surface); }
.sidebar-account { display: grid; gap: 0.1rem; margin-top: auto; padding: 0.9rem 1.1rem; border-top: 1px solid #365247; }
.account-name { color: var(--surface); font-size: 0.93rem; font-weight: 650; overflow-wrap: anywhere; }
.account-logout { min-height: 2.25rem; padding: 0; border: 0; background: transparent; color: var(--rail-dim); font-size: 0.86rem; }
.account-logout:hover { color: var(--surface); text-decoration: underline; }
.account-settings { display: inline-flex; align-items: center; width: fit-content; min-height: 2.25rem; color: var(--rail-dim); font-size: .86rem; }
.account-settings:hover { color: white; }
.form-grid.password-fields { grid-template-columns: minmax(0, 1fr); }
.site-summary, .access-roster { display: grid; gap: .7rem; padding: 0; margin: 0; list-style: none; }
.site-summary li, .access-roster li { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .45rem .85rem; }
.site-summary span, .access-roster p { color: var(--muted); }
.account-roster { margin-top: 1rem; }
.access-roster { gap: 0; }
.access-roster li { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.access-roster li:last-child { border: 0; }
.activation-code { display: block; width: fit-content; padding: .6rem .8rem; background: #edf2e8; overflow-wrap: anywhere; user-select: all; }
.app-stage { min-width: 0; }
.app-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  min-height: 4rem;
  padding: 0.5rem clamp(1rem, 3vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.workspace { min-width: 0; max-width: 100%; }
.workspace-name { font-weight: 670; overflow-wrap: anywhere; }
.workspace-switch { position: relative; max-width: 100%; }
.workspace-switch summary, .mobile-nav summary { display: flex; align-items: center; gap: 0.65rem; cursor: pointer; list-style: none; }
.workspace-switch summary::-webkit-details-marker, .mobile-nav summary::-webkit-details-marker { display: none; }
.workspace-switch summary { min-height: 2.5rem; padding: 0.35rem 0.55rem; border-radius: var(--radius); font-weight: 670; overflow-wrap: anywhere; }
.workspace-switch summary:hover { background: var(--canvas); }
.chevron { width: 0.45rem; height: 0.45rem; margin-top: -0.15rem; transform: rotate(45deg); border-right: 1.5px solid; border-bottom: 1.5px solid; }
.workspace-switch[open] .chevron { transform: rotate(225deg); margin-top: 0.15rem; }
.workspace-switch ul {
  position: absolute;
  inset-inline-start: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(18rem, 70vw);
  margin: 0.35rem 0 0;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 18px #172c251c;
  list-style: none;
}
.workspace-switch a { display: block; padding: 0.55rem 0.65rem; border-radius: 3px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.workspace-switch a:hover { background: var(--canvas); }
.mobile-nav { display: none; }
.app-content { width: 100%; max-width: 100rem; margin: 0 auto; padding: clamp(1.25rem, 3.25vw, 3rem) clamp(1rem, 3vw, 3rem) 3rem; }
.app-content:focus { outline: none; }
.is-anonymous .app-stage { display: grid; align-items: start; }
.is-anonymous .app-content { max-width: 34rem; padding-top: clamp(2rem, 10vh, 7rem); }

.breadcrumb, .breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1.05rem; color: var(--muted); font-size: 0.88rem; }
.breadcrumb ol, .breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.breadcrumb li + li::before, .breadcrumbs li + li::before { margin-right: 0.5rem; content: "/"; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
:is(h1, .page-heading) { font-size: clamp(1.7rem, 3.2vw, 2.35rem); font-weight: 740; letter-spacing: -0.035em; line-height: 1.08; }
.page-heading:has(h1), .page-heading:has(h2) { font-size: inherit; letter-spacing: normal; line-height: inherit; }
:is(h2, h3) { font-size: 1.08rem; font-weight: 710; line-height: 1.3; }
h3 { font-size: 1rem; }
.page-lede { max-width: 64ch; margin-top: 0.55rem; color: var(--muted); }
.page-actions, .toolbar, .toolbar-group, .filter-form, .form-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 0.55rem; }
.toolbar { justify-content: space-between; margin: 0 0 0.8rem; }
.toolbar-group, .filter-form { align-items: end; }
.muted, .field-help { color: var(--muted); }
.link { font-weight: 640; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.65rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 660;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.button:hover { background: #edf2ed; color: var(--ink); }
.button-primary { border-color: var(--green); background: var(--green); color: var(--surface); }
.button-primary:hover { border-color: var(--green-dark); background: var(--green-dark); color: var(--surface); }
.button-quiet { border-color: transparent; background: transparent; color: var(--green-dark); }
.button-danger { border-color: #9c392f; background: #9c392f; color: var(--surface); }
.button-danger:hover { border-color: #7d3027; background: #7d3027; color: var(--surface); }
.button-small { min-height: 2.25rem; padding: 0.3rem 0.6rem; font-size: 0.88rem; }
.button:disabled, .button[aria-disabled="true"] { cursor: default; opacity: 0.55; }

.tabs { display: flex; gap: 1.1rem; margin: 0 0 1.05rem; padding: 0; overflow-x: auto; border-bottom: 1px solid var(--line); list-style: none; }
.tabs :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 2.7rem;
  padding: 0 0.1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 640;
  text-decoration: none;
  white-space: nowrap;
}
.tabs :is(a, button):hover { color: var(--green-dark); }
.tabs :is([aria-current="page"], [aria-current="true"], [aria-selected="true"], .is-active) { border-bottom-color: var(--green); color: var(--ink); }
.tabs :is(a, button):focus-visible { outline-offset: -3px; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; border-spacing: 0; text-align: start; }
.data-table caption { padding: 0.75rem; font-weight: 670; text-align: start; }
.data-table :is(th, td) { padding: 0.58rem 0.85rem; border-bottom: 1px solid var(--line); text-align: start; }
.data-table th { background: #edf1ec; color: #3b4b42; font-size: 0.85rem; font-weight: 690; white-space: nowrap; }
.data-table th[scope="row"] { background: inherit; color: var(--ink); font-size: inherit; font-weight: 640; white-space: normal; }
.data-table td { vertical-align: middle; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody tr:hover { background: #f0f5f1; }
.data-table tbody tr:focus-within { background: #f0f5f1; }
.data-table td.align-end, .data-table th.align-end { text-align: end; }
.cell-title { display: block; color: var(--ink); font-weight: 670; }
a.cell-title:hover { color: var(--green); }
.cell-subtitle { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.84rem; }
.nowrap { white-space: nowrap; }
.numeric { font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  max-width: 100%;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #edf0ed;
  color: #414d45;
  font-size: 0.8rem;
  font-weight: 680;
  line-height: 1.25;
}
.badge-info { background: #e4eff6; color: #234d69; }
.badge-warning { background: #fff0d6; color: #744109; }
.badge-danger { background: #fbe6e2; color: #862e25; }
.badge-success { background: #e0f0e6; color: #20543a; }

.empty-state { display: grid; justify-items: start; gap: 0.5rem; padding: clamp(1rem, 2.8vw, 2rem); border: 1px dashed var(--control); border-radius: var(--radius); color: var(--muted); }
.empty-state :is(h2, h3) { color: var(--ink); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 19rem); align-items: start; gap: 1.2rem; }
.detail-main, .detail-rail { display: grid; gap: 1rem; min-width: 0; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.82rem 1rem; border-bottom: 1px solid var(--line); }
.panel-body { padding: 1rem; }
.panel-body > * + * { margin-top: 0.8rem; }
.meta-list { display: grid; gap: 0.65rem; margin: 0; }
.meta-list > div { display: grid; gap: 0.12rem; }
.meta-list dt { color: var(--muted); font-size: 0.83rem; }
.meta-list dd { margin: 0; font-weight: 580; overflow-wrap: anywhere; }
.steps { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.steps > * { flex: 1 1 7rem; padding: 0.48rem 0.1rem 0; border-top: 3px solid var(--line); color: var(--muted); font-size: 0.87rem; }
.steps .is-complete, .steps .is-current, .steps [aria-current="step"] { border-color: var(--green); }
.steps .is-current, .steps [aria-current="step"] { color: var(--ink); font-weight: 720; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline > li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.timeline > li:first-child { padding-top: 0; }
.timeline > li:last-child { border: 0; padding-bottom: 0; }
.timeline time { color: var(--muted); font-size: 0.84rem; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1rem; }
.form-grid > :is(.field-wide, .form-actions, fieldset, .errorlist, .notice) { grid-column: 1 / -1; }
.field, .form-grid > p { display: grid; align-content: start; gap: 0.3rem; margin: 0; }
.field label, .form-grid label, .filter-form label { color: var(--ink); font-size: 0.88rem; font-weight: 660; }
.field-help, .helptext { display: block; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }
.field :is(input[type="checkbox"], input[type="radio"]) { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--green); }
input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: 0.45rem 0.62rem;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="file"] { padding: 0.34rem; }
input[type="file"]::file-selector-button { padding: 0.35rem 0.45rem; border: 0; border-radius: 3px; background: #edf1ec; color: var(--ink); font: inherit; }
textarea { min-height: 7.2rem; resize: vertical; }
fieldset { min-width: 0; margin: 0; padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); }
legend { padding: 0 0.25rem; font-weight: 670; }
.search-field { width: clamp(11rem, 26vw, 20rem); }
.form-actions { margin-top: 0.4rem; }
.form-grid .form-actions { margin-top: 0; }
.errorlist { margin: 0; padding: 0 0 0 1.15rem; color: #862e25; font-size: 0.86rem; }
[aria-invalid="true"] { border-color: #9c392f; }

.flash-messages { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.notice { padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: var(--radius); background: #ecf3ee; color: var(--ink); }
.notice:is(.warning, .notice-warning) { border-color: #d5b67b; border-left-color: #9c671b; background: #fff4df; }
.notice:is(.error, .notice-error) { border-color: #d8a299; border-left-color: #9c392f; background: #fbece9; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 70rem) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) minmax(12rem, 15rem); }
  .data-table :is(th, td) { padding-inline: 0.65rem; }
}

@media (max-width: 54rem) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .app-sidebar { position: static; height: auto; }
  .app-sidebar > :is(.app-nav, .sidebar-account) { display: none; }
  .brand { min-height: 3.7rem; padding: 0.55rem 1rem; }
  .brand-mark { flex-basis: 2.1rem; width: 2.1rem; height: 2.1rem; }
  .brand-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.6rem; }
  .brand-name small { margin-top: 0; }
  .app-header { min-height: 3.4rem; justify-content: space-between; gap: 0.7rem; }
  .mobile-nav { display: block; }
  .mobile-nav summary { min-height: 2.5rem; padding: 0.45rem 0.58rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: 0.88rem; font-weight: 670; }
  .mobile-nav[open] summary { border-color: var(--control); background: var(--canvas); }
  .menu-icon { width: 0.86rem; height: 0.64rem; border-block: 1.5px solid; }
  .menu-icon::before { display: block; width: 100%; height: 100%; background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat; content: ""; }
  .mobile-nav-panel { position: absolute; inset-block-start: 100%; inset-inline-start: 1rem; width: min(17rem, calc(100vw - 2rem)); max-height: 65dvh; overflow: auto; border-radius: var(--radius); background: var(--rail); box-shadow: 0 7px 19px #172c2533; }
  .mobile-nav-panel .app-nav { border-top: 0; }
  .workspace-switch ul { inset-inline: auto 0; }
  .data-table { min-width: 42rem; }
}

@media (max-width: 38rem) {
  .detail-layout, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: start; }
  .page-actions { width: 100%; }
  .toolbar, .filter-form { align-items: stretch; }
  .search-field { width: 100%; }
  .tabs { gap: 0.9rem; }
  .tabs > * { flex: none; }
}

.preview-note { display: inline-flex; align-items: center; gap: .45rem; margin-inline-start: auto; color: var(--muted); font-size: 0.82rem; }
.preview-note > span { width: .52rem; height: .52rem; background: #65843f; border-radius: 100%; flex: none; }
.timeline li > strong, .timeline li > span { display: block; }
.timeline li > span { color: var(--muted); font-size: 0.87rem; }
.auth-panel { max-width: 28rem; }
.command-panel { max-width: 44rem; }
.toolbar .tabs { margin-bottom: 0; }
.quiz-question { margin: 0; padding: 0; border: 0; }
.quiz-question label { display: flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; font-weight: normal; }
.quiz-question legend { margin-bottom: 0.25rem; font-weight: 650; }

.section-label {
  color: #476454;
  font-size: .77rem;
  font-weight: 740;
  line-height: 1.4;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.work-heading { align-items: center; margin-bottom: 1.65rem; }
.work-heading h1 { margin-top: .32rem; font-size: clamp(2.25rem, 4vw, 3.55rem); line-height: 1.02; letter-spacing: -.055em; }
.plus-icon { font-size: 1.2rem; font-weight: 500; line-height: .9; }
.work-toolbar { align-items: center; gap: .8rem 1rem; margin-bottom: 1.1rem; }
.work-toolbar .tabs { margin: 0; }
.work-toolbar .filter-form { align-items: center; flex-wrap: nowrap; }
.work-toolbar select { width: auto; max-width: 20rem; }
.next-case {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem 1.6rem;
  margin: .8rem 0 2rem;
  padding: clamp(1.2rem, 2.45vw, 2.25rem);
  border-radius: .85rem;
  border-left: .42rem solid #c0d979;
  background: #183e32;
  color: #fff;
}
.next-case > div { min-width: 0; }
.next-case .section-label { color: #d5e997; }
.next-case h2 { margin: .42rem 0 .42rem; max-width: 50ch; font-size: clamp(1.32rem, 2.25vw, 2.15rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.case-meta { display: flex; flex-wrap: wrap; gap: .05rem .45rem; color: #deebe1; }
.case-action { display: grid; flex: 0 1 auto; justify-items: end; gap: .45rem; }
.case-due { color: #deebe1; font-size: .9rem; font-variant-numeric: tabular-nums; }
.case-due strong { color: #ffdab2; }
.case-action .button { border-color: #dbea9a; background: #dbea9a; color: #153829; }
.case-action .button:hover { background: #e7f4ad; }
.next-case :focus-visible { outline-color: white; }
.queue-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .35rem .7rem; margin: 0 0 .65rem; }
.queue-title h2 { font-size: 1.27rem; letter-spacing: -.028em; }
.queue-title > span { color: var(--muted); font-size: .88rem; }
.queue-table :is(th, td) { padding-block: .8rem; }
.queue-table td { overflow-wrap: anywhere; }
.queue-table td:first-child { max-width: 26rem; }
.queue-table .cell-title { text-decoration-thickness: 1px; text-decoration-color: #839b89; }
.queue-table .badge { width: fit-content; }
.mobile-field { display: none; }
.due-late, .due-today { display: block; font-size: .82rem; font-weight: 670; }
.due-late { color: #943d2b; }
.due-today { color: #795116; }
@media (max-width: 54rem) {
  .queue-wrap { overflow: visible; border: 0; background: transparent; }
  .queue-table { min-width: 0; display: block; }
  .queue-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .queue-table tbody { display: grid; gap: .7rem; }
  .queue-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .85rem 1rem; }
  .queue-table tbody td { display: grid; align-content: start; gap: .14rem; padding: 0; border: 0; }
  .queue-table tbody td:first-child { grid-column: 1 / -1; max-width: none; padding: 0 0 .65rem; margin-bottom: .05rem; border-bottom: 1px solid var(--line); }
  .queue-table .cell-title { font-size: 1.05rem; }
  .mobile-field { display: inline; font-size: .78rem; color: var(--muted); font-weight: 630; }
}
@media (max-width: 38rem) {
  .mobile-nav summary, .mobile-nav-panel .app-nav a, .account-logout, .button, .tabs a { min-height: 44px; }
  .field input, .field textarea, .filter-form select { font-size: max(16px, 1rem); }
  .work-heading { margin-bottom: 1.15rem; }
  .work-toolbar .filter-form { width: 100%; }
  .work-toolbar select { flex: 1; max-width: none; }
  .next-case { display: grid; margin-bottom: 1.45rem; }
  .case-action { justify-items: start; }
  .preview-note { max-width: 7.5rem; line-height: 1.25; }
  .workspace-name, .workspace-switch summary { font-size: .93rem; }
}
