/* Графит и золото: тёмные экраны, светлые плитки с монохромными силуэтами, золотой акцент */
:root {
  --bg: #2b2b2d;
  --surface: #38383b;
  --surface-2: #434346;
  --line: rgba(255, 255, 255, .07);
  --text: #f6f6f4;
  --muted: #8f8f94;
  --gold: #d5ad63;
  --gold-2: #e3c27f;
  --gold-ink: #2b2b2d;
  --tile-a: #dcdcdb;
  --tile-b: #b8b8b7;
  --danger: #ef6b6b;
  --r-card: 28px;
  --r-tile: 22px;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 400 15px/1.4 "Poppins", -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app { max-width: 520px; margin: 0 auto; padding: 8px 20px calc(var(--nav-h) + var(--safe-b) + 36px); }
.tab { display: none; animation: rise .28s ease; }
.tab.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Заголовки */
.top { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 2px 18px; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 14px; font-weight: 500; }
h1 { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 700; letter-spacing: -.5px; }
h2 { margin: 0; font-size: 20px; font-weight: 600; }
h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.gold { color: var(--gold); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 26px 2px 12px; }
.link { color: var(--muted); font-size: 14px; font-weight: 500; }

/* Герой-карточка недели */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-card); padding: 22px 22px 18px;
  background: radial-gradient(120% 90% at 100% 0%, #4a4a4e 0%, #333336 55%, #2f2f31 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}
.hero .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.hero .num { font-size: 64px; font-weight: 700; line-height: 1; color: var(--gold); margin: 6px 0 0; letter-spacing: -2px; }
.hero .unit { font-size: 16px; font-weight: 600; margin-top: 2px; }
.hero .badge {
  display: inline-flex; gap: 6px; align-items: center; margin-top: 14px; padding: 7px 12px; border-radius: 999px;
  background: rgba(213, 173, 99, .14); color: var(--gold-2); font-size: 13px; font-weight: 600;
}
.hero .art { position: absolute; right: -14px; top: 18px; width: 150px; height: 150px; opacity: .9; }
.hero .art ellipse { stroke: none; }
.week-dots { display: flex; gap: 8px; margin-top: 18px; }
.week-dots div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.week-dots i {
  display: block; height: 30px; margin-bottom: 5px; border-radius: 10px; background: rgba(255, 255, 255, .06);
}
.week-dots .on i { background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 6px 14px rgba(213, 173, 99, .3); }
.week-dots .today { color: var(--text); font-weight: 600; }

/* Плитки-силуэты */
.tile {
  position: relative; display: grid; place-items: center; border-radius: var(--r-tile);
  background: linear-gradient(155deg, var(--tile-a), var(--tile-b));
}
.glyph { filter: grayscale(1) brightness(.32) contrast(1.4); line-height: 1; }

/* Карточки тренировок */
.w-list { display: grid; gap: 12px; }
.w-card {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 12px;
  border-radius: 24px; background: var(--surface); transition: transform .15s;
}
.w-card:active { transform: scale(.98); }
.w-card .tile { width: 64px; height: 64px; flex: none; border-radius: 18px; }
.w-card .tile .glyph { font-size: 30px; }
.w-card .body { min-width: 0; flex: 1; }
.w-card .title { font-weight: 600; font-size: 15px; }
.w-card .meta { color: var(--gold); font-size: 13px; font-weight: 500; }
.w-card .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-card .chev { color: var(--muted); font-size: 22px; padding-right: 4px; }
.month { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; margin: 18px 4px 2px; }

/* Пустое состояние */
.empty { text-align: center; padding: 34px 18px; border-radius: var(--r-card); background: var(--surface); }
.empty .tile { width: 96px; height: 96px; margin: 0 auto 14px; }
.empty .glyph { font-size: 46px; }
.empty p { color: var(--muted); margin: 6px 0 18px; }

/* Пилюли и вкладки */
.pills { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin-bottom: 12px; }
.pills::-webkit-scrollbar { display: none; }
.pills.wrap { flex-wrap: wrap; overflow: visible; }
.pill {
  flex: none; padding: 10px 18px; border-radius: 14px; background: var(--surface); color: var(--muted);
  font-weight: 500; font-size: 14px; transition: background .2s, color .2s;
}
.pill.active { background: var(--gold); color: var(--gold-ink); font-weight: 600; box-shadow: 0 8px 18px rgba(213, 173, 99, .25); }
.pill input[type=date] { position: absolute; opacity: 0; pointer-events: none; width: 0; }
.place .pill { flex: 1; text-align: center; }
.card .pill:not(.active) { background: var(--surface-2); }

/* Поиск */
.search {
  display: flex; gap: 10px; align-items: center; padding: 0 16px; height: 50px; border-radius: 16px;
  background: var(--surface); color: var(--muted); margin: 6px 0 16px;
}
.search input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font-size: 15px; }
.search input::placeholder { color: var(--muted); }

