:root {
  --color-primary: #0000a8;
  --color-on-primary: #ffffff;
  --color-secondary: #2020c5;
  --color-accent: #fff100;
  --color-accent-strong: #0000a8;
  --color-accent-hover: #000078;
  --color-background: #f6f7fb;
  --color-surface: #ffffff;
  --color-foreground: #17172b;
  --color-subtle: #626579;
  --color-muted: #f0f2f8;
  --color-border: #dde1ec;
  --color-destructive: #b91c1c;
  --color-ring: #3535d4;
  --space-xs: .125rem;
  --space-sm: .25rem;
  --space-md: .5rem;
  --space-lg: .75rem;
  --space-xl: 1rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;
  --shadow-sm: 0 1px 2px rgb(23 23 43 / .05), 0 8px 24px rgb(23 23 43 / .035);
  --shadow-md: 0 12px 32px rgb(23 23 43 / .11);
  --radius-sm: .625rem;
  --radius-md: .875rem;
  --motion: 200ms cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--color-foreground);
  background: var(--color-background);
}

* { box-sizing: border-box; }
html { min-width: 20rem; background: var(--color-background); }
body { margin: 0; min-height: 100dvh; font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
body, button, input, select, textarea { font: inherit; }
a { color: #1d4ed8; cursor: pointer; text-underline-offset: .18em; transition: color var(--motion), background-color var(--motion), border-color var(--motion), box-shadow var(--motion); }
a:hover { color: #1e40af; }
.action-link { display: inline-flex; min-height: 2.75rem; align-items: center; padding: .25rem .125rem; font-weight: 650; }
button, select, summary, [role="button"] { cursor: pointer; touch-action: manipulation; }
img, svg { max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: var(--space-md); font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; letter-spacing: -.025em; }
h2 { margin-bottom: var(--space-lg); font-size: 1.125rem; line-height: 1.3; }
h3 { margin-bottom: var(--space-sm); font-size: 1rem; }

:focus-visible { outline: .2rem solid var(--color-ring); outline-offset: .15rem; }
.skip-link { position: fixed; z-index: 1000; left: var(--space-xl); top: var(--space-xl); display: inline-flex; min-height: 3rem; align-items: center; padding: var(--space-lg) var(--space-xl); background: var(--color-foreground); color: white; border-radius: var(--radius-sm); transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }

.sidebar { display: none; }
.mobile-header { position: relative; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-md); padding: var(--space-lg) var(--space-xl); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.tool-nav { display: grid; width: 100%; gap: var(--space-xl); }
.nav-module { display: grid; gap: var(--space-sm); margin: 0; border: 0; }
.nav-module:not([open]) > .nav-subtools { display: none; }
.nav-topic, .nav-link { display: flex; min-height: 2.75rem; align-items: center; border-radius: var(--radius-sm); text-decoration: none; }
.nav-topic { justify-content: space-between; gap: var(--space-md); padding: 0 var(--space-lg); color: var(--color-foreground); font-weight: 750; list-style: none; }
.nav-topic::-webkit-details-marker { display: none; }
.nav-chevron { width: .48rem; height: .48rem; flex: 0 0 auto; border-right: .12rem solid currentColor; border-bottom: .12rem solid currentColor; transform: rotate(45deg); transition: transform var(--motion); }
.nav-module[open] > .nav-topic .nav-chevron { transform: rotate(225deg); }
span.nav-topic { cursor: default; }
.nav-subtools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.nav-link { justify-content: center; padding: .5rem var(--space-md); color: var(--color-subtle); font-size: .875rem; font-weight: 650; text-align: center; }
.nav-topic:hover, .nav-link:hover { color: #1e3a8a; background: var(--color-muted); }
.nav-module.is-active > .nav-topic { color: #1e3a8a; background: #eff6ff; }
.nav-link[aria-current="page"] { color: #1e3a8a; background: var(--color-muted); box-shadow: inset .2rem 0 var(--color-primary); }
.brand { display: inline-flex; min-height: 2.75rem; align-items: center; gap: var(--space-md); color: var(--color-foreground); font-weight: 750; text-decoration: none; white-space: normal; }
.brand-logo { display: block; width: min(10rem, 100%); height: auto; flex: 0 0 auto; }
.mobile-header .brand { flex-direction: row; }
.mobile-header .brand-logo { width: 7rem; }
.auth-brand { flex-direction: column; align-items: center; text-align: center; }
.auth-brand .brand-logo { width: min(13rem, 80vw); }

.page { width: 100%; max-width: 90rem; margin: 0 auto; padding: var(--space-xl); }
.page-auth { display: grid; min-height: 100dvh; place-items: center; }
.page-heading { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xl); margin-bottom: var(--space-2xl); }
.page-heading > div { min-width: 0; }
.eyebrow { margin-bottom: var(--space-sm); color: #1d4ed8; font-size: .875rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.lede { max-width: 65ch; margin-bottom: 0; color: var(--color-subtle); }
.muted { color: var(--color-subtle); }
.number { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

.card, .metric, .auth-card { min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.card { padding: var(--space-xl); }
.auth-card { width: min(100%, 27rem); padding: var(--space-2xl); }
.auth-brand { margin-bottom: var(--space-2xl); }
.card-heading, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-lg); }
.card-heading h2, .card-heading h3 { margin-bottom: var(--space-md); }
.card-list, .stack, .stack-lg { display: grid; }
.card-list, .stack { gap: var(--space-xl); }
.stack-lg { gap: var(--space-2xl); }
.task-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xl); }
.empty-state { padding: var(--space-3xl); text-align: center; background: var(--color-surface); border: 1px dashed #94a3b8; border-radius: var(--radius-md); }
.empty-inline { color: var(--color-subtle); }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-2xl); }
.metric { display: flex; min-height: 6.5rem; flex-direction: column; justify-content: space-between; padding: var(--space-xl); }
.metric span { color: var(--color-subtle); font-size: .875rem; font-weight: 650; }
.metric strong { font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-danger { border-top: .25rem solid var(--color-destructive); }
.metric-text { font-size: 1rem !important; }
.workspace-section { margin-top: var(--space-3xl); }
.section-heading { margin-bottom: var(--space-xl); }
.section-heading p { margin-bottom: 0; color: var(--color-subtle); }

.btn { display: inline-flex; min-height: 2.75rem; align-items: center; justify-content: center; padding: .625rem 1rem; border: 2px solid transparent; border-radius: var(--radius-sm); font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; transition: color var(--motion), background-color var(--motion), border-color var(--motion), box-shadow var(--motion), opacity var(--motion); }
.btn-primary { background: var(--color-accent-strong); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-accent-hover); color: white; box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; color: #1d4ed8; border-color: var(--color-primary); }
.btn-secondary:hover { background: var(--color-muted); color: #1e3a8a; }
.btn-danger { background: transparent; color: var(--color-destructive); border-color: var(--color-destructive); }
.btn-danger:hover { background: #fef2f2; color: #7f1d1d; }
.btn:active { opacity: .78; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.text-button { min-height: 2.75rem; padding: 0; color: #1d4ed8; background: transparent; border: 0; text-decoration: underline; }

.form-card { max-width: 58rem; }
form fieldset { min-width: 0; margin: 0 0 var(--space-2xl); padding: 0; border: 0; }
legend { width: 100%; margin-bottom: var(--space-xl); padding-bottom: var(--space-md); border-bottom: 1px solid var(--color-border); font-size: 1.125rem; font-weight: 750; }
.form-grid, .filters { display: grid; grid-template-columns: 1fr; gap: var(--space-xl); }
.form-wide { grid-column: 1 / -1; }
.field { display: grid; min-width: 0; gap: var(--space-sm); }
.field label { font-weight: 700; }
.field small { color: var(--color-subtle); }
input, select, textarea { width: 100%; min-height: 2.75rem; padding: .625rem .75rem; color: var(--color-foreground); background: white; border: 1px solid #94a3b8; border-radius: var(--radius-sm); font-size: 1rem; transition: border-color var(--motion), box-shadow var(--motion), background-color var(--motion); }
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); outline: 0; box-shadow: 0 0 0 .2rem rgb(37 99 235 / .22); }
input[type="file"] { height: auto; padding: var(--space-md); }
.errorlist { margin: 0; padding-left: 1.25rem; color: var(--color-destructive); font-weight: 650; }
.error-summary { padding: var(--space-lg); color: #7f1d1d; background: #fef2f2; border: 2px solid #dc2626; border-radius: var(--radius-sm); }
.error-summary p, .error-summary ul { margin-bottom: 0; }
.error-summary form { display: inline; }
.warning-summary { padding: var(--space-lg); color: #78350f; background: #fffbeb; border: 2px solid #d97706; border-radius: var(--radius-sm); margin-bottom: var(--space-lg); }
.link-button { display: inline; background: none; border: none; padding: 0; margin-left: .35em; color: inherit; text-decoration: underline; font-weight: 750; font-size: inherit; cursor: pointer; }
.link-button:hover { color: #b91c1c; }
.form-actions { display: flex; justify-content: flex-start; padding-top: var(--space-xl); border-top: 1px solid var(--color-border); }
.checkbox-field label { display: flex; align-items: flex-start; gap: var(--space-md); }
.checkbox-field input { width: 1.25rem; min-height: 1.25rem; flex: 0 0 auto; margin-top: .15rem; }
details { margin-bottom: var(--space-2xl); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
summary { min-height: 2.75rem; padding: var(--space-lg); font-weight: 700; }
.details-grid { padding: var(--space-lg); padding-top: 0; }

.messages { margin-bottom: var(--space-xl); }
.message { margin: 0 0 var(--space-md); padding: var(--space-lg); border-left: .25rem solid var(--color-primary); border-radius: var(--radius-sm); background: var(--color-muted); }
.message-success { border-color: var(--color-accent); background: #ecfdf5; }
.message-error { border-color: var(--color-destructive); background: #fef2f2; }
.status { display: inline-flex; align-items: center; min-height: 1.75rem; padding: .15rem .5rem; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 999px; font-size: .8125rem; font-weight: 750; white-space: normal; }
.status-danger, .status-invalid, .status-failed, .status-absent { color: #7f1d1d; background: #fef2f2; border-color: #fecaca; }
.status-valid, .status-created, .status-present { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.status-duplicate, .status-planned { color: #78350f; background: #fffbeb; border-color: #fde68a; }

.detail-layout, .report-grid, .split-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xl); }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xl); margin: 0; }
.data-grid div { min-width: 0; }
dt { color: var(--color-subtle); font-size: .875rem; font-weight: 650; }
dd { margin: var(--space-xs) 0 0; font-weight: 650; }
.timeline, .audit-list, .plain-list { margin: 0; padding: 0; list-style: none; }
.timeline { border-left: 2px solid var(--color-border); }
.timeline li { display: grid; gap: var(--space-sm); margin-left: -.4rem; padding: 0 0 var(--space-xl) var(--space-xl); }
.timeline li::before { width: .7rem; height: .7rem; margin-left: -1.42rem; background: var(--color-primary); border: .15rem solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--color-primary); content: ""; }
.timeline small, .audit-list small, .plain-list small { display: block; color: var(--color-subtle); }
.audit-list li, .plain-list li { padding: var(--space-lg) 0; border-bottom: 1px solid var(--color-border); }
.revision-list { margin: 0; padding: 0 var(--space-lg) var(--space-lg) 2rem; }
.audit-list li:last-child, .plain-list li:last-child { border-bottom: 0; }
.plain-list li > div, .plain-list > div { display: flex; justify-content: space-between; gap: var(--space-md); }

.table-wrap { width: 100%; overflow: visible; }
table { width: 100%; border-collapse: collapse; background: white; }
th { color: var(--color-subtle); background: var(--color-muted); font-size: .8125rem; letter-spacing: .02em; text-align: left; }
th, td { padding: var(--space-lg); border-bottom: 1px solid var(--color-border); vertical-align: top; }
td small { display: block; color: var(--color-subtle); }
.confirm-bar { display: flex; justify-content: flex-end; margin-top: var(--space-xl); }
.filters { max-width: none; margin-bottom: var(--space-2xl); padding: var(--space-xl); }
.trial-day .split-actions { margin-top: var(--space-xl); }
.workflow-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); margin: 0 0 var(--space-2xl); padding: 0; list-style: none; }
.workflow-steps li { padding: var(--space-lg); color: var(--color-subtle); background: white; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: .875rem; font-weight: 700; }
.workflow-steps .is-active { color: #1e3a8a; background: var(--color-muted); border-color: var(--color-primary); box-shadow: inset .2rem 0 var(--color-primary); }
.staff-results { padding-top: var(--space-xl); border-top: 1px solid var(--color-border); }
.staff-results .plain-list li > div { align-items: flex-start; }
.staff-results .plain-list li > div > span { flex: 1 1 auto; min-width: 0; }
.staff-results .plain-list li > div > form { flex: 0 0 auto; }
.staff-results .plain-list .btn { white-space: nowrap; }
.document-review-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
.pdf-card { min-width: 0; }
.pdf-preview { width: 100%; min-height: 42rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #e2e8f0; }
.warning-note { margin-top: var(--space-xl); padding: var(--space-lg); color: #78350f; background: #fffbeb; border-left: .25rem solid #d97706; border-radius: var(--radius-sm); }
.inline-resolution { display: grid; gap: var(--space-md); min-width: min(100%, 28rem); }

@media (max-width: 47.99rem) {
  .page-heading .btn, .form-actions .btn, .confirm-bar .btn { width: 100%; }
  .task-card { align-items: stretch; flex-direction: column; }
  .task-card .btn { width: 100%; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  tbody { display: grid; gap: var(--space-xl); }
  tr { padding: var(--space-lg); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: white; box-shadow: var(--shadow-sm); }
  td { display: grid; grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr); gap: var(--space-md); padding: var(--space-md) 0; border-bottom: 1px solid var(--color-border); }
  td:last-child { border-bottom: 0; }
  td::before { color: var(--color-subtle); font-size: .8125rem; font-weight: 750; content: attr(data-label); }
  td[colspan] { display: block; }
}

@media (min-width: 48rem) {
  .page { padding: var(--space-2xl); }
  .page-heading { flex-direction: row; align-items: center; justify-content: space-between; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split-actions, .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
  .mobile-header { display: none; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 15rem; flex-direction: column; padding: var(--space-xl); background: var(--color-surface); border-right: 1px solid var(--color-border); }
  .sidebar .brand { align-items: flex-start; flex-direction: column; gap: var(--space-md); }
  .sidebar .tool-nav { gap: var(--space-2xl); margin-top: var(--space-2xl); }
  .sidebar .nav-subtools { grid-template-columns: 1fr; }
  .sidebar .nav-link { justify-content: flex-start; padding-left: var(--space-2xl); text-align: left; }
  .account { display: grid; margin-top: auto; padding-top: var(--space-xl); border-top: 1px solid var(--color-border); }
  .account small { color: var(--color-subtle); }
  .page { width: auto; max-width: none; margin-left: 15rem; padding: var(--space-3xl); }
  .page-auth { max-width: none; margin-left: 0; }
  .detail-layout { grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr); align-items: start; }
  .document-review-layout { grid-template-columns: minmax(20rem, .8fr) minmax(32rem, 1.6fr); }
  .detail-side { position: sticky; top: var(--space-3xl); }
  .filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

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

/* Leads board (Kanban + List) */
.leads-page {
  --leads-surface: #fbfbf8;
  --leads-surface-2: #f3f4ee;
  --leads-ink: #1a2420;
  --leads-ink-secondary: #55625a;
  --leads-ink-muted: #8b9389;
  --leads-border: rgba(26, 36, 32, 0.16);
  --leads-warn-text: #96650a;
  --leads-warn-bg: #f6e6bf;
  --leads-danger-text: #9a4a1c;
  --leads-danger-bg: #f4d9c3;
  --leads-s1: #2a78d6; --leads-s2: #eb6834; --leads-s3: #1baf7a; --leads-s4: #eda100; --leads-s5: #e87ba4;
}
.leads-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; justify-content: space-between; margin-bottom: var(--space-xl); }
.leads-search { display: flex; align-items: center; gap: .5rem; background: var(--leads-surface); border: 1px solid var(--leads-border); border-radius: .5rem; padding: .4rem .75rem; min-width: 14rem; }
.leads-search input { border: none; outline: none; background: transparent; min-height: auto; padding: 0; }
.leads-toggle { display: flex; background: var(--leads-surface-2); border: 1px solid var(--leads-border); border-radius: .5rem; padding: 2px; }
.leads-toggle button { border: none; background: transparent; padding: .4rem .9rem; border-radius: .4rem; font-weight: 650; color: var(--leads-ink-secondary); }
.leads-toggle button.is-active { background: var(--leads-surface); color: var(--leads-ink); box-shadow: 0 1px 0 var(--leads-border); }
.leads-filters { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: var(--space-xl); }
.leads-filter-group { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.leads-filter-group .leads-fl { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--leads-ink-muted); margin-right: .25rem; }
.leads-pill { font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--leads-border); background: var(--leads-surface); color: var(--leads-ink-secondary); cursor: pointer; user-select: none; }
.leads-pill.is-active { background: var(--leads-ink); border-color: var(--leads-ink); color: var(--leads-surface); font-weight: 650; }
.leads-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.leads-col { flex: 0 0 17rem; }
.leads-col--dimmed { opacity: .7; }
.leads-col-head { display: flex; align-items: center; gap: .5rem; padding: .25rem .25rem .6rem; }
.leads-col-title { font-weight: 650; flex: 1; }
.leads-col-count { font-size: .8rem; color: var(--leads-ink-muted); }
.leads-col-body { display: flex; flex-direction: column; gap: .6rem; min-height: 6rem; max-height: 32rem; overflow-y: auto; padding: .5rem; background: var(--leads-surface-2); border: 1px solid var(--leads-border); border-radius: .75rem; }
.leads-col-body.is-drop-target { outline: 2px dashed var(--leads-ink-muted); outline-offset: 2px; }
.leads-card { display: block; padding: .75rem .8rem; background: var(--leads-surface); border: 1px solid var(--leads-border); border-radius: .6rem; text-decoration: none; color: inherit; cursor: grab; }
.leads-card.is-hidden { display: none; }
.leads-card.is-dragging { opacity: .4; }
.leads-card-name { font-weight: 650; font-size: .9rem; }
.leads-card-child { font-size: .78rem; color: var(--leads-ink-muted); margin-top: 1px; }
.leads-card-meta { font-size: .78rem; color: var(--leads-ink-secondary); margin-top: .4rem; }
.leads-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; gap: .4rem; }
.leads-src { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--leads-ink-secondary); }
.leads-src-dot { width: .45rem; height: .45rem; border-radius: 50%; flex: none; }
.leads-avatar { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--leads-surface-2); border: 1px solid var(--leads-border); display: inline-flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 650; color: var(--leads-ink-secondary); flex: none; }
.leads-badge { display: inline-block; font-size: .7rem; padding: .15rem .5rem; border-radius: 999px; font-weight: 650; }
.leads-badge-danger { background: var(--leads-danger-bg); color: var(--leads-danger-text); }
.leads-badge-warn { background: var(--leads-warn-bg); color: var(--leads-warn-text); }
.leads-badge-muted { background: var(--leads-surface-2); color: var(--leads-ink-secondary); }
.leads-list-table tr.is-hidden { display: none; }
.leads-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.leads-modal { background: var(--leads-surface); border-radius: .75rem; padding: 1.25rem; width: min(24rem, 92vw); }
.leads-modal h3 { margin-bottom: .75rem; }
.leads-modal .form-actions { border-top: none; padding-top: .75rem; justify-content: flex-end; gap: .5rem; }

@media (max-width: 47.99rem) {
  .leads-search { min-width: 0; width: 100%; }
}

/* RLCC workspace refresh — Make-inspired structure with Ten Toes identity */
body {
  color: var(--color-foreground);
  background:
    radial-gradient(circle at 68% -12%, rgb(0 0 168 / .045), transparent 28rem),
    var(--color-background);
}

h1, h2, .metric strong, .section-count, .action-node strong {
  font-family: "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
}

a { color: var(--color-primary); }
a:hover { color: #000078; }

.card, .metric, .auth-card, .filters {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.card, .metric, .workflow-panel, .action-rail, .teacher-workspace {
  transition: transform var(--motion), box-shadow var(--motion), border-color var(--motion);
}

.btn {
  gap: .5rem;
  min-height: 2.65rem;
  padding: .65rem 1rem;
  border-width: 1px;
  border-radius: .7rem;
  font-size: .875rem;
  transition: transform var(--motion), color var(--motion), background-color var(--motion), border-color var(--motion), box-shadow var(--motion), opacity var(--motion);
}
.btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn-primary { color: white; background: var(--color-primary); box-shadow: 0 8px 18px rgb(0 0 168 / .16); }
.btn-primary:hover { color: white; background: #000078; box-shadow: 0 12px 24px rgb(0 0 168 / .22); transform: translateY(-1px); }
.btn-secondary { color: var(--color-primary); background: white; border-color: rgb(0 0 168 / .24); }
.btn-secondary:hover { color: #000078; background: #f7f7ff; border-color: rgb(0 0 168 / .42); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.text-button { color: var(--color-primary); }

input, select, textarea {
  border-color: #b9bdcc;
  border-radius: .7rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 .2rem rgb(0 0 168 / .14); }

.page-heading { margin-bottom: 2rem; }
.page-heading h1 { margin-bottom: .35rem; font-size: clamp(1.75rem, 3vw, 2.35rem); font-weight: 750; letter-spacing: -.045em; }
.eyebrow, .section-kicker { color: var(--color-primary); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.status { color: #000078; background: #f0f0ff; border-color: #ceceff; }
.status-planned { color: #625a00; background: #fffde0; border-color: #e8dc00; }
.status-valid, .status-created, .status-present { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.action-link { gap: .4rem; color: var(--color-primary); text-decoration: none; }
.action-link:hover { color: #000078; }
.message { border-color: var(--color-primary); background: #f0f0ff; }

.workspace-topbar { display: none; }
.workspace-identity, .topbar-user { display: flex; align-items: center; gap: .75rem; }
.workspace-identity > span:last-child, .topbar-user-copy { display: grid; line-height: 1.25; }
.workspace-identity small, .topbar-user small { color: var(--color-subtle); font-size: .72rem; }
.workspace-mark { width: .625rem; height: .625rem; background: var(--color-accent); border: 2px solid var(--color-primary); border-radius: 50%; box-shadow: 0 0 0 .25rem rgb(255 241 0 / .28); }
.topbar-user-copy { text-align: right; }
.topbar-avatar, .account-avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.15rem; height: 2.15rem; background: var(--color-primary); color: white; border-radius: .7rem; font-weight: 800; }

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 4.25rem;
  padding: .6rem 1rem;
  background: rgb(255 255 255 / .96);
  box-shadow: 0 1px 0 var(--color-border), 0 8px 24px rgb(23 23 43 / .04);
  backdrop-filter: blur(16px);
}
.mobile-header .brand { min-height: auto; }
.mobile-header .brand-logo { width: 6.4rem; }
.mobile-menu { position: static; margin: 0; border: 0; }
.mobile-menu > summary { display: inline-flex; min-height: 2.6rem; align-items: center; gap: .45rem; padding: .55rem .75rem; color: var(--color-foreground); background: var(--color-muted); border: 1px solid var(--color-border); border-radius: .7rem; font-size: .82rem; list-style: none; }
.mobile-menu > summary::-webkit-details-marker { display: none; }
.mobile-menu > summary svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mobile-menu-panel { position: absolute; top: calc(100% + 1px); left: 0; right: 0; max-height: calc(100dvh - 4.25rem); overflow-y: auto; padding: 1rem; background: white; border-bottom: 1px solid var(--color-border); box-shadow: 0 18px 38px rgb(23 23 43 / .14); }
.mobile-menu .tool-nav { display: grid; gap: 1.25rem; }
.mobile-menu .nav-module { display: grid; gap: .5rem; }
.mobile-menu .nav-topic { min-height: 2.25rem; padding: .25rem 0; color: var(--color-subtle); background: transparent; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mobile-menu .nav-module.is-active > .nav-topic { color: var(--color-primary); background: transparent; }
.mobile-menu .nav-subtools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.mobile-menu .nav-link { display: flex; min-height: 3.1rem; align-items: center; justify-content: flex-start; gap: .65rem; padding: .65rem .75rem; color: var(--color-foreground); background: var(--color-background); border: 1px solid var(--color-border); border-radius: .75rem; font-size: .78rem; text-align: left; }
.mobile-menu .nav-link[aria-current="page"] { color: var(--color-primary); background: #f0f0ff; border-color: #ceceff; box-shadow: inset 3px 0 var(--color-accent); }
.mobile-menu .nav-link::before { flex: 0 0 auto; }
.nav-link::before { display: inline-grid; width: 1.08rem; height: 1.08rem; place-items: center; border: 1.7px solid currentColor; border-radius: .3rem; content: ""; }
.nav-overview::before { background: conic-gradient(from 90deg, currentColor 0 22%, transparent 22% 28%, currentColor 28% 47%, transparent 47% 53%, currentColor 53% 72%, transparent 72% 78%, currentColor 78% 100%); border: 0; }
.nav-leads::before { border-radius: 50%; box-shadow: inset 0 -.34rem 0 -.12rem currentColor; }
.nav-quick-add::before { border: 0; font-size: 1.35rem; font-weight: 400; line-height: 1; content: "+"; }
.nav-import::before { border: 0; font-size: 1.05rem; font-weight: 800; line-height: 1; content: "↓"; }
.nav-reports::before { background: linear-gradient(to top, currentColor 0 100%) 1px bottom / 3px 48% no-repeat, linear-gradient(to top, currentColor 0 100%) center bottom / 3px 78% no-repeat, linear-gradient(to top, currentColor 0 100%) calc(100% - 1px) bottom / 3px 62% no-repeat; border: 0; border-bottom: 1px solid currentColor; border-radius: 0; }
.nav-documents::before { border-radius: .12rem; box-shadow: inset 0 .25rem 0 transparent, inset 0 .33rem 0 currentColor; }
.nav-staff::before { border-radius: 50%; box-shadow: 0 .42rem 0 -.12rem currentColor; transform: translateY(-.15rem) scale(.72); }
.nav-incentives::before { border-radius: 50%; font-size: .58rem; font-weight: 900; content: "%"; }
.mobile-account { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }
.mobile-account > span { display: grid; }
.mobile-account small { color: var(--color-subtle); }

.page { padding: 1.25rem; }

/* Dashboard: one memorable workflow moment, quiet supporting surfaces. */
.dashboard-shell { width: min(100%, 92rem); margin: 0 auto; }
.dashboard-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 1.2rem; margin-bottom: 1.5rem; }
.dashboard-heading h1 { margin-bottom: .45rem; font-size: clamp(2rem, 4.6vw, 3.15rem); font-weight: 760; letter-spacing: -.055em; }
.dashboard-heading .eyebrow { margin-bottom: .55rem; }
.dashboard-lede { max-width: 43rem; margin: 0; color: var(--color-subtle); font-size: clamp(.95rem, 1.8vw, 1.08rem); }
.dashboard-primary-action { flex: 0 0 auto; }

.action-rail, .workflow-panel, .teacher-workspace {
  background: rgb(255 255 255 / .94);
  border: 1px solid var(--color-border);
  border-radius: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.action-rail { position: relative; overflow: hidden; margin-bottom: 1.25rem; padding: 1.2rem; }
.action-rail::after { position: absolute; top: -4rem; right: -4rem; width: 12rem; height: 12rem; background: radial-gradient(circle, rgb(255 241 0 / .22), transparent 68%); pointer-events: none; content: ""; }
.action-rail-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.action-rail-heading h2 { margin-bottom: 0; font-size: 1.2rem; }
.action-rail-heading p { max-width: 22rem; margin: 0; color: var(--color-subtle); font-size: .82rem; text-align: right; }
.section-kicker { margin-bottom: .35rem !important; }

.action-track { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.action-track-line { display: none; }
.action-node { position: relative; display: grid; min-width: 0; padding: .9rem; color: var(--color-foreground); background: #fafaff; border: 1px solid var(--color-border); border-radius: .8rem; text-decoration: none; transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion), background-color var(--motion); }
.action-node:hover, .action-node:focus-visible { color: var(--color-foreground); background: white; border-color: rgb(0 0 168 / .3); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.action-node strong { font-size: 1.65rem; line-height: 1; font-variant-numeric: tabular-nums; }
.action-node > span:not(.action-node-dot) { margin-top: .45rem; font-size: .82rem; font-weight: 750; }
.action-node small { margin-top: .08rem; overflow: hidden; color: var(--color-subtle); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.action-node-dot { position: absolute; top: -.45rem; left: 1rem; width: .8rem; height: .8rem; background: var(--color-primary); border: .2rem solid var(--color-accent); border-radius: 50%; box-shadow: 0 0 0 .2rem white; }
.action-node-danger .action-node-dot { background: #b42318; }
.pipeline-snapshot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--color-border); }
.pipeline-snapshot > span { display: inline-flex; align-items: baseline; gap: .45rem; }
.pipeline-snapshot small { color: var(--color-subtle); font-size: .72rem; }
.pipeline-snapshot strong { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; font-variant-numeric: tabular-nums; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.workflow-panel, .teacher-workspace { min-width: 0; padding: 1.2rem; scroll-margin-top: 6rem; }
.dashboard-section-heading { margin-bottom: 1.1rem; }
.dashboard-section-heading h2 { margin-bottom: .2rem; font-size: 1.15rem; }
.dashboard-section-heading p { margin: 0; font-size: .82rem; }
.section-count { display: inline-flex; min-width: 2rem; height: 2rem; align-items: center; justify-content: center; padding: 0 .55rem; color: var(--color-primary); background: #f0f0ff; border: 1px solid #d6d6ff; border-radius: .65rem; font-size: .82rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.workflow-group + .workflow-group { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.workflow-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .65rem; }
.workflow-group-heading h3 { margin: 0; font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; }
.workflow-group-heading > span { display: inline-flex; min-width: 1.5rem; justify-content: center; color: var(--color-subtle); font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .7rem; }
.workflow-list { display: grid; gap: .55rem; }
.workflow-item { display: flex; min-width: 0; align-items: center; gap: .7rem; padding: .7rem; background: white; border: 1px solid var(--color-border); border-radius: .8rem; transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion); }
.workflow-item:hover { border-color: #c5c9d8; box-shadow: 0 8px 20px rgb(23 23 43 / .07); transform: translateY(-1px); }
.workflow-icon { display: inline-flex; width: 2rem; height: 2rem; flex: 0 0 auto; align-items: center; justify-content: center; color: var(--color-primary); background: #f0f0ff; border-radius: .62rem; }
.workflow-icon svg, .workflow-open svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.workflow-icon-danger { color: #b42318; background: #fff0ee; }
.workflow-icon-yellow { color: #5e5700; background: #fffbd0; }
.workflow-icon-success { color: #067647; background: #ecfdf3; }
.workflow-icon-trial { color: #5b3cc4; background: #f3efff; }
.workflow-copy { min-width: 0; flex: 1 1 auto; }
.workflow-copy h3 { margin: 0 0 .12rem; overflow: hidden; font-size: .87rem; text-overflow: ellipsis; white-space: nowrap; }
.workflow-copy p, .workflow-copy time { display: block; margin: 0; overflow: hidden; color: var(--color-subtle); font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; }
.workflow-copy time { margin-top: .32rem; color: var(--color-foreground); font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .68rem; }
.workflow-item .status { flex: 0 0 auto; min-height: 1.55rem; font-size: .68rem; }
.workflow-open { display: inline-flex; width: 2rem; height: 2rem; flex: 0 0 auto; align-items: center; justify-content: center; color: var(--color-subtle); background: var(--color-background); border: 1px solid transparent; border-radius: .6rem; text-decoration: none; transition: color var(--motion), background-color var(--motion), transform var(--motion); }
.workflow-open:hover { color: white; background: var(--color-primary); transform: translateX(2px); }
.dashboard-empty-inline { display: flex; align-items: center; gap: .45rem; min-height: 2.75rem; margin: 0; padding: .65rem .75rem; background: #fbfbfd; border: 1px dashed var(--color-border); border-radius: .7rem; font-size: .78rem; }
.dashboard-empty-inline > span { display: inline-flex; width: 1.25rem; height: 1.25rem; align-items: center; justify-content: center; color: #067647; background: #ecfdf3; border-radius: 50%; font-size: .7rem; font-weight: 900; }
.dashboard-empty { display: grid; place-items: center; padding: 2rem 1rem; border-color: var(--color-border); background: #fbfbfd; }
.dashboard-empty > span { display: inline-flex; width: 2.2rem; height: 2.2rem; align-items: center; justify-content: center; margin-bottom: .7rem; color: #067647; background: #ecfdf3; border-radius: .75rem; font-weight: 900; }
.dashboard-empty h3, .dashboard-empty h2 { margin-bottom: .25rem; }
.dashboard-empty p { margin: 0; color: var(--color-subtle); font-size: .8rem; }
.workflow-item-stacked { align-items: flex-start; flex-wrap: wrap; }
.workflow-item-stacked .workflow-copy { flex-basis: calc(100% - 3.2rem); }
.workflow-item-stacked .btn { width: 100%; min-height: 2.25rem; }
.schedule-time { display: grid; width: 2.15rem; flex: 0 0 auto; justify-items: center; gap: .2rem; }
.schedule-time > span { width: .72rem; height: .72rem; background: var(--color-accent); border: 2px solid var(--color-primary); border-radius: 50%; }
.schedule-time small { color: var(--color-subtle); font-size: .55rem; writing-mode: vertical-rl; }

.trial-workspace { margin-top: 1.25rem; }
.trial-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.trial-column { min-width: 0; }
.compact-workflow-item { padding: .65rem; }
.teacher-workspace { max-width: 62rem; }

@keyframes workspace-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes track-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.dashboard-heading, .action-rail, .dashboard-grid, .trial-workspace, .teacher-workspace { animation: workspace-enter 240ms cubic-bezier(.2, .8, .2, 1) both; }
.action-rail { animation-delay: 45ms; }
.dashboard-grid { animation-delay: 90ms; }
.trial-workspace { animation-delay: 135ms; }

@media (min-width: 48rem) {
  .page { padding: 2rem; }
  .dashboard-heading { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .action-rail { padding: 1.4rem; }
  .action-track { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; padding-top: .45rem; }
  .action-track-line { position: absolute; top: .38rem; left: calc(12.5% + .5rem); right: calc(12.5% + .5rem); display: block; height: 3px; background: linear-gradient(90deg, var(--color-accent), #fff66a, var(--color-accent)); border-radius: 999px; box-shadow: 0 0 0 1px rgb(0 0 168 / .05); transform-origin: left; animation: track-grow 520ms 160ms cubic-bezier(.2, .8, .2, 1) both; }
  .action-node { border: 0; background: transparent; }
  .action-node:hover, .action-node:focus-visible { background: white; }
  .action-node-dot { top: -.5rem; left: 50%; transform: translateX(-50%); }
  .trial-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workflow-panel, .teacher-workspace { padding: 1.4rem; }
}

@media (min-width: 64rem) {
  .workspace-topbar { position: fixed; inset: 0 0 auto 5.5rem; z-index: 18; display: flex; height: 4.5rem; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: rgb(255 255 255 / .92); border-bottom: 1px solid var(--color-border); backdrop-filter: blur(18px); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 5.5rem; flex-direction: column; padding: .7rem .55rem; background: linear-gradient(180deg, #0000a8 0%, #00008e 100%); border-right: 0; box-shadow: .5rem 0 2rem rgb(0 0 80 / .08); }
  .sidebar .brand { display: flex; min-height: 3.25rem; align-items: center; justify-content: center; margin-bottom: .8rem; padding: .48rem .38rem; background: white; border-radius: .78rem; box-shadow: 0 .45rem 1.1rem rgb(0 0 75 / .16); }
  .sidebar .brand-logo { width: 4.2rem; }
  .sidebar .tool-nav { display: grid; gap: .9rem; width: 100%; margin: 0; overflow-y: auto; scrollbar-width: none; }
  .sidebar .tool-nav::-webkit-scrollbar { display: none; }
  .sidebar .nav-module { display: grid; gap: .22rem; }
  .sidebar .nav-topic { min-height: 1.9rem; flex-direction: column; justify-content: center; gap: .12rem; padding: .18rem .1rem; color: rgb(255 255 255 / .58); background: transparent; font-size: .5rem; font-weight: 800; letter-spacing: .04em; line-height: 1.15; text-align: center; text-transform: uppercase; }
  .sidebar .nav-topic .nav-chevron { width: .34rem; height: .34rem; border-width: .08rem; }
  .sidebar .nav-topic:hover, .sidebar .nav-module.is-active > .nav-topic { color: rgb(255 255 255 / .78); background: transparent; }
  .sidebar .nav-subtools { display: grid; grid-template-columns: 1fr; gap: .22rem; }
  .sidebar .nav-link { position: relative; display: flex; min-height: 3.35rem; flex-direction: column; align-items: center; justify-content: center; gap: .22rem; padding: .35rem .18rem; color: rgb(255 255 255 / .88); background: rgb(255 255 255 / .08); border: 1px solid transparent; border-color: rgb(255 255 255 / .12); border-radius: .78rem; box-shadow: 0 .2rem .55rem rgb(0 0 75 / .08); font-size: .61rem; font-weight: 650; line-height: 1.1; text-align: center; }
  .sidebar .nav-link:hover { color: white; background: rgb(255 255 255 / .14); border-color: rgb(255 255 255 / .22); box-shadow: 0 .35rem .8rem rgb(0 0 75 / .14); }
  .sidebar .nav-link[aria-current="page"] { color: white; background: rgb(255 255 255 / .18); border-color: rgb(255 255 255 / .28); box-shadow: inset 3px 0 var(--color-accent), 0 .4rem .9rem rgb(0 0 75 / .18); }
  .sidebar .nav-link::before { flex: 0 0 auto; }
  .sidebar .account { display: grid; justify-items: center; gap: .35rem; margin-top: auto; padding: .7rem 0 0; color: white; border-top: 1px solid rgb(255 255 255 / .16); }
  .sidebar .account-avatar { width: 2rem; height: 2rem; color: var(--color-primary); background: var(--color-accent); border-radius: .65rem; }
  .sidebar .account-copy { display: none; }
  .sidebar .account form { display: flex; }
  .sidebar .text-button { min-height: 1.5rem; color: rgb(255 255 255 / .72); font-size: .58rem; text-decoration: none; }
  .sidebar .text-button:hover { color: white; }
  .page { width: auto; max-width: none; margin-left: 5.5rem; padding: 6.5rem 2rem 2.5rem; }
  .page-auth { max-width: none; margin-left: 0; padding-top: 2rem; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.65fr) minmax(18rem, .8fr); }
}

@media (min-width: 80rem) {
  .page { padding-right: 3rem; padding-left: 3rem; }
  .action-rail, .workflow-panel, .teacher-workspace { padding: 1.65rem; }
  .workflow-item { padding: .78rem; }
}

@media (max-width: 35rem) {
  .mobile-menu .nav-subtools { grid-template-columns: 1fr; }
  .action-rail-heading { display: block; }
  .action-rail-heading > p { margin-top: .45rem; text-align: left; }
  .action-track { grid-template-columns: 1fr; }
  .action-node { grid-template-columns: auto 1fr; align-items: center; column-gap: .7rem; }
  .action-node strong { grid-row: 1 / 3; }
  .action-node > span:not(.action-node-dot) { margin-top: 0; }
  .action-node small { grid-column: 2; }
  .action-node-dot { top: 50%; left: -.4rem; transform: translateY(-50%); }
  .workflow-item { align-items: flex-start; flex-wrap: wrap; }
  .workflow-item .status { order: 3; margin-left: 2.7rem; }
  .workflow-open { margin-left: auto; }
  .workflow-item > .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-heading, .action-rail, .dashboard-grid, .trial-workspace, .teacher-workspace, .action-track-line { animation: none !important; }
  .card:hover, .workflow-item:hover, .action-node:hover, .btn:hover { transform: none; }
}
