/* Recobra: sober, mobile-first styles. No inline styles anywhere (strict CSP). */
:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --ink: #16282b;
  --muted: #5a6e72;
  --line: #d6e0e1;
  --primary: #0f766e;
  --primary-dark: #0b5c56;
  --primary-soft: #e0f2f0;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #15803d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 40, 43, 0.06), 0 4px 14px rgba(22, 40, 43, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
ul, ol { margin: 0 0 0.75rem; padding-left: 1.25rem; }
a { color: var(--primary-dark); }
a:hover { color: var(--primary); }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 0.5rem; top: -3rem; background: var(--primary); color: #fff;
  padding: 0.5rem 0.75rem; border-radius: 8px; z-index: 100;
}
.skip-link:focus { top: 0.5rem; }
:focus-visible { outline: 3px solid #1d9bf0; outline-offset: 2px; }

/* Header and notice */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.6rem; padding-bottom: 0.6rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img { border-radius: 8px; }
.brand-name { display: block; font-size: 1.25rem; font-weight: 700; letter-spacing: 0.01em; }
.brand-tag { display: block; font-size: 0.8rem; color: var(--muted); line-height: 1.2; }
.lang-switch select { min-height: 2.5rem; min-width: 7rem; }
.notice { position: sticky; top: 0; z-index: 20; background: var(--warn-soft); border-bottom: 1px solid #f0c987; font-size: 0.85rem; }
.notice .wrap { padding-top: 0.4rem; padding-bottom: 0.4rem; }
.notice-text { margin: 0; }
.notice-more summary { cursor: pointer; font-weight: 600; color: var(--warn); padding: 0.2rem 0; }
.notice-more { max-height: 60vh; overflow: auto; }

/* Tabs */
.tabs { background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs-row { display: flex; gap: 0.25rem; overflow-x: auto; }
.tabs button {
  flex: 0 0 auto; min-height: 2.9rem; padding: 0 0.6rem; font-size: 0.92rem; border: 0; border-bottom: 3px solid transparent;
  background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected='true'] { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tabs button:hover { color: var(--primary-dark); }

main { padding-top: 1.25rem; padding-bottom: 2rem; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1rem 0 1.5rem; font-size: 0.85rem; color: var(--muted); }
.site-footer p { margin-bottom: 0.4rem; }

/* Cards and callouts */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card > :last-child { margin-bottom: 0; }
.callout { border-radius: 10px; padding: 0.75rem 0.9rem; margin-bottom: 1rem; background: var(--primary-soft); border: 1px solid #b6dcd8; }
.callout.warn { background: var(--warn-soft); border-color: #f0c987; }
.callout.danger { background: var(--danger-soft); border-color: #f0b4ae; }
.callout.ok { background: #e6f6ec; border-color: #a7d9b9; }
.callout h3, .callout h4 { margin-bottom: 0.25rem; }
.callout ul { margin-bottom: 0; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); vertical-align: middle; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: #e6f6ec; color: var(--ok); }

/* Forms */
.field { margin-bottom: 1rem; }
.field > label, .field > legend, fieldset > legend { display: block; font-weight: 600; margin-bottom: 0.25rem; padding: 0; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 0.15rem 0 0.4rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
input[type='text'], input[type='number'], input[type='date'], input[type='time'], input[type='url'], select, textarea {
  width: 100%; min-height: 2.75rem; padding: 0.5rem 0.65rem; font: inherit; color: inherit;
  background: #fff; border: 1px solid #aebfc1; border-radius: 8px;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: #eef2f2; color: #6b7c80; }
.counter { text-align: right; font-size: 0.8rem; color: var(--muted); }
.counter.over { color: var(--danger); font-weight: 600; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.choice { display: flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; font-weight: 400; }
.choice input { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
.field > label.choice { font-weight: 400; align-items: flex-start; }
.grid { display: grid; gap: 0.75rem 1rem; grid-template-columns: 1fr; }
.consent { background: var(--warn-soft); border: 1px solid #f0c987; border-radius: 10px; padding: 0.75rem; }
.error-text { color: var(--danger); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 2.75rem;
  padding: 0.5rem 1rem; font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--primary-dark); }
.btn.secondary:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.small { min-height: 2.25rem; padding: 0.25rem 0.7rem; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-dark); text-decoration: underline; cursor: pointer; }

/* Status / progress */
.status { display: flex; align-items: center; gap: 0.75rem; }
.spinner {
  width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin 0.9s linear infinite; flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
progress, meter { width: 100%; height: 1rem; }

/* Plan */
.plan-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.phase { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; box-shadow: var(--shadow); }
.phase > summary { cursor: pointer; padding: 0.8rem 1rem; font-weight: 700; display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; }
.phase-body { padding: 0 1rem 1rem; }
.phase-summary-dates { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.phase-controls { display: grid; gap: 0.5rem 1rem; grid-template-columns: repeat(2, 1fr); margin: 0.75rem 0; }
.phase-controls label { font-size: 0.85rem; font-weight: 600; display: block; }
.phase-controls .static { padding-top: 0.2rem; }
.exercise { border-top: 1px solid var(--line); padding: 0.75rem 0; }
.exercise.off { opacity: 0.6; }
.exercise-top { display: flex; gap: 0.6rem; align-items: flex-start; }
.exercise-top input[type='checkbox'] { width: 1.4rem; height: 1.4rem; margin-top: 0.15rem; flex: 0 0 auto; }
.exercise-title { font-weight: 700; margin: 0; }
.exercise-desc { margin: 0.15rem 0 0.4rem; }
.ex-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; max-width: 24rem; margin: 0.4rem 0; }
.ex-numbers label { font-size: 0.8rem; font-weight: 600; display: block; }
.ex-more { margin: 0.4rem 0; }
.ex-more summary { cursor: pointer; color: var(--primary-dark); font-size: 0.9rem; }
.ex-more dl { margin: 0.4rem 0 0; font-size: 0.9rem; }
.ex-more dt { font-weight: 600; }
.ex-more dd { margin: 0 0 0.4rem; }
.video-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.4rem; }
.video-row .own { flex: 1 1 14rem; }
.criteria { display: grid; gap: 0.75rem; grid-template-columns: 1fr; margin: 0.75rem 0; }
.milestone-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.milestone-list li { border-left: 3px solid var(--primary); background: var(--primary-soft); padding: 0.4rem 0.7rem; margin-bottom: 0.4rem; border-radius: 0 8px 8px 0; }
.sources li { margin-bottom: 0.3rem; word-break: break-word; }
fieldset.frozen { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef4f4; font-weight: 700; white-space: nowrap; }
td.num { white-space: nowrap; }

/* Gantt */
.gantt-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.gantt { display: block; min-width: 40rem; width: 100%; height: auto; }
.gantt text { font-family: var(--font); fill: var(--ink); font-size: 12px; }
.gantt .axis-line { stroke: #d6e0e1; stroke-width: 1; }
.gantt .axis-text { fill: var(--muted); font-size: 11px; }
.gantt .row-label { font-weight: 600; }
.gantt .bar-recovery-0 { fill: #0f766e; }
.gantt .bar-recovery-1 { fill: #1b8f85; }
.gantt .bar-recovery-2 { fill: #3aa79c; }
.gantt .bar-recovery-3 { fill: #0b5c56; }
.gantt .bar-running { fill: #c2570c; }
.gantt .bar-upper { fill: #4a6a9c; }
.gantt .milestone { fill: #fff; stroke: #16282b; stroke-width: 1.5; }
.gantt .milestone.done { fill: #15803d; }
.gantt .today-line { stroke: #b42318; stroke-width: 1.5; stroke-dasharray: 4 3; }
.gantt .today-text { fill: #b42318; font-size: 11px; font-weight: 600; }
.gantt .bar-text { fill: #fff; font-size: 11px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.85rem; margin: 0.6rem 0; }
.legend span::before { content: ''; display: inline-block; width: 0.8rem; height: 0.8rem; margin-right: 0.35rem; border-radius: 3px; vertical-align: -0.1rem; background: var(--primary); }
.legend .l-running::before { background: #c2570c; }
.legend .l-upper::before { background: #4a6a9c; }
.legend .l-ms::before { background: #fff; border: 1.5px solid #16282b; border-radius: 50%; }

/* Tracking */
.stat-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
.stat { background: var(--primary-soft); border-radius: 10px; padding: 0.75rem; }
.stat .big { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.pain-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.session { border-top: 1px solid var(--line); padding: 0.6rem 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; justify-content: space-between; }
.session-main { flex: 1 1 14rem; }
.session-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.session-actions input[type='number'] { width: 4.5rem; }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: 0.35rem; background: var(--ok); }
.dot.bad { background: var(--danger); }
.dot.off { background: #9aa9ac; }

@media (min-width: 40rem) {
  h1 { font-size: 1.9rem; }
  .grid.two { grid-template-columns: repeat(2, 1fr); }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  .phase-controls { grid-template-columns: repeat(4, 1fr); }
  .criteria { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 1.25rem; }
  .phase-body { padding: 0 1.25rem 1.25rem; }
}

@media print {
  .notice, .tabs, .btn, .lang-switch { display: none; }
}
