/* CRM: темна тепла тема з помаранчевим акцентом. */
:root {
  color-scheme: dark;
  --bg: #1f1e1d; --surface: #2a2927; --surface-2: #33322f; --text: #f5f4ef; --muted: #a8a59c; --line: #3b3a36;
  --accent: #d97757; --accent-hover: #e68a6b; --accent-text: #1f1e1d; --accent-soft: rgba(217,119,87,.14);
  --warn-bg: rgba(232,178,77,.14); --warn: #ebbd68; --danger-bg: rgba(229,105,90,.15); --danger: #f08a7c;
  --ok-bg: rgba(110,190,150,.14); --ok: #8dd0ae; --new-bg: rgba(217,119,87,.16); --new: #f0a184;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.18);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1 { font-family: ui-serif, Georgia, "Times New Roman", serif; font-weight: 500; font-size: 28px; letter-spacing: -.01em; margin: 8px 0 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
h2 { font-size: 17px; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
small, .muted { color: var(--muted); }

.bar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: rgba(31,30,29,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar .brand { font-family: ui-serif, Georgia, serif; font-size: 18px; color: var(--text); }
.bar .brand::before { content: "✳"; color: var(--accent); margin-right: 6px; }
.bar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.bar nav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.bar nav a:hover { color: var(--text); }
.bar nav a.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.cols > .panel { margin-bottom: 0; }
.cols + .panel, .cols + form.panel { margin-top: 16px; }
.head-row { display: flex; justify-content: space-between; align-items: center; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.panel .stat { background: var(--surface-2); border-color: transparent; }
.stat b { display: block; font-family: ui-serif, Georgia, serif; font-weight: 500; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }

.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.funnel .step { color: var(--text); background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 12px; text-align: center; transition: border-color .15s; }
.funnel .step:hover { border-color: var(--accent); color: var(--text); }
.funnel b { display: block; font-family: ui-serif, Georgia, serif; font-weight: 500; font-size: 24px; }
.funnel span { font-size: 13px; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.list li:last-child { border-bottom: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
table.rows tbody tr { cursor: pointer; }
table.rows tbody tr:hover { background: var(--surface-2); }
table.kv th { width: 38%; text-transform: none; font-size: 14px; letter-spacing: 0; }
.actions form { display: flex; gap: 4px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.new, .badge.st-new { background: var(--new-bg); color: var(--new); }
.badge.st-paid, .badge.ss-done { background: var(--ok-bg); color: var(--ok); }
.badge.st-lost, .badge.ss-burned { background: var(--danger-bg); color: var(--danger); }
.badge.st-consultation, .badge.st-contacted { background: var(--warn-bg); color: var(--warn); }

form.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 8px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 12px 0; }
.grid .full { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; }
label > span { font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
input::placeholder, textarea::placeholder { color: #6f6d66; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.check { display: flex; gap: 8px; align-items: flex-start; }
label.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
label.check span { color: var(--text); font-weight: 400; font-size: 14px; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }

button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 9px 16px; transition: background .15s; background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--accent-hover); color: var(--accent-text); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { background: var(--surface-2); color: var(--text); }
button.small { padding: 4px 10px; font-size: 13px; }
button.wide { width: 100%; padding: 12px; }

.flash { background: var(--accent-soft); color: var(--new); border: 1px solid rgba(217,119,87,.3); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.login-box h1::before { content: "✳"; color: var(--accent); margin-right: 8px; font-family: system-ui; }
.login-box form { display: grid; gap: 12px; }
.login-box .err { color: var(--danger); font-weight: 600; }
.code { font-size: 28px; letter-spacing: .4em; text-align: center; }

@media (max-width: 640px) {
  .funnel { grid-template-columns: repeat(3, 1fr); }
  table.rows thead { display: none; }
  table.rows tr { display: grid; grid-template-columns: 1fr 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.rows td { border: 0; padding: 2px 6px; }
}

/* Конструктор тренування */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.small-note { font-size: 13px; }
.warn-panel { border-color: rgba(232,178,77,.35); }
.warn-panel p { margin: 4px 0; }
.items { display: grid; gap: 10px; margin: 14px 0; }
.item { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.item-head .num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
.item-head b { font-size: 16px; }
.item-form { display: grid; gap: 8px; grid-template-columns: repeat(6, minmax(76px, 1fr)); }
.item-form .wide { grid-column: span 3; }
.item-form .item-actions { grid-column: span 6; display: flex; gap: 6px; flex-wrap: wrap; }
.item-form input { padding: 7px 9px; background: var(--bg); }
.add-item { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; border-top: 1px solid var(--line); padding-top: 14px; }
.add-item label { width: 110px; }
.add-item label.grow { flex: 1; min-width: 240px; width: auto; }
.chip { display: inline-block; background: var(--surface-2); border-radius: 999px; padding: 3px 10px; margin: 2px; font-size: 13px; }
.chip.pr { background: var(--accent-soft); color: var(--new); }
.chip.pain { box-shadow: inset 0 0 0 1px var(--danger); }
@media (max-width: 640px) {
  .item-form { grid-template-columns: repeat(2, 1fr); }
  .item-form .wide, .item-form .item-actions { grid-column: span 2; }
}
.item.in-group { border-left: 3px solid var(--accent); }
.item.in-group + .item.in-group { margin-top: -6px; }

/* Календар */
:root { --k-training: #d97757; --k-diagnostic: #c9a4f0; --k-consultation: #6fb3e8; --k-contact: #ebbd68; }
.ghost-btn { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 7px 14px; }
.ghost-btn:hover { background: var(--surface-2); color: var(--text); }
.cal-head h1 small { font-family: system-ui; font-size: 15px; color: var(--muted); }
.cal-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.fchip { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.fchip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--k); opacity: .4; }
.fchip.on { color: var(--text); background: var(--surface); border-color: var(--k); }
.fchip.on::before { opacity: 1; }
.fchip small { color: var(--muted); }
.k-training { --k: var(--k-training); } .k-diagnostic { --k: var(--k-diagnostic); }
.k-consultation { --k: var(--k-consultation); } .k-contact { --k: var(--k-contact); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-day.past { opacity: .72; }
.cal-dh { font-size: 13px; color: var(--muted); padding: 2px 4px 4px; }
.cal-dh b { color: var(--text); }
.cal-empty { color: var(--line); text-align: center; padding-top: 20px; }
.ev { display: grid; gap: 1px; padding: 7px 8px; border-radius: 9px; background: var(--surface-2); border-left: 3px solid var(--k); color: var(--text); font-size: 13px; line-height: 1.3; }
.ev:hover { background: var(--line); color: var(--text); }
.ev.done { opacity: .6; }
.ev-t { font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-t small { font-weight: 400; color: var(--muted); }
.ev-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-s { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .cal-grid { grid-template-columns: 1fr; }
  .cal-day { min-height: 0; }
  .cal-day.past { display: none; }
  .cal-empty { padding: 0; text-align: left; }
}

/* Навігація: іконки */
.bar nav a i { font-style: normal; margin-right: 5px; opacity: .7; }

/* Телефон */
@media (max-width: 640px) {
  body { font-size: 15px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .wrap { padding: 12px 10px; }
  h1 { font-size: 22px; margin: 4px 0 12px; }
  h2 { font-size: 16px; }
  .bar { padding: 8px 12px; gap: 8px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .bar nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    background: rgba(31,30,29,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bar nav a { display: grid; justify-items: center; gap: 1px; font-size: 11px; padding: 6px 2px; border-radius: 10px; }
  .bar nav a i { margin: 0; font-size: 18px; opacity: .8; }
  .bar nav a.on { background: var(--surface-2); color: var(--accent); }
  .bar nav a.on i { opacity: 1; }
  .bar form { margin-left: auto; }
  .panel { padding: 14px; border-radius: 14px; margin-bottom: 12px; }
  .cols { grid-template-columns: 1fr; gap: 12px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 21px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid label:has(textarea), .grid .full { grid-column: 1 / -1; }
  input, select, textarea { font-size: 16px; padding: 10px 12px; }   /* без автозуму на iPhone */
  button, .btn { padding: 11px 16px; }
  button.small { padding: 7px 12px; font-size: 14px; }
  form.filters > label { flex: 1 1 45%; }
  form.filters > button { flex: 1 1 100%; }
  /* таблиці → картки */
  .panel table:not(.kv), .panel table:not(.kv) tbody, .panel table:not(.kv) tr, .panel table:not(.kv) td { display: block; width: 100%; }
  .panel table:not(.kv) thead { display: none; }
  .panel table:not(.kv) tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .panel table:not(.kv) td { border: 0; padding: 2px 0; }
  .panel table:not(.kv) td.actions form { margin-top: 6px; }
  table.kv th { width: 40%; }
  .funnel { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .funnel .step { padding: 8px 2px; }
  .funnel b { font-size: 18px; }
  .funnel span { font-size: 10px; }
  .item-form { grid-template-columns: repeat(3, 1fr); }
  .item-form .wide, .item-form .item-actions { grid-column: 1 / -1; }
  .add-item label { width: calc(33% - 6px); }
  .add-item label.grow { width: 100%; }
  .add-item button { width: 100%; }
  .head-row { gap: 8px; flex-wrap: wrap; }
  .cal-head .btn-row { width: 100%; }
  .cal-head .btn-row .btn { flex: 1; text-align: center; }
}

/* Календар v2: смуга тижня + розклад дня */
.cal-top { display: grid; gap: 10px; margin-bottom: 14px; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wn-title { display: grid; justify-items: center; }
.wn-title b { font-size: 17px; font-variant-numeric: tabular-nums; }
.wn-title a { font-size: 12px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-strip .wd { display: grid; justify-items: center; gap: 3px; padding: 8px 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--text); }
.week-strip .wd:hover { border-color: var(--accent); color: var(--text); }
.week-strip .wd b { font-size: 12px; color: var(--muted); }
.week-strip .wd span { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-strip .wd small { font-size: 11px; color: var(--muted); }
.week-strip .wd.today { border-color: var(--accent); }
.week-strip .wd.on { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.week-strip .wd.on b, .week-strip .wd.on small { color: var(--accent-text); }
.week-strip .wd.past:not(.on) { opacity: .55; }
.dots-row { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; min-height: 7px; max-width: 48px; font-style: normal; }
.dt { width: 7px; height: 7px; border-radius: 50%; background: var(--k); display: inline-block; }
.week-strip .wd.on .dt { box-shadow: 0 0 0 1.5px var(--accent-text); }
.cal-filters .fchip { padding: 4px 10px; font-size: 13px; }
.cal-main { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.cal-main > .panel, .cal-side > .panel { margin-bottom: 16px; }
.ag-list { display: grid; gap: 6px; }
.ag-ev, .ag-gap { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; color: var(--text); }
.ag-ev { background: var(--surface-2); border-left: 4px solid var(--k); }
.ag-ev:hover { background: var(--line); color: var(--text); }
.ag-ev.done { opacity: .6; }
.ag-gap { border: 1px dashed var(--line); color: var(--muted); }
.ag-gap.fits { border-color: rgba(217,119,87,.45); color: var(--text); }
.ag-gap:hover { background: var(--accent-soft); color: var(--text); }
.ag-gap small { color: var(--accent); display: block; font-size: 12px; }
.ag-t { font-weight: 700; font-variant-numeric: tabular-nums; display: grid; line-height: 1.2; }
.ag-t small { font-weight: 400; color: var(--muted); font-size: 12px; }
.ag-b { display: grid; gap: 2px; min-width: 0; }
.ag-b b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-b small { color: var(--muted); font-size: 12px; }
.wide-btn { width: 100%; }
a.cal-dh { color: var(--muted); }
input[type="time"], input[type="date"], input[type="datetime-local"] { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; }
@media (max-width: 900px) {
  .cal-main { grid-template-columns: 1fr; gap: 0; }
  .week-full { display: none; }
}
@media (max-width: 640px) {
  .week-strip { gap: 4px; }
  .week-strip .wd { padding: 6px 1px; border-radius: 12px; }
  .week-strip .wd span { font-size: 17px; }
  .week-strip .wd small { font-size: 10px; }
  .dt { width: 6px; height: 6px; }
  .ag-ev, .ag-gap { grid-template-columns: 62px 1fr; padding: 9px 10px; }
}
.bar nav a { display: inline-flex; align-items: center; gap: 6px; }
.bar nav a i { display: inline-flex; margin: 0; opacity: .75; }
.bar nav a i svg { width: 17px; height: 17px; }
@media (max-width: 640px) {
  .bar nav a { display: grid; }
  .bar nav a i svg { width: 21px; height: 21px; }
}

/* Сітка годин дня (як у Google Календарі) */
.view-switch { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.view-switch a { padding: 5px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.view-switch a.on { background: var(--surface); color: var(--text); font-weight: 600; }
.allday { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ad-chip { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--k); color: var(--text); font-size: 13px; }
.tg { position: relative; padding-left: 52px; }
.tg-row { position: relative; height: var(--hh); border-top: 1px solid var(--line); display: grid; grid-template-rows: 1fr 1fr; }
.tg-row:last-of-type { border-bottom: 1px solid var(--line); }
.tg-h { position: absolute; left: -52px; top: -9px; width: 44px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tg-slot { display: block; }
.tg-slot.half { border-top: 1px dashed rgba(255,255,255,.04); }
.tg-slot:hover { background: var(--accent-soft); }
.tg-slot:hover::after { content: "+ записати"; font-size: 11px; color: var(--accent); padding-left: 8px; line-height: calc(var(--hh) / 2); }
.tg-layer { position: absolute; top: 0; left: 52px; right: 0; bottom: 0; pointer-events: none; }
.tg-ev, .tg-buf, .tg-now { pointer-events: auto; position: absolute; }
.tg-ev { box-sizing: border-box; display: grid; align-content: start; gap: 1px; padding: 5px 8px; border-radius: 8px; background: color-mix(in srgb, var(--k) 26%, var(--surface-2)); border-left: 4px solid var(--k); color: var(--text); overflow: hidden; z-index: 2; }
.tg-ev:hover { background: color-mix(in srgb, var(--k) 38%, var(--surface-2)); color: var(--text); }
.tg-ev b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-ev small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-ev.short { grid-auto-flow: column; justify-content: start; gap: 8px; align-items: center; padding-top: 2px; }
.tg-ev.done { opacity: .55; }
.tg-buf { box-sizing: border-box; pointer-events: none; border-radius: 0 0 8px 8px; z-index: 1;
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.05) 6px 12px); border-left: 4px solid color-mix(in srgb, var(--k) 40%, transparent); }
.tg-buf span { font-size: 10px; color: var(--muted); padding-left: 8px; }
.tg-now { left: -6px; right: 0; height: 0; border-top: 2px solid #ff5f57; z-index: 3; pointer-events: none; }
.tg-now i { position: absolute; left: 0; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
@media (max-width: 640px) {
  .tg { padding-left: 44px; }
  .tg-h { left: -44px; width: 38px; font-size: 11px; }
  .tg-layer { left: 44px; }
}
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 17px; letter-spacing: .03em; }

/* Харчування */
.meals { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.meal { margin: 0; background: var(--surface-2); border-radius: 12px; overflow: hidden; display: grid; }
.meal img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.meal-text { aspect-ratio: 1; display: grid; place-items: center; font-size: 28px; }
.meal figcaption { padding: 6px 8px; font-size: 12px; color: var(--muted); }
.meal figcaption b { color: var(--text); margin-right: 4px; }
.color-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.cp { display: block; }
.cp input { position: absolute; opacity: 0; pointer-events: none; }
.cp span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 14px; }
.cp input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sent-text { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; margin: 0; }
.nd-card h2 a { color: var(--text); }
@media (max-width: 640px) {
  .meals { grid-template-columns: repeat(3, 1fr); }
  .bar nav a { font-size: 10px; }
}

/* Реклама */
.quick-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ads-t { min-width: 760px; }
.ads-t td, .ads-t th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.utm { display: grid; gap: 4px; margin-bottom: 12px; }
.utm input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 7px 9px; }
@media (max-width: 640px) {
  /* усі пункти видно, меню гортається вбік */
  .panel table.ads-t, .panel table.ads-t tbody, .panel table.ads-t tr, .panel table.ads-t td { display: revert; width: auto; }
  .panel table.ads-t thead { display: table-header-group; }
  .panel table.ads-t tr { display: table-row; padding: 0; }
  .panel table.ads-t td { display: table-cell; padding: 8px 6px; border-bottom: 1px solid var(--line); }
}
.capi-test input { flex: 1; min-width: 220px; }
.ai-form { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 260px; }
.ai-form input { flex: 1; min-width: 180px; }
.ai-note { display: block; margin-top: 3px; color: var(--new); font-size: 11px; }

/* Автозбереження в конструкторі */
.save-state { align-self: center; }
.save-state.ok { color: var(--ok); }
.save-state.err { color: var(--danger); }
.danger-zone summary { color: var(--danger); cursor: pointer; }
button.danger { background: var(--danger); color: #fff; border-color: transparent; }

/* Нижнє меню на телефоні: гортається вліво-вправо, якщо пунктів більше, ніж влазить */
@media (max-width: 640px) {
  .bar nav {
    display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .bar nav.at-end { -webkit-mask-image: none; mask-image: none; }
  .bar nav::-webkit-scrollbar { display: none; }
  .bar nav a { flex: 0 0 21%; scroll-snap-align: start; }
}

/* Зайнятий час з Google Календаря */
:root { --k-google: #8a8f98; }
.k-google { --k: var(--k-google); }

/* Картка клієнта: вкладки */
.ctabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; position: sticky; top: 56px; z-index: 4; }
.ctabs::-webkit-scrollbar { display: none; }
.ctabs a { flex: 1 0 auto; text-align: center; padding: 8px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.ctabs a.on { background: var(--surface-2); color: var(--accent); }
[data-pane][hidden] { display: none !important; }

/* Компактний список занять */
.sched { margin: 6px 0 12px; }
.sched > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }
.sess-list { display: grid; gap: 6px; }
.sess { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sess > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; }
.sess > summary::-webkit-details-marker { display: none; }
.sess-when { font-variant-numeric: tabular-nums; }
.sess-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sess .actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.sess .actions form { display: flex; flex-wrap: wrap; gap: 6px; }
.sess.s-cancelled { opacity: .55; }

/* Історія тренувань */
.seg-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.seg-tabs a { padding: 7px 14px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; }
.seg-tabs a.on { background: var(--surface-2); color: var(--accent); }
.prog-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table.prog { border-collapse: separate; border-spacing: 0; min-width: 100%; }
table.prog th, table.prog td { white-space: nowrap; padding: 8px 10px; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
table.prog thead th { font-size: 13px; color: var(--muted); }
table.prog thead th small { display: block; font-weight: 400; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
table.prog th.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; max-width: 170px; white-space: normal; }
table.prog th.sticky small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
table.prog td.up { color: var(--ok); font-weight: 600; }
table.prog td.down { color: var(--muted); }
table.prog td.empty { color: var(--line); text-align: center; }
table.prog.cmp td { white-space: normal; vertical-align: top; min-width: 150px; }
table.prog.cmp td small { display: block; }
table.prog tr.total th, table.prog tr.total td { border-top: 2px solid var(--line); font-weight: 700; }
table.prog.cmp td .chip { margin: 0 4px 4px 0; display: inline-block; }
.hist-card { padding: 12px 14px; }
.hist-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.hist-head a { margin-left: auto; }
table.hist-sets td { padding: 5px 6px; }
.cmp-bar { position: sticky; top: 60px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--accent-soft); border: 1px solid rgba(217,119,87,.35); padding: 8px 12px; border-radius: 12px; margin-bottom: 10px; }
.copy-form { display: flex; gap: 6px; align-items: center; }
.copy-form select { max-width: 220px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 3px 9px; font-size: 13px; }
.chip.pr { background: var(--accent-soft); }
.chip.pain { box-shadow: inset 0 0 0 1px var(--danger); }
@media (max-width: 640px) {
  .ctabs { top: 52px; }
  table.prog th.sticky { max-width: 120px; font-size: 13px; }
  .hist-sets td.muted { display: none; }
}
.cmp-bar[hidden] { display: none; }
table.prog tbody th.sticky { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 600; }
.ton-up { color: var(--ok); font-weight: 600; }
.nowrap { white-space: nowrap; }

/* Аналітика сайту: горизонтальні смуги */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr minmax(90px, auto); gap: 10px; align-items: center; font-size: 14px; }
.bar-label { color: var(--text); }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.view-switch.chips { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
/* таблиці з прокруткою всередині колонок не розпирають сторінку на телефоні */
.cols > * { min-width: 0; }
