/* ClinicalCoders design system — self-hosted, no external fonts or frameworks (CSP: style-src 'self').
   Colors meet WCAG 2.2 AA contrast on their intended backgrounds. Logical properties keep layouts RTL-ready. */

:root {
  --cc-teal-900: #06343d;
  --cc-teal-800: #0a4550;
  --cc-teal-700: #0b5563;
  --cc-teal-600: #0e6b7c;
  --cc-teal-100: #d7eef1;
  --cc-teal-50: #eef8f9;
  --cc-navy-900: #13233a;
  --cc-ink: #1f2933;
  --cc-ink-2: #3e4c59;
  --cc-muted: #52606d;
  --cc-line: #d9e2ec;
  --cc-line-strong: #bcccdc;
  --cc-bg: #f5f7fa;
  --cc-surface: #ffffff;
  --cc-success: #146c43;
  --cc-success-bg: #e6f4ea;
  --cc-warning: #8a4b00;
  --cc-warning-bg: #fff4e0;
  --cc-danger: #b42318;
  --cc-danger-bg: #fdecea;
  --cc-info: #1849a9;
  --cc-info-bg: #e8f0fe;
  --cc-sim: #6b21a8;
  --cc-sim-bg: #f3e8ff;
  --cc-focus: #b45309;
  --cc-focus-on-dark: #fbbf24;
  --cc-radius: 8px;
  --cc-radius-sm: 6px;
  --cc-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --cc-shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);
  --cc-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --cc-mono: Consolas, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;
  --cc-sidebar: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--cc-font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--cc-ink);
  background: var(--cc-bg);
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--cc-navy-900); margin: 0 0 0.6em; }
h1 { font-size: 1.85rem; font-weight: 650; }
h2 { font-size: 1.35rem; font-weight: 650; }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 1em; }
a { color: var(--cc-teal-700); text-underline-offset: 2px; }
a:hover { color: var(--cc-teal-900); }
small, .small { font-size: 0.875rem; }
code, .mono { font-family: var(--cc-mono); font-size: 0.92em; }
hr { border: 0; border-top: 1px solid var(--cc-line); margin: 1.5rem 0; }

