/* CareFlow Demo Guide. Calm, light and dark aware. */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --text: #1c2624;
  --muted: #5b6965;
  --border: #d9e0dd;
  --accent: #0f6e6a;
  --accent-strong: #0b5753;
  --accent-soft: #e2f0ee;
  --accent-text: #ffffff;
  --danger: #a3332b;
  --danger-soft: #fbeceb;
  --focus: #2b7fd8;
  --shadow: 0 1px 2px rgba(20, 35, 32, 0.06), 0 4px 16px rgba(20, 35, 32, 0.05);
  --radius: 12px;
  --radius-small: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111716;
    --surface: #18201f;
    --surface-2: #1f2928;
    --text: #e4ebe9;
    --muted: #9aa9a5;
    --border: #2d3a38;
    --accent: #4fb3aa;
    --accent-strong: #6cc5bc;
    --accent-soft: #1d3432;
    --accent-text: #0b1615;
    --danger: #f08b82;
    --danger-soft: #3a1f1d;
    --focus: #7db6f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 0.85rem; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.optional { color: var(--muted); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-small); z-index: 10; }
.skip:focus { left: 16px; }

/* Header and footer */
.bar { max-width: 760px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bar-wide { max-width: 1180px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .bar { min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand strong { font-weight: 700; }
.brand-mark { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 6px 2px; }
.nav a:hover { color: var(--text); }
.inline-form { margin: 0; display: inline; }
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
.main-wide { max-width: 1180px; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: 0.9rem; }
.site-footer .bar { padding-top: 18px; padding-bottom: 18px; }
.site-footer p { margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: var(--radius-small);
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-text); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 1px solid transparent; border-radius: var(--radius-small); background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.copied { color: var(--accent); }

/* Panels and forms */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.panel-narrow { max-width: 520px; margin: 0 auto; }
.panel-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.lede { color: var(--muted); font-size: 1.05rem; }
.eyebrow { color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.8rem; }
.form { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.form label { font-weight: 600; margin-top: 10px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-small); padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
[aria-invalid="true"] { border-color: var(--danger); }
.form .btn { margin-top: 16px; }
.field-error { color: var(--danger); font-size: 0.875rem; margin: 2px 0 0; }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-small); padding: 10px 12px; margin: 12px 0; }

/* Sections and cards */
.intro { margin-bottom: 8px; max-width: 760px; }
.section { margin-top: 40px; }
.section-head { margin-bottom: 18px; }
.section-head h2, .surface-title { display: flex; align-items: center; gap: 10px; }
.section-head h2 .icon, .surface-title .icon { color: var(--accent); }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.surface { margin-bottom: 30px; }
.surface-summary { margin: -2px 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); color: var(--text);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.card-title { margin: 4px 0 0; }
.card-text { color: var(--muted); flex: 1; margin-bottom: 8px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-foot { margin: 0; font-weight: 600; color: var(--accent); }
.card-link { text-decoration: none; transition: border-color 0.15s ease; }
.card-link:hover { border-color: var(--accent); color: var(--text); }
.card-soon { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.length { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; margin-left: auto; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table thead th { background: var(--surface-2); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table td a { display: inline-flex; align-items: center; gap: 4px; word-break: break-all; }
.table .how { min-width: 240px; color: var(--muted); }
.table-admin { font-size: 0.86rem; }

@media (max-width: 760px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack th, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack th, .table-stack td { border: 0; padding: 4px 14px; }
  .table-stack th[scope="row"] { font-size: 1.02rem; }
  .table-stack td::before { content: attr(data-label); display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
  .table .how { min-width: 0; }
  .site-header .bar { padding-top: 10px; padding-bottom: 10px; }
}

/* Player */
.player {
  width: min(1040px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); overflow: auto;
}
.player::backdrop { background: rgba(8, 14, 13, 0.72); }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.player-title { font-size: 1.05rem; margin: 0; }
.video-frame { background: #000; aspect-ratio: 16 / 9; }
.video-frame video { width: 100%; height: 100%; display: block; background: #000; }
.player-tools { display: flex; align-items: center; gap: 12px; padding: 12px 18px; flex-wrap: wrap; }
.player-status { margin: 0; flex: 1; min-width: 120px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-small); overflow: hidden; }
.seg { font: inherit; font-size: 0.875rem; font-weight: 600; padding: 6px 12px; min-height: 34px; background: transparent; color: var(--muted); border: 0; cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--border); }
.seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* Feedback */
.feedback, .feedback-done { padding: 20px 18px 22px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.feedback-done { align-items: flex-start; }
.feedback label { font-weight: 600; margin-top: 8px; }
.feedback fieldset { border: 0; padding: 0; margin: 8px 0 0; }
.feedback legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.rating-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-btn, .choice { position: relative; margin: 0 !important; }
.rating-btn input, .choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating-btn span, .choice span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-small); font-weight: 600; cursor: pointer; background: var(--surface);
}
.rating-btn input:checked + span, .choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.rating-btn input:focus-visible + span, .choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.rating-scale { display: flex; justify-content: space-between; max-width: 296px; margin: 4px 0 0; }
.yesno { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.yesno legend { width: 100%; }
.feedback-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.feedback-only .player-stage { display: none; }

/* Guide pages */
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 0.9rem; margin-bottom: 16px; }
.guide-head { margin-bottom: 24px; }
.search { position: relative; max-width: 560px; margin-top: 12px; }
.search input { padding-left: 40px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results { max-width: 560px; }
.search-results ul { list-style: none; padding: 0; margin: 8px 0 0; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
.search-results li + li { border-top: 1px solid var(--border); }
.search-results a { display: block; padding: 10px 12px; text-decoration: none; color: var(--text); }
.search-results a:hover { background: var(--surface-2); }
.search-results .snippet { display: block; color: var(--muted); font-size: 0.875rem; }
.guide { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 900px; }
.guide h2 { margin-top: 1.6rem; }
.guide h3 { margin-top: 1.2rem; }
.guide img { max-width: 100%; height: auto; border-radius: var(--radius-small); border: 1px solid var(--border); }
.guide table { border-collapse: collapse; width: 100%; }
.guide th, .guide td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.guide .hit { background: var(--accent-soft); outline: 2px solid var(--accent); border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Surface label on cards that share a grid */
.card-surface { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--accent-strong); text-transform: none; }
.card-surface .icon { color: var(--accent); }
.card-head .length { margin-left: auto; }

/* Demo links table: keep accounts and passwords readable */
.table .account { word-break: normal; overflow-wrap: normal; }
.table .mono.nowrap { word-break: normal; white-space: nowrap; }
@media (min-width: 761px) {
  .table-stack { table-layout: fixed; }
  .table-stack th:nth-child(1) { width: 16%; }
  .table-stack th:nth-child(2) { width: 18%; }
  .table-stack th:nth-child(3) { width: 24%; }
  .table-stack th:nth-child(4) { width: 16%; }
  .table-stack th:nth-child(5) { width: 26%; }
  .table .how { min-width: 0; }
}
td[data-label="Password"] { white-space: nowrap; }
[hidden] { display: none !important; }
