/* ============================================================================
   HealthOS — Core styles
   Design language: "clinical instrument". Calm near-white surface, a single
   deep teal-ink accent, one warm amber for attention/out-of-band states.
   Numbers are data — set in a mono face like instrument readouts. Humanist
   sans for prose. iOS-first: large tap targets, safe-area aware, no hovers
   relied upon. One signature element: the fasting-window day timeline.
   ============================================================================ */

:root {
    /* Palette (4 core + states) */
    --ink:        #0f2e2e;   /* deep teal-ink: primary text + brand */
    --ink-2:      #3d5a5a;   /* muted teal for secondary text */
    --surface:    #f7f9f8;   /* near-white clinical surface */
    --card:       #ffffff;
    --line:       #e2e9e7;   /* hairline */
    --accent:     #0a8f87;   /* teal accent (actions, in-band) */
    --accent-ink: #066;      /* darker accent for text-on-light */
    --amber:      #c7791b;   /* attention / out-of-band */
    --amber-bg:   #fbf2e4;
    --green-bg:   #e6f4f1;   /* in-band wash */
    --danger:     #b3402f;

    --r:   14px;             /* card radius */
    --r-sm: 10px;

    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --shadow: 0 1px 2px rgba(15,46,46,.04), 0 4px 16px rgba(15,46,46,.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* iOS safe areas */
    padding:
        env(safe-area-inset-top)
        env(safe-area-inset-right)
        env(safe-area-inset-bottom)
        env(safe-area-inset-left);
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.01em; }
a { color: var(--accent-ink); }

/* ---- Layout shell -------------------------------------------------------- */
.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 120px;
}

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: rgba(247,249,248,.86);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    max-width: 720px; margin: 0 auto;
}
.brand {
    font-weight: 700; font-size: 18px; color: var(--ink);
    letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px;
}
.brand .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 4px var(--green-bg);
}
.brand small { font-weight: 500; color: var(--ink-2); font-size: 12px; letter-spacing: 0; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
    font-family: var(--sans); font-size: 15px; font-weight: 600;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    padding: 12px 16px; border-radius: var(--r-sm); cursor: pointer;
    min-height: 46px; -webkit-appearance: none; appearance: none;
    transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost   { background: transparent; }
.btn-block   { width: 100%; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- Cards --------------------------------------------------------------- */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r); box-shadow: var(--shadow);
    padding: 16px; margin: 14px 0;
}

/* ---- Forms --------------------------------------------------------------- */
label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select {
    width: 100%; font-family: var(--sans); font-size: 16px; /* 16px stops iOS zoom */
    padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm);
    background: #fff; color: var(--ink); min-height: 46px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--green-bg); }