/* Сетка упражнений */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 14px; }
.ex { text-align: left; }
.ex .tile { aspect-ratio: 1 / .86; transition: transform .15s; }
.ex:active .tile { transform: scale(.97); }
.ex .tile .glyph { font-size: 52px; }
.ex .mark {
  position: absolute; top: 10px; left: 10px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: #2b2b2d; box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
}
.ex .mark svg { width: 16px; height: 16px; stroke-width: 2.6; }
.ex.on .mark { background: var(--gold); }
.ex.on .tile { outline: 3px solid var(--gold); outline-offset: -3px; }
.ex .name { display: block; margin-top: 9px; font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.ex .hint { display: block; color: var(--gold); font-size: 13px; font-weight: 500; }
.ex .hint.new { color: var(--muted); }
.ex.add .tile { background: transparent; border: 2px dashed rgba(213, 173, 99, .55); }
.ex.add .tile svg { width: 40px; height: 40px; color: var(--gold); }
.more-row { grid-column: 1 / -1; }

/* Состав тренировки — как корзина */
.cart { margin-top: 26px; padding: 20px; border-radius: var(--r-card); background: var(--surface); }
.cart h2 { margin-bottom: 12px; }
.cart-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cart-row:first-of-type { border-top: 0; }
.cart-row .tile { width: 52px; height: 52px; border-radius: 15px; flex: none; }
.cart-row .tile .glyph { font-size: 26px; }
.cart-row .body { flex: 1; min-width: 0; }
.cart-row .name { font-weight: 600; font-size: 14.5px; }
.cart-row .det { color: var(--gold); font-size: 13px; font-weight: 500; text-align: left; }
.cart-row .det.empty-det { color: var(--muted); }
.mini-gold {
  width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink); font-size: 22px; font-weight: 600; line-height: 1;
}
.mini-gold.dim { background: var(--surface-2); color: var(--muted); }

.extras { display: grid; gap: 12px; margin-top: 16px; }
textarea {
  width: 100%; resize: none; border: 0; outline: 0; border-radius: 18px; padding: 14px 16px;
  background: var(--surface); color: var(--text);
}
textarea::placeholder { color: var(--muted); }
.photo-pick { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 18px; background: var(--surface); color: var(--muted); }
.photo-thumb {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-2); color: var(--gold); flex: none;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Главная кнопка */
.cta {
  display: block; width: 100%; margin-top: 18px; height: 58px; border-radius: 20px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink);
  font-weight: 600; font-size: 16px; box-shadow: 0 14px 28px rgba(213, 173, 99, .28);
  transition: opacity .2s, transform .15s;
}
.cta:active { transform: scale(.98); }
.cta:disabled { opacity: .35; box-shadow: none; }
.ghost-btn { display: block; width: 100%; margin-top: 14px; height: 50px; border-radius: 18px; background: var(--surface); color: var(--muted); font-weight: 500; }

