/* Layout idea: a calm wellness notebook — warm sand paper, sage green for actions,
   soft clay for "needs your attention", an elegant soft serif for titles. */
:root {
  --bg: #f6f1e8;
  --surface: #fffdf8;
  --surface-2: #f2ede3;
  --ink: #2f3a2e;
  --muted: #6f786b;
  --line: #e4dccb;
  --accent: #5f7d5c;
  --accent-soft: #e1e8da;
  --on-accent: #ffffff;
  --attention: #d08a6c;
  --attention-soft: #f7e4da;
  --attention-ink: #8e4a2f;
  --good: #4f8a5b;
  --good-soft: #e1efe2;
  --bad: #b85450;
  --bad-soft: #f5e1de;
  --chrome: #e7dfcf;
  --chrome-ink: #3e5340;
  --side: #3e5340;
  --side-ink: #f6f1e8;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(62, 83, 64, .05), 0 6px 18px rgba(62, 83, 64, .06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171c17; --surface: #20271f; --surface-2: #262e25; --ink: #ede8de; --muted: #a9b0a3;
    --line: #343e32; --accent: #9cb898; --accent-soft: #2c3a2b; --on-accent: #142013;
    --attention: #e3a88e; --attention-soft: #3b2a22; --attention-ink: #f0c2ad; --good: #8cc29a; --good-soft: #1f3325;
    --bad: #e59a93; --bad-soft: #3d2422; --chrome: #20271f; --chrome-ink: #e1e8da; --side: #121712; --side-ink: #ede8de;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171c17; --surface: #20271f; --surface-2: #262e25; --ink: #ede8de; --muted: #a9b0a3;
  --line: #343e32; --accent: #9cb898; --accent-soft: #2c3a2b; --on-accent: #142013;
  --attention: #e3a88e; --attention-soft: #3b2a22; --attention-ink: #f0c2ad; --good: #8cc29a; --good-soft: #1f3325;
  --bad: #e59a93; --bad-soft: #3d2422; --chrome: #20271f; --chrome-ink: #e1e8da; --side: #121712; --side-ink: #ede8de;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.005em; line-height: 1.15; margin: 0; text-wrap: balance; color: var(--chrome-ink); }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.15rem; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; color: var(--ink); }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Boot / spinner ---------- */
.boot { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); padding: 40px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- Buttons & inputs ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 .95rem/1 var(--font-body); padding: 11px 16px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 42px;
}
.btn:hover { border-color: var(--muted); }
.btn svg, .chev svg, .pill svg { width: 18px; height: 18px; flex: none; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 7px 12px; min-height: 34px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; font: 600 1rem/1 var(--font-body); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="url"], input[type="search"], input[type="tel"], select, textarea {
  font: 400 1rem/1.4 var(--font-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* ---------- Cards, pills ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.flat { box-shadow: none; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 .75rem/1 var(--font-body); padding: 5px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.attention { background: var(--attention-soft); color: var(--attention-ink); border-color: transparent; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--attention); display: inline-block; flex: none; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); }

/* ---------- Coach shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.shell > div { min-width: 0; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
:root[data-theme="dark"] .sidebar { border-right: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sidebar { border-right: 1px solid var(--line); } }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.55rem; letter-spacing: 0; padding: 4px 10px 18px; line-height: 1.05; }
.brand small { display: block; font-family: var(--font-body); font-size: .75rem; font-weight: 600; letter-spacing: .03em; opacity: .7; margin-top: 6px; }
.nav-item { appearance: none; border: 0; background: transparent; color: inherit; text-align: left; font: 600 .95rem/1 var(--font-body); padding: 12px 12px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 12px; opacity: .78; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { opacity: 1; background: rgba(255,255,255,.07); }
.nav-item.active { opacity: 1; background: rgba(255,255,255,.14); }
.nav-item .count { margin-left: auto; background: var(--attention); color: #fff; font-size: .72rem; padding: 3px 7px; border-radius: 999px; }
.sidebar .spacer { flex: 1; }
.main { padding: 28px clamp(16px, 4vw, 44px) 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .kicker { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.page-head .kicker::first-letter { text-transform: uppercase; }
.mobile-top, .tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(12px + var(--safe-top)) 16px 12px; background: var(--chrome); color: var(--chrome-ink); position: sticky; top: 0; z-index: 20; }
  .mobile-top .brand { padding: 0; font-size: 1.3rem; }
  .main { padding: 20px 16px calc(96px + var(--safe-bottom)); }
}

/* ---------- Bottom tab bar (client + coach mobile) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-bottom)); justify-content: space-around; }
.tabbar button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 .72rem/1.1 var(--font-body); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 10px; cursor: pointer; flex: 1; position: relative; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--accent); }
.tabbar .badge { position: absolute; top: 2px; right: calc(50% - 20px); background: var(--attention); color: #fff; font-size: .65rem; padding: 2px 5px; border-radius: 999px; }
@media (max-width: 860px) { .shell .tabbar { display: flex; } }

/* ---------- Client shell ---------- */
.client-shell { min-height: 100%; }
.client-top { background: var(--chrome); color: var(--chrome-ink); padding: calc(18px + var(--safe-top)) 18px 22px; }
.client-top .inner, .client-main { max-width: 640px; margin: 0 auto; }
.client-top .brand { padding: 0; font-size: 1.05rem; opacity: .8; }
.client-top h1 { margin-top: 12px; font-size: 2.2rem; }
.client-main { padding: 18px 16px calc(100px + var(--safe-bottom)); }
.client-shell .tabbar { display: flex; }
.wa-btn { display: inline-flex; align-items: center; gap: 8px; color: var(--chrome-ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: .82rem; font-weight: 600; text-decoration: none; }
.wa-btn svg { width: 16px; height: 16px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .value { font-family: var(--font-display); font-size: 2.3rem; font-weight: 600; color: var(--chrome-ink); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.stat.attention { border-color: var(--attention); background: var(--attention-soft); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1080px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item { appearance: none; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; font: inherit; display: flex; gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer; width: 100%; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.static { cursor: default; }
.list-item.static:hover { background: transparent; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--attention-soft); color: var(--attention-ink); display: grid; place-items: center; font: 700 .95rem/1 var(--font-body); letter-spacing: .02em; flex: none; text-transform: uppercase; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.li-title { font-weight: 600; }
.li-sub { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chev { color: var(--muted); flex: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 .95rem/1 var(--font-body); padding: 12px 14px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button.active { color: var(--chrome-ink); border-bottom-color: var(--accent); }
.tabs .dot { margin-left: 6px; vertical-align: middle; }

/* ---------- Program editor ---------- */
.editor-bar { position: sticky; top: 0; z-index: 15; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
@media (max-width: 860px) { .editor-bar { top: calc(58px + var(--safe-top)); } }
.editor-bar .state { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.session-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.session-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.session-head .letter { font: 600 1.25rem/1 var(--font-display); color: var(--accent); width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.session-head input { font-weight: 600; background: var(--surface); }
.session-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.ex-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.ex-row { display: grid; grid-template-columns: 26px minmax(170px, 2.2fr) 64px 1fr 1fr 1fr minmax(120px, 1.4fr) auto; gap: 8px; align-items: center; }
.ex-row.head { font-size: .78rem; font-weight: 700; color: var(--muted); padding: 0 0 2px; }
.ex-row .idx { font: 600 1rem/1 var(--font-display); color: var(--muted); text-align: center; }
.ex-row input { padding: 8px 9px; font-size: .92rem; }
.ex-row .acts { display: flex; gap: 2px; }
.linked { box-shadow: inset 3px 0 0 var(--good); }
@media (max-width: 1100px) {
  .ex-row.head { display: none; }
  .ex-row { grid-template-columns: 1fr 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
  .ex-row .idx { display: none; }
  .ex-row .c-name { grid-column: 1 / -1; }
  .ex-row .c-notes { grid-column: 1 / 3; }
  .ex-row .c-acts { grid-column: 3; justify-self: end; }
  .ex-row .lbl { display: block !important; }
}
.ex-row .lbl { display: none; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }

/* ---------- Client session ---------- */
.session-tile { appearance: none; text-align: left; width: 100%; border: 1px solid var(--line); background: var(--surface); color: inherit; font: inherit; border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; cursor: pointer; box-shadow: var(--shadow); }
.session-tile:hover { border-color: var(--accent); }
.session-tile .letter { font: 600 1.6rem/1 var(--font-display); color: var(--on-accent); background: var(--accent); width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ex-card.complete { border-color: var(--good); }
.ex-card .prescription { display: flex; flex-wrap: wrap; gap: 6px; }
.set-row { display: grid; grid-template-columns: 62px 1fr 1fr 46px; gap: 8px; align-items: center; }
.set-row .set-n { font: 700 .92rem/1 var(--font-body); color: var(--muted); }
.set-row input { text-align: center; padding: 10px 6px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.set-head { display: grid; grid-template-columns: 62px 1fr 1fr 46px; gap: 8px; font-size: .78rem; font-weight: 700; color: var(--muted); text-align: center; }
.check { appearance: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: transparent; }
.check svg { width: 22px; height: 22px; }
.check.on { background: var(--attention); border-color: var(--attention); color: #fff; }
.rpe { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.rpe button { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 1rem/1 var(--font-body); height: 42px; border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.rpe button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rpe-scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.sticky-save { position: sticky; bottom: calc(76px + var(--safe-bottom)); z-index: 10; padding-top: 6px; }
details.howto summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; list-style: none; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto p { margin-top: 8px; font-size: .92rem; color: var(--muted); }

/* ---------- Logs / feed ---------- */
.log-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.log-card.unseen { border-left: 4px solid var(--attention); }
.log-results { width: 100%; border-collapse: collapse; font-size: .9rem; }
.log-results th { text-align: left; font-size: .78rem; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.log-results td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.log-results tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: 10px 12px; font-size: .95rem; white-space: pre-wrap; }
.bubble.coach { background: var(--accent-soft); border-color: transparent; border-radius: 12px 12px 4px 12px; }
.bubble .who { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.bubble.coach .who { color: var(--accent); }
.rpe-chip { font: 700 .82rem/1 var(--font-body); padding: 5px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rpe-chip.hi { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.rpe-chip.mid { background: var(--attention-soft); color: var(--attention-ink); border-color: transparent; }
.rpe-chip.lo { background: var(--good-soft); color: var(--good); border-color: transparent; }

/* ---------- Chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font: 500 11px var(--font-body); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .pt.last { fill: var(--accent); }
.chart .val { fill: var(--ink); font: 700 12px var(--font-body); }

/* ---------- Library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.lib-card .lib-desc { color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .85rem/1 var(--font-body); padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Auth ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--chrome); color: var(--chrome-ink); padding: 48px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-side h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: .95; }
.auth-side .tag { opacity: .7; max-width: 34ch; margin-top: 16px; }
.auth-side .lines { display: flex; flex-direction: column; gap: 10px; font-size: .95rem; opacity: .85; }
.auth-side .lines span { display: flex; gap: 10px; align-items: center; }
.auth-side .lines i { width: 10px; height: 10px; background: var(--attention); border-radius: 50%; display: inline-block; flex: none; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form form, .auth-form .box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.auth-switch { text-align: center; font-size: .92rem; color: var(--muted); }
.link-btn { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.form-info { background: var(--good-soft); color: var(--good); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-side { padding: calc(28px + var(--safe-top)) 22px 26px; }
  .auth-side .lines { display: none; }
  .auth-side h1 { font-size: 2.4rem; }
}

/* ---------- Demo banner ---------- */
.demo-bar { background: var(--attention-soft); color: var(--attention-ink); font-size: .85rem; font-weight: 600; padding: 8px 16px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; position: relative; z-index: 40; }
.demo-bar select { width: auto; padding: 4px 8px; font-size: .85rem; }

/* ---------- Modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 13, .5); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); color: var(--ink); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
#toast-root { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); }
.toast.error { background: var(--bad); color: #fff; }

/* ---------- Success ---------- */
.success { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.success .big-check { width: 84px; height: 84px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; }
.success .big-check svg { width: 44px; height: 44px; }

/* ---------- Photos & vidéos ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.upload-btn { position: relative; align-self: flex-start; cursor: pointer; }
.upload-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.media-zone { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.media-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.media-row:empty { display: none; }
.media-wrap { position: relative; display: inline-block; }
.media-tile { appearance: none; width: 78px; height: 78px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0; overflow: hidden; cursor: pointer; display: grid; place-items: center; color: var(--accent); font: 600 .72rem/1.1 var(--font-body); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile.video { background: var(--accent-soft); gap: 2px; align-content: center; }
.media-tile.video svg { width: 26px; height: 26px; }
.media-tile.missing { background: var(--surface-2); }
.media-tile.missing img { display: none; }
.media-tile.missing::after { content: "Indisponible"; font-size: .65rem; color: var(--muted); }
.media-x { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; cursor: pointer; padding: 0; }
.media-x svg { width: 13px; height: 13px; }
.note-line { font-size: .85rem; margin-top: 4px; color: var(--ink); font-style: italic; }
.viewer { z-index: 130; }
.viewer .modal { max-width: 720px; }

/* ---------- Adaptations Laravel ---------- */
[x-cloak] { display: none !important; }
a.nav-item, a.list-item, .tabbar a, .tabs a, a.chip, a.session-tile, a.btn { text-decoration: none; }
.tabbar a { color: var(--muted); font: 600 .72rem/1.1 var(--font-body); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 10px; flex: 1; position: relative; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); }
.tabs a { color: var(--muted); font: 600 .95rem/1 var(--font-body); padding: 12px 14px; border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a.active { color: var(--chrome-ink); border-bottom-color: var(--accent); }
.nav-item { width: 100%; }
.sidebar form { margin: 0; }
.chart .bar { fill: var(--accent); opacity: .5; }
.chart .bar.last { opacity: 1; }
.media-tile .vid, .media-tile .upl { display: grid; place-items: center; gap: 2px; font: 600 .72rem/1.1 var(--font-body); color: var(--accent); }
.media-tile .upl .spinner { width: 20px; height: 20px; border-width: 2px; }
.media-tile[disabled] { cursor: progress; }
dialog.modal { border: 0; padding: 22px; }
dialog.modal::backdrop { background: rgba(23, 28, 23, .5); }
dialog.modal[open] { display: flex; }
.modal-backdrop[style*="display: none"] { display: none !important; }
.auth-form .box .btn.block { margin-top: 2px; }
form[data-confirm] { display: inline; }

/* Préparation d'une vidéo avant envoi (découpe + compression) */
.vprep .modal { max-width: 560px; }
.vprep-video { width: 100%; max-height: 42vh; border-radius: 12px; background: #000; }
.vprep input[type=range] { width: 100%; accent-color: var(--accent); }
.vprep label.field span { color: var(--ink); font-weight: 700; }
.vprep-sum { background: var(--accent-soft); color: var(--chrome-ink); border-radius: 10px; padding: 8px 12px; margin: 0; }
