/* Treeningkava – disainikeel: pulsitsoonide värvid + võistlusnumbri tüpograafia
   Palett: ink #182420 · paper #F1F4F0 · z1 #C4D7E4 · z2 #3E7CB1 · z3 #3F9C6B
           z4 #E8871E · z5 #D0453E · race #E8590C */
:root {
  --ink: #182420;
  --ink-soft: #51605A;
  --paper: #F1F4F0;
  --card: #FFFFFF;
  --line: #DDE4DF;
  --z1: #C4D7E4;
  --z2: #3E7CB1;
  --z3: #3F9C6B;
  --z4: #E8871E;
  --z5: #D0453E;
  --race: #E8590C;
  --strength: #5B5470;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 14px 48px; }
h1, h2, h3, .brand, .bib-wd, .date-line, .login-mark {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: 0.02em;
}
h1 { font-size: 30px; font-weight: 700; text-transform: uppercase; margin: 2px 0 0; line-height: 1.1; }
h2 { font-size: 24px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 19px; font-weight: 600; text-transform: uppercase;
     letter-spacing: 0.06em; margin: 22px 0 8px; color: var(--ink-soft); }
a { color: inherit; }
p { margin: 10px 0; }
.muted { color: var(--ink-soft); font-size: 14px; }

/* ---- topbar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: #F4F7F4;
  padding: 10px 14px;
}
.brand { font-size: 22px; font-weight: 700; text-decoration: none; color: #fff; }
.brand span { color: var(--z4); }
.topbar nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.topbar nav a {
  text-decoration: none; padding: 6px 10px; border-radius: 6px;
  font-size: 14px; font-weight: 500; color: #D6DFD9; white-space: nowrap;
}
.topbar nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
/* Logi välja nupp tumedal ribal: hele ääris ja tekst */
.topbar .ghost {
  color: #F4F7F4; border-color: rgba(255,255,255,0.4); background: transparent;
}
.topbar .ghost:hover { background: rgba(255,255,255,0.15); border-color: #fff; }

/* ---- kaardid */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 18px 20px; margin: 14px 0;
}
.flash {
  border-radius: 10px; padding: 10px 14px; margin: 12px 0;
  background: #E3F0E7; border: 1px solid #B9D8C2; font-size: 15px;
}
.flash.error { background: #F8E4E2; border-color: #E5B5B0; }

/* ---- päeva navigatsioon */
.daynav { display: flex; align-items: stretch; gap: 8px; margin-top: 12px; }
.daynav-mid { flex: 1; text-align: center; }
.date-line { font-size: 20px; font-weight: 600; text-transform: uppercase; }
.phase { font-size: 13px; color: var(--ink-soft); }
.tolink { font-size: 13px; }
.daynav .ghost { align-self: center; }

/* ---- päeva kaart, "võistlusnumbri" plokk */
.daycard { padding-top: 14px; }
.bib { display: flex; gap: 14px; align-items: center; }
.bib-wd {
  font-size: 44px; font-weight: 700; line-height: 1;
  min-width: 64px; height: 64px; display: grid; place-items: center;
  border: 3px solid var(--ink); border-radius: 10px;
}
.eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-soft); font-weight: 600; display: flex; gap: 8px;
  align-items: center; flex-wrap: wrap;
}
.tag {
  font-size: 11px; letter-spacing: 0.05em; padding: 1px 8px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--paper);
}
.tag.ok { background: #E3F0E7; border-color: #B9D8C2; color: #26623B; }

/* tüübivärvid: vasak serv + bib-raami toon */
.type-rest .bib-wd, .type-vacation .bib-wd, .type-travel .bib-wd { border-color: var(--z1); color: var(--ink-soft); }
.type-easy .bib-wd, .type-recovery .bib-wd, .type-long_group .bib-wd,
.type-long_day .bib-wd, .type-long_run .bib-wd, .type-cross .bib-wd { border-color: var(--z2); }
.type-marathon_pace .bib-wd, .type-half_marathon_pace .bib-wd { border-color: var(--z3); }
.type-tempo .bib-wd { border-color: var(--z4); }
.type-intervals .bib-wd, .type-hills .bib-wd, .type-test .bib-wd { border-color: var(--z5); }
.type-race .bib-wd { border-color: var(--race); background: var(--race); color: #fff; }
.type-strength_a .bib-wd, .type-strength_b .bib-wd { border-color: var(--strength); }
.daycard.done { outline: 2px solid #B9D8C2; }

/* ---- intensiivsusriba (allkirjaelement) */
.strip {
  display: flex; height: 26px; border-radius: 7px; overflow: hidden;
  margin: 16px 0 4px; background: var(--line);
}
.strip i { display: block; height: 100%; }
.strip .z1 { background: var(--z1); }
.strip .z2 { background: var(--z2); }
.strip .z3 { background: var(--z3); }
.strip .z4 { background: var(--z4); }
.strip .z5 { background: var(--z5); }

.desc { font-size: 15.5px; }

/* ---- sammud */
.steps { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.step { padding: 5px 0 5px 0; font-size: 15px; }
.step.d1 { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 10px; }
.step.d2 { margin-left: 36px; border-left: 2px solid var(--line); padding-left: 10px; }
.step.rep { font-weight: 600; }
.alt { font-size: 14px; color: var(--ink-soft); border-left: 3px solid var(--z1);
       padding-left: 10px; }

/* ---- jõutreeningu harjutused */
.exlist { border-top: 1px solid var(--line); margin-top: 12px; }
.exhead { font-weight: 600; padding: 10px 0 4px; }
.ex { display: flex; justify-content: space-between; gap: 12px;
      padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.ex b { white-space: nowrap; }
.ex.opt { color: var(--ink-soft); }

/* ---- nupud */
button, .btn {
  font: inherit; cursor: pointer; text-decoration: none; display: inline-block;
  border-radius: 9px; padding: 10px 16px; border: 1.5px solid var(--ink);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px;
}
.primary { background: var(--ink); color: #fff; }
.primary:hover { background: #2A3B34; }
.ghost { border-color: var(--line); background: transparent; }
.ghost:hover { background: #E8EDE9; }
.small { padding: 5px 10px; font-size: 13px; }
.wide { width: 100%; }
.inline { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--z2); outline-offset: 2px;
}

/* ---- vormid */
label { display: block; margin: 12px 0; font-weight: 500; font-size: 14px; }
input, select {
  display: block; width: 100%; margin-top: 5px; font: inherit;
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--z2); border-color: var(--z2); }

/* ---- login */
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login-mark { font-size: 34px; font-weight: 700; text-align: center; }
.login-mark span { color: var(--z4); }
.login-sub { text-align: center; color: var(--ink-soft); margin-top: 2px; }

/* ---- nädalavaade */
.weeklist { margin-top: 14px; }
.wrow {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 8px 0; border-left-width: 6px;
}
.wrow.type-rest, .wrow.type-vacation, .wrow.type-travel { border-left-color: var(--z1); background: #F6FAFD; }
.wrow.type-easy, .wrow.type-recovery, .wrow.type-long_group,
.wrow.type-long_day, .wrow.type-long_run, .wrow.type-cross { border-left-color: var(--z2); }
.wrow.type-marathon_pace, .wrow.type-half_marathon_pace { border-left-color: var(--z3); }
.wrow.type-tempo { border-left-color: var(--z4); }
.wrow.type-intervals, .wrow.type-hills, .wrow.type-test { border-left-color: var(--z5); }
.wrow.type-race { border-left-color: var(--race); background: #FDF1E7; }
.wrow.type-strength_a, .wrow.type-strength_b { border-left-color: var(--strength); }
.wrow.today { outline: 2.5px solid var(--ink); }
.wrow.done .wtitle { text-decoration: line-through; color: var(--ink-soft); }
.wrow.opt .wtitle { color: var(--ink-soft); font-style: italic; }
.wrow .wd { font-family: "Barlow Condensed", sans-serif; font-weight: 700;
            font-size: 20px; width: 22px; }
.wrow .wdate { color: var(--ink-soft); font-size: 14px; width: 48px; }
.wrow .wtitle { flex: 1; font-weight: 500; font-size: 15px; }
.wrow .wmark { color: #26623B; font-weight: 700; }

/* ---- tabelid */
.zt { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 8px 0; }
.zt { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.zt th { text-align: left; font-size: 12px; text-transform: uppercase;
         letter-spacing: 0.06em; color: var(--ink-soft); }
.zt td, .zt th { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line);
                 vertical-align: top; }

.underlinks { text-align: center; margin: 18px 0; font-size: 15px; }

@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; }
  .bib-wd { min-width: 54px; height: 54px; font-size: 36px; }
  h1 { font-size: 25px; }
  .actions form, .actions .btn, .actions button { flex: 1 1 45%; text-align: center; }
}
@media (prefers-reduced-motion: no-preference) {
  .strip i { transition: width .4s ease; }
}

/* ---- märkuse kast ja märgi-kõik nupp (lisatud) */
.notebox { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.notebox label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.notebox textarea {
  width: 100%; margin: 6px 0 8px; font: inherit; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 9px; resize: vertical;
  background: #fff;
}
.notebox textarea:focus { outline: 2px solid var(--z2); border-color: var(--z2); }
.markall { text-align: center; margin: 16px 0 0; }

/* ---- kuu kalendrivaade (lisatud) */
.calendar { margin-top: 14px; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 4px; }
.cal-head span { text-align: center; font-size: 12px; font-weight: 600;
  color: var(--ink-soft); text-transform: uppercase; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 4px; }
.cal-cell { min-height: 64px; border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 5px; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  border-left-width: 4px; }
.cal-cell.empty { background: var(--paper); }
.cal-cell.dim { opacity: 0.35; }
.cal-cell.today { outline: 2px solid var(--ink); outline-offset: -1px; }
.cal-num { font-family: "Barlow Condensed", sans-serif; font-weight: 600;
  font-size: 15px; }
.cal-title { font-size: 11px; line-height: 1.15; color: var(--ink-soft); }
.cal-check { font-size: 11px; color: #26623B; font-weight: 700; margin-top: auto; }
.cal-cell.done .cal-title { text-decoration: line-through; }
.cal-cell.opt .cal-title { font-style: italic; }
.cal-cell.type-rest, .cal-cell.type-vacation, .cal-cell.type-travel { border-left-color: var(--z1); }
.cal-cell.type-easy, .cal-cell.type-recovery, .cal-cell.type-long_group,
.cal-cell.type-long_day, .cal-cell.type-long_run, .cal-cell.type-cross { border-left-color: var(--z2); }
.cal-cell.type-marathon_pace, .cal-cell.type-half_marathon_pace { border-left-color: var(--z3); }
.cal-cell.type-tempo { border-left-color: var(--z4); }
.cal-cell.type-intervals, .cal-cell.type-hills, .cal-cell.type-test { border-left-color: var(--z5); }
.cal-cell.type-race { border-left-color: var(--race); background: #FDF1E7; }
.cal-cell.type-strength_a, .cal-cell.type-strength_b { border-left-color: var(--strength); }
@media (max-width: 560px) {
  .cal-cell { min-height: 52px; padding: 3px; border-left-width: 3px; }
  .cal-title { display: none; }
  .cal-num { font-size: 13px; }
}

/* ---- skeemi dokumentatsioon admin-lehel (lisatud) */
.schema-doc { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.schema-doc summary { cursor: pointer; font-weight: 600; font-size: 14px;
  color: var(--z2); padding: 6px 0; }
.schema-doc h3 { font-size: 14px; margin: 16px 0 6px; }
.schema-doc pre { background: #F6F8F6; border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 12.5px;
  line-height: 1.5; }
.schema-doc code { background: #F6F8F6; padding: 1px 5px; border-radius: 4px;
  font-size: 13px; }

/* ---- kuu hüppaja (lisatud) */
.month-jump { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px;
  justify-content: center; }
.month-jump label { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin: 0; }
.month-jump select { width: auto; margin: 0; padding: 8px 12px; font-weight: 600; }

/* ---- admin kustuta/nimeta (lisatud) */
.danger { color: var(--z5); border-color: rgba(208,69,62,0.4); }
.danger:hover { background: #F8E4E2; border-color: var(--z5); }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Kavade kaardid (asendab tabeli — mahub arvutis ja mobiilis) */
.plan-item { border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin: 10px 0; }
.plan-item.active { border-left: 4px solid var(--z3); }
.plan-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
  justify-content: space-between; margin-bottom: 10px; }
.plan-status { font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft); }
.plan-item.active .plan-status { color: var(--z3); }
.plan-meta { font-size: 13px; color: var(--ink-soft); }
.plan-item .rename { display: flex; gap: 8px; margin: 0 0 10px; }
.plan-item .rename input { flex: 1 1 auto; min-width: 0; max-width: 100%;
  margin: 0; padding: 9px 12px; font-size: 15px; }
.plan-item .rename button { flex: 0 0 auto; white-space: nowrap; }