/* Статистика */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric { padding: 16px 18px; border-radius: 24px; background: var(--surface); }
.metric .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
.metric .k { color: var(--muted); font-size: 13px; font-weight: 500; }
.metric .d { font-size: 12px; color: var(--gold); font-weight: 500; }
.card { margin-top: 14px; padding: 20px; border-radius: var(--r-card); background: var(--surface); }
.streak {
  display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 16px 18px; border-radius: 24px;
  border: 1.5px solid rgba(213, 173, 99, .45); background: rgba(213, 173, 99, .07);
}
.streak b { color: var(--gold); font-size: 26px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; margin-top: 16px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars i { display: block; width: 100%; max-width: 26px; min-height: 4px; border-radius: 9px; background: var(--surface-2); }
.bars .has i { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.bars .now i { box-shadow: 0 6px 16px rgba(213, 173, 99, .35); }
.bars span { font-size: 10.5px; color: var(--muted); }
.bars em { font-style: normal; font-size: 12px; font-weight: 600; }
.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: 14px 0 10px; background: var(--surface-2); }
.split i:first-child { background: var(--tile-b); }
.split i:last-child { background: var(--gold); }
.legend { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.legend b { color: var(--text); }
.top-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.top-row .tile { width: 44px; height: 44px; border-radius: 13px; flex: none; }
.top-row .tile .glyph { font-size: 22px; }
.top-row .body { flex: 1; }
.top-row .line { height: 6px; border-radius: 9px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.top-row .line i { display: block; height: 100%; background: var(--gold); border-radius: 9px; }
.top-row b { color: var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface-2); font-size: 13.5px; font-weight: 500;
}
.chip .x { color: var(--muted); font-size: 15px; line-height: 1; }
.chip.gold { background: rgba(213, 173, 99, .16); color: var(--gold-2); }

/* Настройки */
.inline-add { display: flex; gap: 10px; margin-top: 14px; }
.inline-add input { flex: 1; height: 42px; border: 0; outline: 0; border-radius: 13px; padding: 0 14px; background: var(--surface-2); }
.inline-add .mini-gold { width: 42px; height: 42px; }
.row-btn {
  display: flex; justify-content: space-between; width: 100%; padding: 14px 0; font-weight: 500;
  border-top: 1px solid var(--line); text-align: left;
}
.row-btn:first-of-type { border-top: 0; margin-top: 4px; }
.row-btn span { color: var(--muted); font-size: 13px; }
.row-btn.danger { color: var(--danger); }

/* Нижняя панель */
.nav {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  width: min(480px, calc(100% - 32px)); height: 64px; padding: 0 10px; border-radius: 24px;
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(58, 58, 61, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .35); z-index: 20;
}
.nav button { width: 48px; height: 48px; display: grid; place-items: center; color: var(--muted); border-radius: 16px; transition: color .2s; }
.nav button.active { color: var(--gold); }
.nav .plus {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 10px 22px rgba(213, 173, 99, .4);
}
.nav .plus.active { color: var(--gold-ink); }
.nav .plus svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* Шторка */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88vh; overflow-y: auto;
  max-width: 520px; margin: 0 auto; padding: 10px 22px calc(26px + var(--safe-b));
  border-radius: 32px 32px 0 0; background: #323235; animation: up .26s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.grabber { width: 44px; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .18); margin: 0 auto 16px; }
.sheet h2 { font-size: 26px; font-weight: 700; line-height: 1.15; }
.sheet .hero-tile { height: 140px; margin: 0 0 16px; border-radius: 26px; }
.sheet .hero-tile .glyph { font-size: 72px; }
.sheet .meta { color: var(--gold); font-weight: 500; margin: 4px 0 16px; }
.last-hint { padding: 12px 14px; border-radius: 16px; background: rgba(213, 173, 99, .1); color: var(--gold-2); font-size: 14px; margin: 14px 0; }
.field {
  width: 100%; height: 54px; border: 0; outline: 0; border-radius: 16px; padding: 0 16px; font-size: 17px;
  background: var(--surface-2); color: var(--text);
}
.field::placeholder { color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.sheet .cta { margin-top: 16px; }
.sheet .ghost-btn { margin-top: 10px; }
.sheet .ghost-btn.danger { color: var(--danger); }
.entry { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry .when { color: var(--muted); font-size: 14px; }
.entry .what { color: var(--gold); font-weight: 600; text-align: right; }
.items { margin: 6px 0 4px; }
.items div { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.items div:first-child { border-top: 0; }
.items span:last-child { color: var(--gold); font-weight: 500; text-align: right; }
.note { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); color: #d6d6d6; font-size: 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Тост */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 40;
  width: max-content; max-width: calc(100% - 40px); padding: 12px 18px; border-radius: 16px; background: #f6f6f4; color: #2b2b2d;
  font-weight: 500; font-size: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); animation: fade .2s;
}
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
