/* Pilates Armour — mobile-first. Deep spruce + porcelain, one warm brass accent for "your" items. */
:root {
  --bg: #f2f4f3; --surface: #ffffff; --ink: #14201f; --muted: #5d6b69; --line: #dde3e1;
  --brand: #16302f; --brand-ink: #f2f4f3; --accent: #2f6f68; --accent-soft: #e1eeec;
  --brass: #a07a3c; --brass-soft: #f4ecdf;
  --ok: #2e7d4f; --warn: #a4650b; --bad: #b03a3a;
  --r: 12px;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Fraunces", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1615; --surface: #172221; --ink: #e6efed; --muted: #94a5a2; --line: #283634;
    --brand: #0b1514; --brand-ink: #e6efed; --accent: #6cc0b6; --accent-soft: #1b3431;
    --brass: #d8b073; --brass-soft: #3a2f1f; --ok: #6fcf97; --warn: #e2a64a; --bad: #ef7d7d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.45; }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 760px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.top {
  background: var(--brand); color: var(--brand-ink);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { flex: none; }
.brand b { font-family: var(--f-display); font-size: 20px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.brand small { display: block; font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who { font-size: 13px; opacity: .85; text-align: right; }

.view { flex: 1; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 110px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 6px) max(8px, env(safe-area-inset-left, 0px));
}
.tabs-inner { display: flex; width: 100%; max-width: 760px; }
.tabs button { flex: 1; background: none; border: 0; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--accent); }
.tabs .badge { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--bad); color: #fff; font-size: 10px; border-radius: 9px; padding: 0 5px; min-width: 16px; line-height: 16px; }

h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-family: var(--f-display); font-weight: 600; font-size: 26px; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }

.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--accent); color: #fff; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.quiet { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.sm { padding: 6px 11px; font-size: 13.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.wa { background: #1fa855; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.bellbtn { background: none; border: 0; color: inherit; position: relative; cursor: pointer; padding: 4px; }
.bellbtn i { position: absolute; top: 0; right: -2px; background: var(--bad); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; }
.due-group { display: flex; flex-direction: column; gap: 8px; }
.due-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.due-row:last-child { border-bottom: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { background: var(--accent); color: #08110f; border-color: var(--accent); } }

.dates { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.dates::-webkit-scrollbar { display: none; }
.date { flex: none; width: 54px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 7px 0; text-align: center; cursor: pointer; }
.date span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.date b { font-size: 19px; font-variant-numeric: tabular-nums; }
.date[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.date[aria-pressed="true"] span { color: inherit; opacity: .85; }

.cls { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; }
.cls .time b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cls .time span { font-size: 12px; color: var(--muted); }
.cls .info { min-width: 0; }
.cls .info h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.mine { border-color: var(--brass); background: linear-gradient(0deg, var(--brass-soft), var(--brass-soft)) padding-box; }
.cls.off { opacity: .55; }
.spots { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.spots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--accent); }
.spots i.full { background: var(--accent); }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.pill.info { color: var(--accent); background: var(--accent-soft); }
.pill.brass { color: var(--brass); background: var(--brass-soft); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats .stat:first-child { grid-column: span 2; }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); } .stats .stat:first-child { grid-column: auto; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; text-align: left; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.alert b { color: var(--bad); }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { overflow-wrap: anywhere; }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; max-width: 100%; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--f-body); font-variant-numeric: tabular-nums; }
.chart .bar { cursor: pointer; }
.chart .bar.on path { opacity: 1; }
.chart .tip { position: absolute; top: 0; width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; line-height: 1.4; box-shadow: 0 6px 18px rgba(0,0,0,.12); pointer-events: none; }

.plan-card { background: var(--brand); color: var(--brand-ink); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.plan-card .big { font-family: var(--f-display); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--brand-ink) 20%, transparent); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brass); }

.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 8px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.person { display: flex; gap: 12px; align-items: flex-start; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.note { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.note .meta { font-size: 12px; color: var(--muted); }
.timeline { display: flex; flex-direction: column; gap: 8px; }

form.stack label, .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; font-weight: 500; }
textarea { min-height: 80px; resize: vertical; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { flex-direction: row; align-items: center; gap: 4px; background: var(--bg); border-radius: 8px; padding: 6px 9px; font-weight: 600; color: var(--ink); }
.days input { width: auto; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(8, 14, 13, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; animation: up .18s ease-out; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet .x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); z-index: 30;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); color: #fff; }

.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 32px max(20px, env(safe-area-inset-right, 0px)) 32px max(20px, env(safe-area-inset-left, 0px)); max-width: 420px; margin: 0 auto; }
.login .mark { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login .mark b { font-family: var(--f-display); font-size: 32px; font-weight: 600; }
.devotp { background: var(--brass-soft); color: var(--brass); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 600; }
.phone { display: flex; align-items: stretch; }
.phone span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: var(--bg); font-weight: 700; }
.phone input { border-radius: 0 10px 10px 0; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple td, table.simple th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll-x { overflow-x: auto; }
table.simple .num, table.simple th { white-space: nowrap; }