/* ---- Numbers / readouts -------------------------------------------------- */
.readout { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- Macro dials (signature data display) -------------------------------- */
.dials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dial {
    text-align: center; padding: 10px 6px; border-radius: var(--r-sm);
    background: var(--surface); border: 1px solid var(--line);
}
.dial .val { font-family: var(--mono); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dial .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-top: 2px; white-space: nowrap; }
.dial.kcal .val { color: var(--ink); }
.dial.p .val { color: var(--accent-ink); }

/* In-band / out-of-band status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.status.ok   { background: var(--green-bg); color: var(--accent-ink); }
.status.warn { background: var(--amber-bg); color: var(--amber); }
.status .tick { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---- Fasting-window timeline (signature element) ------------------------- */
.timeline {
    position: relative; margin: 8px 0 4px; padding: 0;
}
.timeline .track {
    position: relative; height: 8px; border-radius: 999px;
    background: linear-gradient(90deg, var(--line) 0 var(--win-start, 50%),
                                       #bfe4de var(--win-start, 50%) var(--win-end, 83%),
                                       var(--line) var(--win-end, 83%) 100%);
}
.timeline .scale { display: flex; justify-content: space-between; margin-top: 6px; }
.timeline .scale span { font-family: var(--mono); font-size: 10px; color: var(--ink-2); }
.timeline .window-label { font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.timeline .window-label b { color: var(--accent-ink); font-family: var(--mono); }

/* ---- Day card / slots ---------------------------------------------------- */
.daycard { padding: 14px; }
.daycard .day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.daycard .day-head .date { font-weight: 700; font-size: 16px; }
.daycard .day-head .dow { color: var(--ink-2); font-size: 13px; font-weight: 500; }

.slot {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
    margin: 8px 0; background: #fff; cursor: pointer; text-align: left; width: 100%;
    font-family: var(--sans);
}
.slot:active { background: var(--surface); }
.slot .time { font-family: var(--mono); font-size: 12px; color: var(--ink-2); width: 44px; flex: none; }
.slot .meal { flex: 1; min-width: 0; }
.slot .meal .name { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .meal .sub  { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .meal .sub .code { font-family: var(--mono); }
.slot .kc { font-family: var(--mono); font-size: 13px; color: var(--ink); text-align: right; flex: none; white-space: nowrap; }
.slot .kc .p { color: var(--accent-ink); display: block; font-size: 12px; }
.slot.empty { border-style: dashed; color: var(--ink-2); justify-content: center; font-weight: 600; }
.slot.eaten { opacity: .62; }
.slot .badge-cuisine { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }

/* slot kind marker */
.slot .kind { width: 4px; align-self: stretch; border-radius: 4px; background: var(--accent); flex: none; }
.slot[data-slot=breakfast] .kind { background: #e0a83e; }
.slot[data-slot=main]      .kind { background: var(--accent); }
.slot[data-slot=snack]     .kind { background: #7aa6a0; }

/* ---- Week strip ---------------------------------------------------------- */
.weekstrip { display: flex; gap: 5px; overflow-x: auto; padding: 8px 0 10px; -webkit-overflow-scrolling: touch; }
.weekstrip button {
    flex: 1 0 auto; min-width: 44px; padding: 8px 4px; border-radius: var(--r-sm);
    border: 1px solid var(--line); background: #fff; text-align: center; cursor: pointer;
    font-family: var(--sans);
}
.weekstrip button .d { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.weekstrip button .w { font-size: 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.weekstrip button.active { background: var(--ink); border-color: var(--ink); }
.weekstrip button.active .d, .weekstrip button.active .w { color: #fff; }
.weekstrip button .pip { width: 5px; height: 5px; border-radius: 50%; margin: 3px auto 0; background: var(--line); }
.weekstrip button.has-plan .pip { background: var(--accent); }
.weekstrip button.active.has-plan .pip { background: #fff; }

/* ---- Modal / sheet ------------------------------------------------------- */
.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(15,46,46,.34);
    display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet-backdrop.open { display: flex; }
.sheet {
    background: var(--card); width: 100%; max-width: 720px;
    border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
    max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.sheet .grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-size: 18px; }

.cand {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; cursor: pointer;
    background: #fff; width: 100%; text-align: left; font-family: var(--sans);
}
.cand:active { background: var(--surface); }
.cand .meal { flex: 1; min-width: 0; }
.cand .meal .name { display:block; font-weight: 600; font-size: 15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cand .meal .sub { display:block; font-size: 12px; color: var(--ink-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cand .kc { white-space:nowrap; }
.cand .kc { font-family: var(--mono); font-size: 13px; text-align: right; }
.cand .kc .p { color: var(--accent-ink); display: block; font-size: 12px; }

/* recipe detail */
.ingredient-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ingredient-row .g { font-family: var(--mono); color: var(--ink-2); }
.method { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.notes-callout { background: var(--amber-bg); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; color: var(--amber); margin-top: 10px; }

/* suggestions */
.suggestion { background: var(--amber-bg); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; color: var(--amber); margin-top: 8px; }

/* ---- Bottom action bar --------------------------------------------------- */
.actionbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(247,249,248,.92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
}
.actionbar .app-inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; width: 100%; }

/* ---- Misc ---------------------------------------------------------------- */
.muted { color: var(--ink-2); }
.center { text-align: center; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
    position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px;
    font-size: 14px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s;
    max-width: 90%;
}
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================================
   Navigation shell + future-module foresight (added in foundation slice)
   ============================================================================ */

/* Bottom tab bar — persistent across all modules */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; max-width: 720px; margin: 0 auto;
    background: rgba(247,249,248,.94);
    backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 2px 8px; text-decoration: none; color: var(--ink-2);
    font-size: 10.5px; font-weight: 600; letter-spacing: .01em; position: relative;
    -webkit-tap-highlight-color: transparent;
}
.tabbar a svg { width: 24px; height: 24px; display: block; }
.tabbar a.active { color: var(--accent); }
.tabbar a.soon .lbl::after {
    content: ""; position: absolute; top: 7px; right: 50%; margin-right: -16px;
    width: 5px; height: 5px; border-radius: 50%; background: var(--amber);
}
/* When the tab bar is present, content clears it */
body.has-tabbar .app { padding-bottom: 96px; }

/* In-page underline tabs (e.g. Planner | Groceries) */
.tabs-underline { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 2px 0 14px; }
.tabs-underline button, .tabs-underline a {
    border: none; background: none; padding: 10px 0 11px; font-family: var(--sans);
    font-size: 15px; font-weight: 600; color: var(--ink-2); text-decoration: none; display: inline-block;
    border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
}
.tabs-underline button.active, .tabs-underline a.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs-underline button .mini-soon { font-size: 10px; color: var(--amber); margin-left: 6px; vertical-align: 1px; }

/* Goal progress (Today) */
.goal { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.goal .big { font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.goal .big .arrow { color: var(--ink-2); font-weight: 400; margin: 0 4px; }
.goal .meta { text-align: right; font-size: 13px; color: var(--ink-2); }
.goalbar { height: 8px; border-radius: 999px; background: var(--line); margin: 12px 0 4px; overflow: hidden; }
.goalbar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.goal-note { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.goal-note a { font-weight: 600; }

/* Deviation entry (Today) — previews the adaptive engine */
.deviation h3 { font-size: 15px; margin-bottom: 2px; }
.deviation .sub { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip {
    display: flex; align-items: center; gap: 10px; padding: 12px;
    border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff;
    font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left;
}
.chip svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.chip:active { background: var(--surface); }

/* Compact plan glance (Today) */
.glance-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.glance-row:last-child { border-bottom: none; }
.glance-row .t { font-family: var(--mono); font-size: 12px; color: var(--ink-2); width: 42px; flex: none; }
.glance-row .nm { flex: 1; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glance-row .kc { font-family: var(--mono); font-size: 12px; color: var(--ink-2); flex: none; }

/* Coming-soon module preview */
.coming { text-align: center; padding: 30px 18px 10px; }
.coming .ico {
    width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    background: var(--green-bg); color: var(--accent);
}
.coming .ico svg { width: 34px; height: 34px; }
.chip-soon {
    display: inline-block; background: var(--amber-bg); color: var(--amber);
    font-size: 11px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
    letter-spacing: .06em; text-transform: uppercase; margin-bottom: 16px;
}
.coming h2 { font-size: 22px; }
.coming > p { color: var(--ink-2); max-width: 34ch; margin: 6px auto 0; }
.feature-list { text-align: left; max-width: 360px; margin: 24px auto 0; }
.feature-list .f { display: flex; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.feature-list .f:last-child { border-bottom: none; }
.feature-list .f svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 2px; }
.feature-list .f .ft { font-size: 14px; }
.feature-list .f .ft b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.feature-list .f .ft span { color: var(--ink-2); font-size: 13px; }

/* Section heading */
.section-h { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 18px 2px 8px; }

/* ============================================================================
   TRAIN module — exercise library, detail (OtterLife-depth), session
   ============================================================================ */

/* Exercise list card (session / library) */
.ex-card { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; margin: 8px 0; width: 100%; text-align: left; font-family: var(--sans); cursor: pointer; }
.ex-card:active { background: var(--surface); }
.ex-thumb { width: 60px; height: 60px; border-radius: 9px; background: var(--surface); object-fit: cover; flex: none; border: 1px solid var(--line); }
.ex-card .body { flex: 1; min-width: 0; }
.ex-card .name { display:block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-card .tags { display:block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ex-card .rx { display:block; font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); margin-top: 3px; }
.ex-card .idx { font-family: var(--mono); font-size: 12px; color: var(--ink-2); width: 18px; flex: none; text-align: center; }
.ex-card .bw { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; display: inline-block; margin-top: 4px; }

/* Exercise detail hero */
.ex-hero { width: 100%; height: 200px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.ex-head { margin: 14px 2px 2px; }
.ex-head h1 { font-size: 22px; margin: 0; }
.ex-head .meta { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.ex-head .meta .dot-sep { margin: 0 6px; }

/* Pills (muscles / equipment / patterns) */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.pill { font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.pill.primary { background: var(--green-bg); border-color: var(--green-bg); color: var(--accent-ink); }

/* Labelled blocks in tab content */
.block { margin: 14px 0; }
.block .lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-bottom: 6px; }
.block p { margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.55; }
.block.good .lbl { color: var(--accent-ink); }
.block.avoid .lbl { color: var(--amber); }

/* Numbered execution steps */
.steps { counter-reset: s; margin: 6px 0 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding: 9px 0 9px 36px; border-bottom: 1px solid var(--line); font-size: 14.5px; line-height: 1.5; }
.steps li:last-child { border-bottom: none; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--green-bg); color: var(--accent-ink); font-family: var(--mono); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* Prescription strip on detail */
.rx-strip { display: flex; gap: 8px; margin: 10px 0 2px; }
.rx-strip .cell { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 4px; }
.rx-strip .cell .v { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.rx-strip .cell .k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-top: 2px; }

/* Joint-load meter */
.joint { margin: 10px 0; }
.joint .row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.joint .row .nm { width: 110px; flex: none; font-size: 13px; font-weight: 600; }
.joint .bar { flex: 1; height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; position: relative; }
.joint .bar > i { display: block; height: 100%; border-radius: 999px; }
.joint .lv { font-size: 11px; font-weight: 700; width: 64px; flex: none; text-align: right; text-transform: uppercase; letter-spacing: .03em; }
.lv-low > i { width: 33%; background: var(--accent); } .lv-low ~ .lv, .lv-low.lv { color: var(--accent-ink); }
.lv-mod > i { width: 64%; background: #d8a23a; }
.lv-high > i { width: 92%; background: var(--danger); }

/* Variant rows */
.variant { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; background: #fff; }
.variant .tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; flex: none; }
.variant .tag.gym { background: var(--green-bg); color: var(--accent-ink); }
.variant .tag.home { background: #eef3f1; color: var(--ink-2); }
.variant .nm { font-size: 14px; font-weight: 600; }
.variant .nm small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12px; }

/* Train: image placeholders, icon buttons, meta strip, weekly schedule */
.ex-thumb.ph, .ex-hero.ph { display: flex; align-items: center; justify-content: center; color: var(--line-strong, #c2cecb); background: var(--surface); }
.ex-thumb.ph svg { width: 26px; height: 26px; }
.ex-hero.ph { height: 200px; }
.ex-hero.ph svg { width: 54px; height: 54px; }

.icon-btn { min-height: 38px; min-width: 38px; padding: 8px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; }

.meta-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13px; color: var(--ink-2); margin: 8px 2px 2px; }

.day-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; background: #fff; border-left-width: 3px; }
.day-row .dow { font-family: var(--mono); font-size: 12px; font-weight: 700; width: 34px; flex: none; color: var(--ink-2); }
.day-row .dico { width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface); }
.day-row .dico svg { width: 17px; height: 17px; }
.day-row .body { flex: 1; min-width: 0; }
.day-row .body .t { display: block; font-weight: 600; font-size: 14.5px; }
.day-row .body .s { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.day-row.lift   { border-left-color: var(--accent); }
.day-row.lift   .dico { background: var(--green-bg); color: var(--accent-ink); }
.day-row.cardio { border-left-color: #5a9bd4; }
.day-row.cardio .dico { color: #2f6fab; }
.day-row.sport  { border-left-color: var(--amber); }
.day-row.sport  .dico { color: var(--amber); }
.day-row.rest   { border-left-color: var(--line-strong, #d7e0dd); }
.day-row.rest   .dico { color: var(--ink-2); }

/* ===== Train: guided runner ===== */
.run-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
    padding: calc(env(safe-area-inset-top) + 8px) 14px 8px; background: rgba(247,249,248,.92);
    backdrop-filter: saturate(180%) blur(8px); -webkit-backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line); }
.run-head .icon-btn { font-size: 26px; line-height: 1; color: var(--ink-2); text-decoration: none; }
.run-head .rh-mid { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.run-head .rh-mid b { font-size: 15px; }
.run-head .rh-mid .readout { font-size: 13px; color: var(--ink-2); font-family: var(--mono); }

.run-main { padding-top: 14px; }
.run-ex { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 12px 0; box-shadow: var(--shadow); }
.run-ex-head { display: flex; gap: 12px; align-items: center; }
.run-ex-head .ex-thumb { width: 46px; height: 46px; border-radius: 10px; flex: none; }
.run-ex-head .t { min-width: 0; }
.run-ex-head .nm { font-weight: 600; font-size: 16px; color: var(--ink); text-decoration: none; display: block; }
.run-ex-head .tg { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.warmup-note { font-size: 12.5px; color: var(--ink-2); margin: 10px 0 0; }

.set-grid { margin-top: 12px; }
.set-h, .set-row { display: grid; grid-template-columns: 30px 64px 1fr 1fr 46px; gap: 8px; align-items: center; }
.set-grid.time .set-h, .set-grid.time .set-row { grid-template-columns: 30px 64px 1fr 46px; }
.set-h { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 0 2px 7px; }
.set-h span { text-align: center; }
.set-h span:first-child, .set-h span:nth-child(2) { text-align: left; }
.set-row { padding: 5px 0; }
.set-row .sn { font-family: var(--mono); font-weight: 700; color: var(--ink-2); text-align: center; }
.set-row .prev { font-size: 12.5px; color: var(--ink-2); font-family: var(--mono); }
.set-row input { width: 100%; text-align: center; font-family: var(--mono); font-size: 15px; padding: 9px 4px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); -moz-appearance: textfield; }
.set-row input::-webkit-outer-spin-button, .set-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-row input:focus { outline: none; border-color: var(--accent); }
.set-row .tick { display: flex; align-items: center; justify-content: center; min-height: 40px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink-2); cursor: pointer; }
.set-row .tick svg { width: 18px; height: 18px; }
.set-row.done input { border-color: transparent; background: var(--green-bg); font-weight: 600; }
.set-row.done .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.set-row.done .prev { color: var(--accent-ink); }

.add-set { margin-top: 10px; font-size: 14px; padding: 8px 12px; min-height: auto; display: inline-flex; align-items: center; gap: 6px; }
.add-set svg { width: 16px; height: 16px; }

.prog-hint { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 13px;
    color: var(--accent-ink); background: var(--green-bg); border-radius: 10px; padding: 9px 11px; }
.prog-hint svg { width: 16px; height: 16px; flex: none; }

#rest-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
    padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); background: var(--ink); color: #fff; }
#rest-bar .rb-label { font-size: 14px; opacity: .85; }
#rest-bar #rest-time { font-family: var(--mono); font-size: 20px; font-weight: 700; flex: 1; }
#rest-bar .btn { color: #fff; border-color: rgba(255,255,255,.32); background: transparent; min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* ===== Train: session summary ===== */
.summary-hero { text-align: center; padding: 24px 0 6px; }
.summary-hero .ico { width: 56px; height: 56px; border-radius: 50%; background: var(--green-bg); color: var(--accent);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.summary-hero .ico svg { width: 28px; height: 28px; }
.summary-hero h1 { font-size: 24px; margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat .v { font-size: 20px; font-weight: 700; }
.stat .k { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; margin-top: 3px; }
.log-line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.log-line .nm { font-weight: 600; font-size: 14.5px; }
.log-line .sets { font-family: var(--mono); font-size: 13px; color: var(--ink-2); text-align: right; }
