/* =========================================================================
   DaisyDose — styles.css  (тёплая «ромашковая» тема, центр-колесо, привычки)
   ========================================================================= */

:root {
  /* тёмная тёплая тема */
  --bg:        #100c08;
  --surface:   rgba(255, 248, 238, 0.05);
  --surface-2: rgba(255, 248, 238, 0.09);
  --border:    rgba(255, 244, 230, 0.10);
  --text:      #F3EEE6;
  --muted:     #9C9486;
  --faint:     #6A6353;
  --soft:      #D7CFC2;   /* вторичный текст в карточках */

  --accent:    #F5972A;   /* тёплый янтарь */
  --accent-2:  #FFCE85;
  --accent-ink:#2a1c05;   /* тёмный текст на янтарных кнопках */
  --grad:      linear-gradient(135deg, #F4990F 0%, #FB6B45 100%);  /* янтарь → коралл (контраст с белым) */
  --grad-soft: rgba(245, 151, 42, 0.16);
  /* «ромашка» — золотисто-жёлтый центр (серединка цветка), читаемый в обеих темах */
  --daisy:     radial-gradient(circle at 50% 36%, #FFE489 0%, #FBC02D 46%, #E59600 100%);
  --daisy-ink: #4a3500;
  --daisy-glow: rgba(229,150,0,.45);
  --good:      #34d399;
  --warn:      #F6A723;
  --danger:    #fb7185;

  --r-lg: 26px; --r-md: 18px; --r-sm: 12px;
  --tabbar-h: 80px;
  --shadow: 0 18px 50px rgba(0,0,0,.5);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
}

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font); color: var(--text);
  background:
    radial-gradient(1100px 640px at 50% -12%, #2e1c07 0%, transparent 55%),
    radial-gradient(800px 560px at 92% 112%, #2c1208 0%, transparent 52%),
    var(--bg);
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 22px; overflow: hidden;
}

/* ----------------------------- Телефон ----------------------------------- */
.device {
  position: relative; width: 392px; height: 844px; max-height: calc(100dvh - 28px);
  background: radial-gradient(ellipse at top, #1e1408 0%, #100c08 62%);
  border-radius: 46px; border: 1px solid rgba(255,255,255,.07);
  box-shadow: var(--shadow), inset 0 0 0 8px #070503, inset 0 0 0 9px rgba(255,255,255,.04);
  overflow: hidden; display: flex; flex-direction: column;
}
.device::before {
  content: ""; position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 128px; height: 28px; background: #070503; border-radius: 0 0 18px 18px; z-index: 60;
}
.statusbar {
  height: 46px; flex: 0 0 46px; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 26px 0; font-size: 13px; font-weight: 600; z-index: 40;
}
.statusbar .right { display: flex; gap: 6px; align-items: center; opacity: .9; }

.screen { flex: 1 1 auto; position: relative; overflow: hidden; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding: 4px 18px calc(var(--tabbar-h) + 18px); -webkit-overflow-scrolling: touch;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .28s ease, transform .28s ease;
}
.view.active { opacity: 1; pointer-events: auto; transform: none; }
.view::-webkit-scrollbar { width: 0; }

/* ----------------------------- Заголовки --------------------------------- */
.page-head { padding: 8px 4px 14px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.page-head p  { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.greet { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.greet .date { font-size: 12px; color: var(--muted); font-weight: 600; }
.greet .hi   { font-size: 23px; font-weight: 800; margin-top: 2px; letter-spacing: -.4px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px;
  background: var(--grad); display: grid; place-items: center; font-size: 20px; font-weight: 800;
  box-shadow: 0 8px 20px rgba(245,151,42,.4);
  border: 0; padding: 0; cursor: pointer; color: #fff; font-family: var(--font); touch-action: none;
  transition: transform .12s ease;
}
.avatar:active { transform: scale(.92); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px; backdrop-filter: blur(8px);
}
.section-title { font-size: 12px; color: var(--muted); font-weight: 700; margin: 20px 4px 10px; letter-spacing:.4px; text-transform: uppercase; }

/* стрик-карта на главной */
.streak-card { display: flex; align-items: center; gap: 13px; margin-top: 12px; }
.streak-card .flame { font-size: 30px; animation: flicker 1.6s ease-in-out infinite; }
@keyframes flicker { 0%,100%{transform:scale(1) rotate(-2deg)} 50%{transform:scale(1.08) rotate(2deg)} }
.streak-card .mid { flex: 1; }
.streak-card .mid .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.streak-card .mid .v { font-size: 21px; font-weight: 800; margin-top: 1px; }
.streak-card .mid .v small { font-size: 12px; color: var(--faint); font-weight: 500; }
.streak-card .pct { text-align: right; }
.streak-card .pct .p { font-size: 13px; font-weight: 800; color: var(--good); }
.streak-card .pct .s { font-size: 10px; color: var(--muted); }
.streak-bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.streak-fill { height: 100%; background: var(--grad); border-radius: 4px; }

/* ===================== ГЛАВНАЯ: РОМАШКА + КОЛЕСО ========================= */
.daisy-wrap { display: flex; flex-direction: column; align-items: center; }
.hint-chip {
  margin: 8px auto 2px; font-size: 12.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 15px; border-radius: 999px; display: inline-flex; gap: 7px; align-items: center;
  transition: all .2s ease; max-width: 92%; text-align: center;
}
.hint-chip b { color: var(--accent-2); font-weight: 700; }
.hint-chip.live { border-color: var(--accent); color: var(--text); }

.stage { position: relative; width: 356px; height: 356px; margin: 2px auto 0; touch-action: none; user-select: none; }
.thread { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

/* центр-колесо */
.hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 124px; height: 124px; border-radius: 50%;
  display: grid; place-items: center; text-align: center; cursor: grab;
  background: var(--daisy);
  box-shadow: 0 12px 40px var(--daisy-glow), inset 0 2px 14px rgba(255,255,255,.45), inset 0 -6px 16px rgba(180,120,0,.35);
  z-index: 20; transition: transform .14s ease;
}
.hub.dragging { cursor: grabbing; transform: translate(-50%,-50%) scale(.94); }
.hub-core { display: flex; align-items: center; justify-content: center; line-height: 1; pointer-events: none; }
.hub .qty { font-size: 56px; font-weight: 800; line-height: 1; color: var(--daisy-ink); letter-spacing: -1px; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.hub .chev { position: absolute; left: 0; right: 0; font-size: 13px; color: rgba(74,53,0,.5); pointer-events: none; }
.hub .chev.up { top: 12px; } .hub .chev.dn { bottom: 12px; }
.hub.scrubbing { box-shadow: 0 0 0 5px rgba(255,221,128,.5), 0 12px 40px var(--daisy-glow); }

/* лепестки */
.petal {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 26px; z-index: 10;
  transition: transform .22s cubic-bezier(.2,.8,.25,1), box-shadow .2s ease, background .2s ease;
  will-change: transform; cursor: pointer;
}
.petal .lbl {
  position: absolute; bottom: -17px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--muted); white-space: nowrap; font-weight: 600; pointer-events: none;
  max-width: 78px; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.petal.hot {
  transform: scale(1.34); background: var(--_c, var(--accent)); border-color: transparent;
  box-shadow: 0 10px 30px -4px var(--_c), 0 0 0 6px rgba(255,255,255,.07);
}
.petal.hot .lbl { color: var(--text); }
.petal.dim { opacity: .3; transform: scale(.9); }
.petal.more { background: var(--surface); border-style: dashed; border-color: var(--border); color: var(--muted); }
.petal.more .lbl { color: var(--faint); }

/* строки профилей в переключателе */
.prof-row { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-top: 1px solid var(--border); cursor: pointer; }
.prof-row:first-child { border-top: 0; }
.prof-row .pav { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: 0 0 44px; }
.prof-row.active .pav { background: var(--grad); }
.prof-row .pm { flex: 1; min-width: 0; }
.prof-row .pm .t { font-weight: 700; font-size: 14.5px; }
.prof-row .pm .s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.prof-row .pcheck { color: var(--good); font-weight: 800; font-size: 16px; }
.prof-row .edit { color: var(--faint); font-size: 13px; padding: 6px; cursor: pointer; }

/* PIN-пад */
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 10px 0 22px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); background: transparent; transition: all .15s ease; }
.pin-dot.on { background: var(--accent); border-color: var(--accent); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.pin-pad span { } /* пустая ячейка */
.pin-key { height: 58px; border-radius: 16px; font-size: 24px; font-weight: 700; background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-family: var(--font); transition: transform .08s ease, background .15s ease; }
.pin-key:active { background: var(--surface-2); transform: scale(.95); }

/* цели профиля */
.goal-inputs { display: flex; flex-direction: column; gap: 10px; }
.goal-inputs > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.text-input.mini { width: 92px; text-align: center; padding: 9px 8px; font-size: 15px; }

/* летящий токен */
.token {
  position: absolute; left: 0; top: 0; width: 60px; height: 60px; margin: -30px;
  border-radius: 50%; display: grid; place-items: center; font-size: 27px; z-index: 30;
  pointer-events: none; background: var(--daisy); border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 12px 30px rgba(0,0,0,.5); opacity: 0; transform: scale(.6); transition: opacity .12s ease;
}
.token.show { opacity: 1; }
.token .badge {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px;
  background: #fff; color: #14121c; border-radius: 11px; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.4);
}

/* метрики дня */
.today-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 16px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 12px; text-align: center; }
.metric .v { font-size: 19px; font-weight: 800; }
.metric .v small { font-size: 11px; color: var(--muted); font-weight: 600; }
.metric .k { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.chips-row { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.chips-row::-webkit-scrollbar { height: 0; }
.tchip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 13px;
}
.tchip .ic { font-size: 19px; }
.tchip .nm { font-size: 10px; color: var(--muted); }
.tchip .ct { font-size: 13.5px; font-weight: 800; }
.empty-chip { color: var(--faint); font-size: 13px; padding: 10px 4px; }

/* здоровье (бары) */
.health { display: flex; flex-direction: column; gap: 13px; }
.health .row .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.health .row .top .nm { color: var(--text); display: flex; gap: 7px; align-items: center; }
.health .row .top .pc { font-weight: 800; }
.hbar { height: 7px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.hfill { height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.2,.9,.3,1); }

.tip-card { background: linear-gradient(135deg, rgba(245,151,42,.16), rgba(251,107,69,.07)); border-color: rgba(245,151,42,.28); }
.tip-card .row { display: flex; gap: 12px; align-items: flex-start; }
.tip-card .em { font-size: 22px; }
.tip-card .t { font-size: 14px; font-weight: 700; }
.tip-card .d { font-size: 12.5px; color: var(--soft); margin-top: 3px; line-height: 1.5; }

/* ===================== КАЛЕНДАРЬ ========================================= */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 12px; }
.cal-head .m { font-size: 18px; font-weight: 800; }
.cal-nav { display: flex; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; cursor: pointer; font-size: 16px; color: var(--text); }
.icon-btn:active { background: var(--surface-2); }
.weekdays { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; margin-bottom: 6px; }
.weekdays span { text-align: center; font-size: 11px; color: var(--faint); font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.day {
  position: relative; aspect-ratio: 1 / 1.58; border-radius: 13px; background: var(--surface);
  border: 1px solid var(--border); padding: 6px 3px 7px; display: flex; flex-direction: column;
  align-items: center; cursor: pointer; overflow: hidden; transition: transform .1s ease;
}
.day:active { transform: scale(.95); }
.day.empty { background: transparent; border-color: transparent; pointer-events: none; }
.day .num { font-size: 12.5px; font-weight: 800; color: var(--muted); line-height: 1; margin-bottom: 3px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.day .icons { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 16px; gap: 2px; width: 38px; margin-top: auto; justify-items: center; align-items: center; }
.day .icons .i { font-size: 12.5px; line-height: 1; }
.day .icons .more-n { font-size: 9px; font-weight: 800; color: var(--muted); }
.day.sober::after { content: "✓"; position: absolute; top: 5px; right: 5px; font-size: 9px; color: var(--good); font-weight: 800; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 16px; padding: 0 2px; }
.legend .it { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ===================== СТАТИСТИКА ======================================== */
.seg { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 4px; margin: 4px 2px 16px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; padding: 9px 0; border-radius: 10px; cursor: pointer; font-family: var(--font); transition: all .18s ease; }
.seg button.active { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.metric-chips { display: flex; gap: 7px; margin: 0 2px 14px; }
.metric-chips button { flex: 1; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 9px 0; border-radius: 12px; cursor: pointer; font-family: var(--font); transition: all .16s ease; }
.metric-chips button.active { background: var(--grad); border-color: transparent; color: #fff; }

.chart-card { padding: 16px 14px 12px; margin-bottom: 12px; position: relative; }
.chart-card .ch-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.chart-card h3 { margin: 0; font-size: 14px; }
.chart-card .ch-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.chart-card .delta { font-size: 12.5px; font-weight: 800; }
.chart svg { width: 100%; display: block; overflow: visible; }
.bar-x { font-size: 9px; fill: var(--faint); }
.chart rect.bar { cursor: pointer; transition: opacity .12s ease; }
.chart-tip {
  position: absolute; transform: translate(-50%, -100%); z-index: 5;
  background: var(--text); color: var(--bg); padding: 7px 11px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4; text-align: left; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .14s ease; box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.chart-tip.show { opacity: 1; }
.chart-tip b { font-weight: 800; }
.chart-tip .tip-total { font-weight: 800; opacity: .7; margin: 1px 0 3px; }

.donut-row { display: flex; align-items: center; gap: 16px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.donut-legend .it { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; padding: 5px 8px; margin: -3px -8px; border-radius: 10px; transition: background .15s ease; min-width: 0; }
.donut-legend .it.sel { background: var(--surface-2); }
.donut-legend .it .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .it .vl { color: var(--muted); font-weight: 700; white-space: nowrap; font-size: 11.5px; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 50%; }
.chart .dseg { cursor: pointer; transition: stroke-width .18s ease, stroke-opacity .18s ease; }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; text-align: center; }
.mini .k { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing:.3px; }
.mini .v { font-size: 24px; font-weight: 800; margin-top: 5px; }
.mini .v small { font-size: 12px; color: var(--faint); font-weight: 500; }
.mini .s { font-size: 10.5px; color: var(--accent-2); margin-top: 3px; }

/* ===================== ИТОГИ ============================================= */
.ring-card { display: flex; align-items: center; gap: 16px; }
.ring-card .txt { flex: 1; }
.ring-card .txt .t { font-weight: 700; font-size: 14.5px; }
.ring-card .txt .d { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.dry-card { background: linear-gradient(135deg, rgba(52,211,153,.16), rgba(52,211,153,.04)); border-color: rgba(52,211,153,.3); }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px; }
.stat .ic { font-size: 18px; }
.stat .big { font-size: 25px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.stat .big small { font-size: 12px; color: var(--faint); font-weight: 500; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .trend { font-size: 11.5px; font-weight: 700; margin-top: 7px; display: inline-flex; gap: 4px; align-items: center; }
.trend.up { color: var(--danger); } .trend.down { color: var(--good); }

.goals { display: flex; flex-direction: column; gap: 14px; }
.goal .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.goal .top b { font-weight: 800; }

.insight { display: flex; gap: 12px; align-items: flex-start; }
.insight .em { font-size: 22px; }
.insight .tx { font-size: 13px; line-height: 1.5; color: var(--soft); } .insight .tx b { color: var(--text); }

/* ===================== ЕЩЁ / НАСТРОЙКИ =================================== */
.profile-card { display: flex; align-items: center; gap: 13px; }
.profile-card .av { width: 52px; height: 52px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 21px; font-weight: 800; }
.profile-card .nm { font-weight: 800; font-size: 16px; }
.profile-card .em { font-size: 12.5px; color: var(--muted); }

.habit-row { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-top: 1px solid var(--border); }
.habit-row:first-child { border-top: 0; }
.habit-row .hi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; flex: 0 0 42px; }
.habit-row .hm { flex: 1; min-width: 0; }
.habit-row .hm .t { font-weight: 700; font-size: 14px; }
.habit-row .hm .s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.habit-row .edit { color: var(--faint); font-size: 13px; padding: 6px; cursor: pointer; }

.add-habit-btn {
  width: 100%; margin-top: 12px; padding: 12px; border-radius: 14px; cursor: pointer;
  background: rgba(245,151,42,.14); border: 1px solid rgba(245,151,42,.3); color: var(--accent-2);
  font-weight: 700; font-size: 13.5px; font-family: var(--font); display: flex; gap: 7px; align-items: center; justify-content: center;
}
.add-habit-btn:active { background: rgba(245,151,42,.24); }

.toggle { width: 46px; height: 28px; background: rgba(255,255,255,.15); border-radius: 14px; position: relative; cursor: pointer; transition: background .2s; flex: 0 0 46px; border: 0; }
.toggle.on { background: var(--grad); }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle.on::after { transform: translateX(18px); }

.setting-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.setting-row:first-child { border-top: 0; }
.setting-row .sm { flex: 1; }
.setting-row .sm .t { font-size: 14px; font-weight: 600; }
.setting-row .sm .s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.setting-row .rt { color: var(--faint); font-size: 13px; }

/* ===================== НИЖНЕЕ МЕНЮ ====================================== */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  display: flex; align-items: flex-start; justify-content: space-around; padding: 10px 8px 0;
  background: linear-gradient(180deg, rgba(10,10,15,.4), rgba(10,10,15,.96) 55%);
  backdrop-filter: blur(16px); border-top: 1px solid var(--border); z-index: 50;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; color: var(--faint); font-family: var(--font); font-size: 9.5px; font-weight: 600; padding-top: 4px; transition: color .15s ease; }
.tab .ti { font-size: 20px; transition: transform .18s ease; }
.tab.active { color: var(--accent-2); }
.tab.active .ti { transform: translateY(-2px) scale(1.06); }

/* ===================== НИЖНИЙ ЛИСТ ====================================== */
.scrim { position: absolute; inset: 0; z-index: 100; background: rgba(0,0,0,.6); opacity: 0; pointer-events: none; transition: opacity .25s ease; backdrop-filter: blur(3px); }
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 101;
  background: linear-gradient(180deg, #1c1536, #120f22); border-radius: 28px 28px 0 0;
  border: 1px solid var(--border); border-bottom: 0; padding: 10px 18px 20px;
  transform: translateY(110%); transition: transform .34s cubic-bezier(.2,.85,.25,1);
  box-shadow: 0 -20px 50px rgba(0,0,0,.5); max-height: 92%; overflow-y: auto;
}
.sheet.show { transform: translateY(0); }
.sheet::-webkit-scrollbar { width: 0; }
.grabber { width: 42px; height: 5px; border-radius: 3px; background: var(--surface-2); margin: 4px auto 14px; }

.sheet-head { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.sheet-head .big-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 27px; background: var(--_c, var(--surface-2)); box-shadow: 0 8px 22px -6px var(--_c); }
.sheet-head .ttl { font-size: 19px; font-weight: 800; }
.sheet-head .sub { font-size: 12.5px; color: var(--muted); }
.sheet-head .del { margin-left: auto; width: 40px; height: 40px; border-radius: 12px; background: rgba(251,113,133,.12); border: 1px solid rgba(251,113,133,.25); color: var(--danger); font-size: 17px; display: grid; place-items: center; cursor: pointer; }
.sheet-head .x { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 15px; display: grid; place-items: center; cursor: pointer; }

.field-label { font-size: 12px; color: var(--muted); font-weight: 700; margin: 0 0 9px; letter-spacing:.3px; }
.field-label.mt { margin-top: 18px; }

.portions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.portion { flex: 1 1 calc(50% - 8px); min-width: 0; background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 11px 12px; cursor: pointer; text-align: left; transition: all .15s ease; color: var(--text); font-family: var(--font); }
.portion .pl { font-weight: 700; font-size: 13.5px; }
.portion .ps { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.portion.sel { border-color: var(--_c, var(--accent)); background: color-mix(in srgb, var(--_c, var(--accent)) 16%, transparent); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.step-btn { width: 62px; height: 62px; border-radius: 20px; font-size: 30px; font-weight: 300; background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; display: grid; place-items: center; line-height: 1; transition: transform .08s ease, background .15s ease; }
.step-btn:active { transform: scale(.9); background: var(--surface-2); }
.step-val { text-align: center; }
.step-val .n { font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.step-val .u { font-size: 13px; color: var(--muted); margin-top: 4px; }
.presets { display: flex; gap: 7px; justify-content: center; margin: 14px 0 18px; }
.preset { background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: var(--font); }
.preset.active { background: var(--grad); border-color: transparent; color: #fff; }
.preset:active { transform: scale(.94); }

.metric-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.badge { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; flex: 1 1 auto; min-width: 70px; text-align: center; }
.badge .bv { font-weight: 800; font-size: 16px; }
.badge .bk { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.badge.accent .bv { color: var(--accent-2); }

.row-line { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-top: 1px solid var(--border); font-size: 14px; }
.row-line .lk { color: var(--muted); } .row-line .rv { margin-left: auto; font-weight: 700; }
.moods { display: flex; gap: 8px; }
.mood { width: 44px; height: 44px; border-radius: 12px; font-size: 20px; cursor: pointer; background: var(--surface); border: 1.5px solid var(--border); display: grid; place-items: center; }
.mood.sel { border-color: var(--accent); background: var(--grad-soft); }
.note-input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; color: var(--text); font-family: var(--font); font-size: 14px; margin-top: 4px; resize: none; }
.note-input::placeholder { color: var(--faint); }

.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn { flex: 1; height: 54px; border-radius: 16px; font-size: 16px; font-weight: 700; cursor: pointer; font-family: var(--font); border: 1px solid var(--border); transition: transform .08s ease; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--text); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 10px 26px -8px var(--accent); }
.btn.danger { background: linear-gradient(135deg,#fb7185,#e11d48); color: #fff; border-color: transparent; box-shadow: 0 10px 26px -8px var(--danger); }

.confirm { text-align: center; padding: 6px 6px 4px; }
.confirm .ct { font-size: 18px; font-weight: 800; }
.confirm .cm { font-size: 13.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.entry { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); cursor: pointer; }
.entry:first-of-type { border-top: 0; }
.entry .ei { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; background: var(--_c, var(--surface-2)); }
.entry .em { flex: 1; } .entry .em .t { font-weight: 700; font-size: 14px; } .entry .em .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.entry .et { font-size: 12px; color: var(--faint); } .entry .chev { color: var(--faint); font-size: 16px; }
.empty-day { text-align: center; color: var(--muted); padding: 28px 0; font-size: 13.5px; }
.empty-day .e { font-size: 34px; display: block; margin-bottom: 8px; }

/* конструктор привычки */
.text-input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; color: var(--text); font-family: var(--font); font-size: 15px; }
.text-input:focus { outline: none; border-color: var(--accent); }
.picker { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; background: var(--surface); border: 1.5px solid var(--border); cursor: pointer; }
.pick.sel { border-color: var(--accent); background: var(--grad-soft); }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.kind-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.kchip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--font); color: var(--text); }
.kchip.sel { background: var(--grad); border-color: transparent; color: #fff; }
.two-col { display: flex; gap: 10px; }
.two-col > div { flex: 1; }

/* тост с действиями */
.toast {
  position: absolute; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 12px);
  background: rgba(20,18,30,.97); border: 1px solid var(--border); color: var(--text);
  padding: 13px 16px; border-radius: 16px; z-index: 120; opacity: 0; pointer-events: none;
  transform: translateY(20px); transition: all .28s ease; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.toast .msg { flex: 1; font-size: 13.5px; font-weight: 600; }
.toast .ta { background: none; border: 0; font-family: var(--font); font-weight: 800; font-size: 13px; cursor: pointer; padding: 6px 8px; }
.toast .ta.undo { color: var(--accent-2); }
.toast .ta.edit { color: var(--muted); }

/* редактор «Когда» (дата/время) */
.when { margin-bottom: 6px; }
.day-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.dchip { display: inline-flex; align-items: center; gap: 5px; padding: 9px 14px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--border); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; font-family: var(--font); }
.dchip.sel { border-color: var(--accent); background: var(--grad-soft); }
.dchip.date-pick { position: relative; color: var(--muted); }
.dchip.date-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.time-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.time-pick input { background: transparent; border: 0; color: var(--text); font-family: var(--font); font-size: 16px; font-weight: 700; text-align: right; }
.time-pick input:focus, .text-input:focus, .note-input:focus, .dchip.date-pick input:focus { outline: none; }

/* инсайты (список) */
.insights { display: flex; flex-direction: column; gap: 0; }
.ins { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-top: 1px solid var(--border); }
.ins:first-child { border-top: 0; }
.ins .em { font-size: 21px; line-height: 1.2; }
.ins .tx { font-size: 13px; line-height: 1.5; color: var(--soft); } .ins .tx b { color: var(--text); }

.outside-hint { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); color: var(--faint); font-size: 12px; text-align: center; max-width: 360px; }

/* ----------------------------- мелкий полиш ------------------------------ */
/* моноширинные цифры — числа не «прыгают» при изменении */
.hub .qty, .step-val .n, .metric .v, .stat .big, .mini .v, .badge .bv,
.day .num, .streak-card .mid .v, .donut-legend .vl, .delta { font-variant-numeric: tabular-nums; }
/* тактильный отклик при нажатии на строки-списки */
.entry, .habit-row, .prof-row, .setting-row { transition: background .12s ease; }
.entry:active, .habit-row:active, .prof-row:active, .setting-row:active { background: var(--surface-2); }
.icon-btn:active { transform: scale(.92); }

/* ===================== СВЕТЛАЯ ТЁПЛАЯ ТЕМА ============================== */
[data-theme="light"] {
  --bg: #FBF5EB;
  --surface: rgba(74, 48, 12, .055); --surface-2: rgba(74, 48, 12, .10); --border: rgba(74, 48, 12, .13);
  --text: #2A2114; --muted: #6E6452; --faint: #A99E89;
  --soft: #4A4234;
  --accent-2: #B5710A;   /* тёмный янтарь — читаемый акцент на кремовом */
  --shadow: 0 18px 50px rgba(120,80,20,.16);
}
[data-theme="light"] body {
  background:
    radial-gradient(1100px 640px at 50% -12%, #FCEBC9 0%, transparent 55%),
    radial-gradient(800px 560px at 92% 112%, #FFE3D2 0%, transparent 52%),
    var(--bg);
}
[data-theme="light"] .device {
  background: radial-gradient(ellipse at top, #FFFFFF 0%, #FBF3E6 62%);
  box-shadow: var(--shadow), inset 0 0 0 8px #EFE6D6, inset 0 0 0 9px rgba(0,0,0,.04);
}
[data-theme="light"] .device::before { background: #EFE6D6; }
[data-theme="light"] .sheet { background: linear-gradient(180deg, #FFFFFF, #FBF4E8); }
[data-theme="light"] .tabbar { background: linear-gradient(180deg, rgba(251,243,230,.4), rgba(251,243,230,.97) 55%); }
[data-theme="light"] .toast { background: rgba(255,255,255,.98); }
[data-theme="light"] .toast .ta.undo { color: var(--accent); }
[data-theme="light"] .swatch.sel { border-color: #2A2114; box-shadow: 0 0 0 2px #fff; }
[data-theme="light"] .petal { background: rgba(74,48,12,.06); }
[data-theme="light"] .chart-tip { box-shadow: 0 6px 18px rgba(120,80,20,.25); }
[data-theme="light"] .streak-bar, [data-theme="light"] .hbar { background: rgba(74,48,12,.10); }

@media (max-width: 440px) {
  html, body { width: 100%; overflow-x: hidden; padding: 0; }
  .device { width: 100%; height: 100dvh; max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .device::before { display: none; }
  .outside-hint { display: none; }
}