/* Focus: always visible for keyboard users */
:focus-visible {
  outline: 3px solid var(--cc-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.site-footer :focus-visible { outline-color: var(--cc-focus-on-dark); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: 0.75rem; top: -3rem; z-index: 1000;
  background: var(--cc-navy-900); color: #fff; padding: 0.6rem 1rem; border-radius: var(--cc-radius-sm);
}
.skip-link:focus { top: 0.75rem; color: #fff; }

.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.container-narrow { max-width: 560px; }
.container-fluid { max-width: none; }
.js .js-hide { display: none; }
.container-medium { max-width: 820px; }

/* ---------- Public site header/footer ---------- */
.site-header { background: var(--cc-surface); border-bottom: 1px solid var(--cc-line); }
.site-header .bar { display: flex; align-items: center; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.12rem; color: var(--cc-navy-900); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: 0 0 auto; }
.brand span.dot { color: var(--cc-teal-600); }
.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-inline-start: auto; align-items: center; }
.site-nav a { padding: 0.45rem 0.7rem; border-radius: var(--cc-radius-sm); text-decoration: none; color: var(--cc-ink-2); font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--cc-teal-50); color: var(--cc-teal-800); }
/* Buttons in the header keep their own colors (the nav link color must not override them). */
.site-nav a.btn-primary, .site-nav a.btn-primary:hover, .site-nav a.btn-primary[aria-current="page"] { background: var(--cc-teal-700); color: #fff; }
.site-nav a.btn-primary:hover { background: var(--cc-teal-800); }
.site-footer { margin-top: 3rem; background: var(--cc-navy-900); color: #d9e2ec; padding: 2.5rem 0 2rem; font-size: 0.93rem; }
.site-footer a { color: #e6f4f6; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.5rem; }
.site-footer h2 { color: #fff; font-size: 0.95rem; margin-bottom: 0.6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0.25rem 0; }
.site-footer .fine { margin-top: 2rem; color: #9fb3c8; font-size: 0.85rem; }

/* ---------- Environment / simulation banners ---------- */
.env-banner { background: var(--cc-sim-bg); color: var(--cc-sim); border-bottom: 1px solid #d8b4fe; font-size: 0.88rem; padding: 0.35rem 0; text-align: center; }
.support-banner { background: #fff1f2; color: #9f1239; border-bottom: 2px solid #fda4af; font-weight: 600; padding: 0.5rem 0; text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.55rem 1.1rem; border-radius: var(--cc-radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary { background: var(--cc-teal-700); color: #fff; }
.btn-primary:hover { background: var(--cc-teal-800); color: #fff; }
.btn-secondary { background: var(--cc-surface); color: var(--cc-teal-800); border-color: var(--cc-line-strong); }
.btn-secondary:hover { background: var(--cc-teal-50); color: var(--cc-teal-900); }
.btn-ghost { background: transparent; color: var(--cc-teal-800); }
.btn-ghost:hover { background: var(--cc-teal-50); }
.btn-danger { background: var(--cc-danger); color: #fff; }
.btn-danger:hover { background: #912018; color: #fff; }
.btn-sm { min-height: 36px; padding: 0.35rem 0.75rem; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.search-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; }
.search-form .field { flex: 1 1 16rem; }
.link-button { background: none; border: 0; padding: 0; color: var(--cc-teal-700); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- Cards & layout helpers ---------- */
.card { background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); padding: 1.35rem; }
.card + .card { margin-top: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.85rem; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card-muted { background: var(--cc-teal-50); border-color: var(--cc-teal-100); box-shadow: none; }
.card-warning { background: var(--cc-warning-bg); border-color: #f5c77e; box-shadow: none; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: 0.5rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--cc-muted); }
.text-right { text-align: end; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { margin: 0; }
.page-header .lead { margin: 0.35rem 0 0; color: var(--cc-muted); }
.breadcrumbs { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--cc-muted); }
.breadcrumbs a { color: var(--cc-muted); }

/* ---------- Forms ---------- */
.form { max-width: 640px; }
.field { margin-bottom: 1.1rem; }
.field > label, .field .label { display: block; font-weight: 600; margin-bottom: 0.3rem; color: var(--cc-navy-900); }
.field .hint { display: block; color: var(--cc-muted); font-size: 0.88rem; margin-top: -0.1rem; margin-bottom: 0.35rem; }
.field .optional { font-weight: 400; color: var(--cc-muted); font-size: 0.88rem; }
.input, .select, .textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], input[type="url"], input[type="tel"], select, textarea {
  width: 100%; min-height: 44px; padding: 0.55rem 0.75rem; font: inherit; color: var(--cc-ink);
  background: #fff; border: 1px solid var(--cc-line-strong); border-radius: var(--cc-radius-sm);
}
textarea { min-height: 120px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #9fb3c8; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--cc-danger); box-shadow: 0 0 0 1px var(--cc-danger); }
.input-short { max-width: 220px; }
.input-code { max-width: 180px; font-family: var(--cc-mono); font-size: 1.2rem; letter-spacing: 0.15em; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.4rem 0; }
.check input { width: 20px; height: 20px; margin-top: 0.15rem; flex: 0 0 auto; }
fieldset { border: 1px solid var(--cc-line); border-radius: var(--cc-radius); padding: 1rem 1.1rem; margin: 0 0 1.2rem; }
legend { font-weight: 650; padding: 0 0.35rem; color: var(--cc-navy-900); }
.choice-list { list-style: none; padding: 0; margin: 0; }
.choice-list li { margin: 0.2rem 0; }
.choice-list label { display: inline-flex; gap: 0.5rem; align-items: center; font-weight: 500; }
.char-count { font-size: 0.82rem; color: var(--cc-muted); text-align: end; margin-top: 0.2rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }
.autosave-status { font-size: 0.85rem; color: var(--cc-muted); }
.autosave-status.is-saving::before { content: "\2026 "; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--cc-radius-sm); padding: 0.85rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert h2, .alert h3 { font-size: 1rem; margin: 0 0 0.35rem; color: inherit; }
.alert ul { margin: 0.25rem 0 0; padding-inline-start: 1.2rem; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background: var(--cc-success-bg); border-color: #a7d7b8; color: var(--cc-success); }
.alert-info { background: var(--cc-info-bg); border-color: #b3c9f5; color: var(--cc-info); }
.alert-warning { background: var(--cc-warning-bg); border-color: #f5c77e; color: var(--cc-warning); }
.alert-danger { background: var(--cc-danger-bg); border-color: #f4b4ae; color: var(--cc-danger); }
.alert-sim { background: var(--cc-sim-bg); border-color: #d8b4fe; color: var(--cc-sim); }
.alert a { color: inherit; font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; line-height: 1.5; border: 1px solid transparent; white-space: nowrap;
  max-width: 100%; /* long badges wrap instead of widening the page on small screens */
}
.badge-neutral { background: #eef2f6; color: #3e4c59; border-color: #d9e2ec; }
.badge-success { background: var(--cc-success-bg); color: var(--cc-success); border-color: #a7d7b8; }
.badge-warning { background: var(--cc-warning-bg); color: var(--cc-warning); border-color: #f5c77e; }
.badge-danger { background: var(--cc-danger-bg); color: var(--cc-danger); border-color: #f4b4ae; }
.badge-info { background: var(--cc-info-bg); color: var(--cc-info); border-color: #b3c9f5; }
.badge-teal { background: var(--cc-teal-50); color: var(--cc-teal-800); border-color: var(--cc-teal-100); }
.badge-sim { background: var(--cc-sim-bg); color: var(--cc-sim); border-color: #d8b4fe; }

/* Verification list — each check shown separately (IDN-13), never one catch-all badge */
.verifications { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.verifications li { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.92rem; }
.verifications .what { font-weight: 600; min-width: 11rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 0.65rem 0.8rem; text-align: start; border-bottom: 1px solid var(--cc-line); vertical-align: top; }
.table th { background: #f8fafc; font-weight: 650; color: var(--cc-ink-2); font-size: 0.86rem; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.table caption { text-align: start; padding: 0.6rem 0.8rem; font-weight: 600; }

/* Key/value lists */
dl.kv { display: grid; grid-template-columns: minmax(140px, 35%) 1fr; gap: 0.45rem 1rem; margin: 0; }
dl.kv dt { color: var(--cc-muted); font-weight: 500; }
dl.kv dd { margin: 0; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-total { font-weight: 700; font-size: 1.05rem; }

/* ---------- Tabs (links) ---------- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--cc-line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: 0.6rem 0.9rem; text-decoration: none; color: var(--cc-ink-2); border-bottom: 3px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--cc-teal-800); border-bottom-color: var(--cc-teal-700); }

/* Wizard steps */
.steps { display: flex; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 1.25rem; flex-wrap: wrap; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--cc-muted); }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e4ebf2; font-weight: 700; }
.steps li[aria-current="step"] { color: var(--cc-navy-900); font-weight: 650; }
.steps li[aria-current="step"]::before { background: var(--cc-teal-700); color: #fff; }
.steps li.done::before { background: var(--cc-success); color: #fff; content: "\2713"; }

/* Checklist (onboarding) */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 0.7rem; padding: 0.7rem 0; border-bottom: 1px solid var(--cc-line); align-items: flex-start; }
.checklist li:last-child { border-bottom: 0; }
.checklist .state { flex: 0 0 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.85rem; font-weight: 700; background: #e4ebf2; color: var(--cc-muted); }
.checklist .done .state { background: var(--cc-success); color: #fff; }
.progress { height: 10px; border-radius: 999px; background: #e4ebf2; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--cc-teal-600); }

/* Empty states */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--cc-muted); }
.empty h2, .empty h3 { color: var(--cc-navy-900); }

/* Pagination */
.pagination { display: flex; gap: 0.35rem; align-items: center; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0 0.6rem; border-radius: var(--cc-radius-sm); border: 1px solid var(--cc-line); text-decoration: none; background: #fff; }
.pagination [aria-current="page"] { background: var(--cc-teal-700); color: #fff; border-color: var(--cc-teal-700); }

/* ---------- Authenticated app shell ---------- */
.app-top { background: var(--cc-navy-900); color: #fff; }
.app-top .bar { display: flex; align-items: center; gap: 0.75rem; min-height: 60px; flex-wrap: wrap; }
.app-top .brand { color: #fff; }
.app-top .brand span.dot { color: #7dd3df; }
.app-top a { color: #e6f4f6; }
.app-top .spacer { flex: 1 1 auto; }
.workspace-switch { display: flex; align-items: center; gap: 0.4rem; }
.workspace-switch select { min-height: 38px; background: #1f3a5f; color: #fff; border-color: #3c5a82; padding: 0.3rem 0.6rem; max-width: 260px; }
.workspace-switch .btn { min-height: 38px; }
.top-link { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.6rem; border-radius: var(--cc-radius-sm); text-decoration: none; }
.top-link:hover { background: rgba(255, 255, 255, 0.1); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #f59e0b; color: #1f2933; font-size: 0.78rem; font-weight: 700; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; padding: 0.4rem 0.6rem; border-radius: var(--cc-radius-sm); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { background: rgba(255, 255, 255, 0.1); }
details.menu .menu-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px;
  background: #fff; color: var(--cc-ink); border: 1px solid var(--cc-line); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow-lg); padding: 0.4rem;
}
details.menu .menu-panel a, details.menu .menu-panel button { display: block; width: 100%; text-align: start; padding: 0.55rem 0.7rem; border-radius: var(--cc-radius-sm); color: var(--cc-ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
details.menu .menu-panel a:hover, details.menu .menu-panel button:hover { background: var(--cc-teal-50); }
details.menu .menu-panel .who { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--cc-line); margin-bottom: 0.3rem; font-size: 0.9rem; }

.app-body { display: grid; grid-template-columns: var(--cc-sidebar) 1fr; min-height: calc(100vh - 60px); }
.sidebar { background: #fff; border-inline-end: 1px solid var(--cc-line); padding: 1rem 0.75rem; }
.sidebar .ws-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cc-muted); padding: 0 0.6rem; margin: 0.25rem 0 0.5rem; }
.sidebar nav ul { list-style: none; margin: 0 0 1rem; padding: 0; }
.sidebar nav a { display: flex; align-items: center; gap: 0.55rem; padding: 0.55rem 0.7rem; border-radius: var(--cc-radius-sm); text-decoration: none; color: var(--cc-ink-2); font-weight: 550; }
.sidebar nav a:hover { background: var(--cc-teal-50); color: var(--cc-teal-800); }
.sidebar nav a[aria-current="page"] { background: var(--cc-teal-100); color: var(--cc-teal-900); }
.sidebar nav .section { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cc-muted); padding: 0.75rem 0.7rem 0.25rem; }
.app-main { padding: 1.5rem 1.75rem 3rem; min-width: 0; }
.sidebar-toggle { display: none; }

@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { border-inline-end: 0; border-bottom: 1px solid var(--cc-line); padding: 0.5rem 16px; }
  .sidebar-toggle { display: block; }
  .sidebar details:not([open]) nav { display: none; }
  .sidebar details > summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; }
  .app-main { padding: 1.25rem 16px 3rem; }
  .workspace-switch select { max-width: 170px; }
  h1 { font-size: 1.55rem; }
}
@media (min-width: 901px) {
  .sidebar details > summary { display: none; }
}

/* ---------- Public marketing ---------- */
.hero { background: linear-gradient(160deg, var(--cc-teal-900), var(--cc-teal-700)); color: #fff; padding: 4rem 0 3.5rem; }
.hero h1 { color: #fff; font-size: 2.35rem; max-width: 760px; }
.hero p.lead { font-size: 1.15rem; max-width: 680px; color: #d7eef1; }
.hero .btn-secondary { background: transparent; color: #fff; border-color: #7dd3df; }
.hero .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
.section { padding: 3rem 0; }
.section-alt { background: #fff; border-block: 1px solid var(--cc-line); }
.feature h3 { margin-bottom: 0.35rem; }
.feature .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--cc-teal-50); display: grid; place-items: center; margin-bottom: 0.75rem; color: var(--cc-teal-700); font-weight: 700; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.steps-list li { counter-increment: s; background: #fff; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); padding: 1rem 1rem 1rem 3.5rem; position: relative; }
.steps-list li::before { content: counter(s); position: absolute; inset-inline-start: 1rem; top: 1rem; width: 28px; height: 28px; border-radius: 50%; background: var(--cc-teal-700); color: #fff; display: grid; place-items: center; font-weight: 700; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 2rem; }
.draft-banner { border: 2px dashed var(--cc-warning); background: var(--cc-warning-bg); color: var(--cc-warning); padding: 0.8rem 1rem; border-radius: var(--cc-radius); margin-bottom: 1.25rem; font-weight: 600; }

/* Auth pages */
.auth-wrap { padding: 2.5rem 0 3rem; }
.auth-card { max-width: 480px; margin: 0 auto; }
.auth-card h1 { font-size: 1.6rem; }
.qr { display: block; width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--cc-line); border-radius: var(--cc-radius-sm); background: #fff; }
.codes { font-family: var(--cc-mono); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; background: #f8fafc; border: 1px solid var(--cc-line); border-radius: var(--cc-radius-sm); padding: 0.9rem 1rem; font-size: 1.05rem; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 0.6rem; max-height: 60vh; overflow-y: auto; padding: 0.5rem; background: #fbfcfd; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); }
.msg { max-width: 78%; padding: 0.55rem 0.8rem; border-radius: 12px; background: #fff; border: 1px solid var(--cc-line); }
.msg.mine { align-self: flex-end; background: var(--cc-teal-50); border-color: var(--cc-teal-100); }
.msg .meta { font-size: 0.78rem; color: var(--cc-muted); margin-bottom: 0.15rem; }
.msg.quarantined { background: var(--cc-warning-bg); border-color: #f5c77e; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--cc-line); }
.timeline li { position: relative; padding: 0 0 1rem 1.1rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: 0.35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--cc-teal-600); }
.timeline .when { font-size: 0.82rem; color: var(--cc-muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .app-top, .sidebar, .btn, .env-banner { display: none !important; }
  .app-body { display: block; }
  body { background: #fff; }
}

/* Progress widths (no inline styles under CSP) */
.progress > span.w-0 { width: 0%; } .progress > span.w-10 { width: 10%; } .progress > span.w-20 { width: 20%; } .progress > span.w-30 { width: 30%; } .progress > span.w-40 { width: 40%; } .progress > span.w-50 { width: 50%; } .progress > span.w-60 { width: 60%; } .progress > span.w-70 { width: 70%; } .progress > span.w-80 { width: 80%; } .progress > span.w-90 { width: 90%; } .progress > span.w-100 { width: 100%; }

/* Preserve line breaks in user-entered text (always HTML-encoded server-side). */
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Conversations (Messages/Conversation.aspx; new items appended by Scripts/app.js polling). */
.messages { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.msg { max-width: 46rem; padding: 0.75rem 1rem; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: var(--cc-surface); }
.msg-mine { margin-inline-start: auto; background: var(--cc-teal-50); border-color: var(--cc-teal-100); }
.msg-meta { font-size: 0.85rem; color: var(--cc-muted); margin-bottom: 0.25rem; }
.msg-body { margin: 0; }
.msg-notice { margin: 0.4rem 0 0; font-size: 0.9rem; color: var(--cc-warning); }
.msg-attachment { margin: 0.4rem 0 0; font-size: 0.92rem; }
.msg-actions { margin-top: 0.4rem; }

/* Milestone checkout (Contracts/Fund.aspx): room for the provider SDK card iframe and status text. */
.card-form { min-height: 96px; margin: 0.5rem 0 1rem; }
.text-danger { color: var(--cc-danger); }

/* Rating scales (Contracts/Review.aspx) and quoted review text in moderation. */
.choice-list.inline li { display: inline-block; margin-inline-end: 1.1rem; }
blockquote { margin: 0.5rem 0; padding: 0.5rem 0.9rem; border-inline-start: 3px solid var(--cc-line); background: var(--cc-surface); }

/* Support sessions: the banner carries its own end button. */
.support-banner form { display: inline-block; margin-left: 0.75rem; }

@media (max-width: 600px) {
  .badge { white-space: normal; text-align: start; }
}
