/* Пульт. Спокойный интерфейс: светлая и тёмная тема по системе, одна высота у кнопок и полей, анимация только цвета и прозрачности. */
:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #F0F0F3;
  --border: #E3E3E8;
  --border-strong: #CFCFD6;
  --text: #17171C;
  --text-2: #5C5C66;
  --text-3: #8B8B95;
  --accent: #6A4FD8;
  --accent-hover: #5B41C7;
  --accent-soft: #EFEBFD;
  --accent-text: #FFFFFF;
  --inc: #2F6FDB;
  --exp: #E0743A;
  --good: #1F9D61;
  --good-soft: #E3F5EC;
  --warn: #B7791F;
  --warn-soft: #FBF1DD;
  --bad: #D14343;
  --bad-soft: #FCE8E8;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.04), 0 1px 3px rgba(20, 20, 30, 0.04);
  --shadow-pop: 0 8px 28px rgba(20, 20, 30, 0.14);
  --r: 14px;
  --r-sm: 10px;
  --h: 38px;
  --f: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0F12;
    --surface: #18181C;
    --surface-2: #212126;
    --border: #2A2A30;
    --border-strong: #3A3A42;
    --text: #EDEDF0;
    --text-2: #A3A3AD;
    --text-3: #75757F;
    --accent: #8B74F0;
    --accent-hover: #9C88F4;
    --accent-soft: #252040;
    --accent-text: #FFFFFF;
    --inc: #5B92F0;
    --exp: #F08A50;
    --good: #3DBB7E;
    --good-soft: #15291F;
    --warn: #E0A84A;
    --warn-soft: #2D2416;
    --bad: #F06B6B;
    --bad-soft: #33191B;
    --shadow: none;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--f); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num, .amt, .val, .v { font-variant-numeric: tabular-nums; }
.t2 { color: var(--text-2); }
.t3 { color: var(--text-3); }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-size: 16px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); cursor: pointer; font-weight: 550; text-align: left; transition: background-color 0.15s, color 0.15s; }
.nav button svg { width: 18px; height: 18px; flex: none; }
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 6px 0; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me span { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.ask { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 8px; height: var(--h); padding: 0 4px 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); transition: border-color 0.15s, box-shadow 0.15s; }
.ask:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; }
.ask input::placeholder { color: var(--text-3); }
.ask .btn { height: 30px; min-height: 30px; }
.orb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; transition: opacity 0.2s; }
.orb.busy { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.roundbtn { width: var(--h); height: var(--h); border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; position: relative; flex: none; transition: background-color 0.15s; }
.roundbtn:hover { background: var(--surface-2); }
.roundbtn svg { width: 17px; height: 17px; }
.roundbtn .dot { position: absolute; right: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.roundbtn.ok .dot { background: var(--good); }
.roundbtn.local .dot { background: var(--warn); }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 28px 48px; }

/* мобильный: нижняя панель вкладок */
.tabbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top { padding: 10px 16px; }
  .content { padding: 18px 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar button { flex: 1 0 auto; min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-3); font-size: 11px; font-weight: 600; cursor: pointer; }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button[aria-current="page"] { color: var(--accent); }
  .ask .btn { display: none; }
  .plus-label { display: none; }
}

/* ---------- ответ Claude ---------- */
.answer { position: fixed; z-index: 25; top: 68px; left: 50%; transform: translateX(-50%); width: min(680px, calc(100% - 32px)); max-height: min(65vh, 560px); display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.answer-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.answer-h h2 { display: flex; align-items: center; gap: 8px; }
.answer-acts { display: flex; gap: 14px; }
.thread { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; padding: 2px; }
.thread .steps { font-size: 12px; color: var(--text-3); white-space: normal; }
.thread .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.thread .msg.err { background: var(--surface-2); color: var(--exp); }
#p-history li { align-items: flex-start; gap: 12px; }
#p-history .h-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#p-history .h-acts { display: flex; gap: 8px; flex-shrink: 0; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: pulse 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }

/* быстрое добавление */
.quick { position: fixed; z-index: 26; top: 60px; right: 28px; width: 240px; padding: 6px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop); }
.quick button { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; font-weight: 550; }
.quick button:hover { background: var(--surface-2); }
.quick .ico { width: 26px; height: 26px; }
.quick .ico svg { width: 14px; height: 14px; }

/* ---------- разделы ---------- */
.view { display: flex; flex-direction: column; gap: 16px; }
.vhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.vhead > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vhead .sub { color: var(--text-2); }
.clock { display: flex; align-items: center; gap: 12px; }
.clock b { font-size: 22px; font-weight: 600; color: var(--text-2); }
.banner { display: flex; gap: 10px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }

.card { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-h .t3 { font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
@media (max-width: 1080px) { .c4, .c5, .c6, .c7, .c8 { grid-column: span 12; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { gap: 8px; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 550; }
.kpi .val, .stat .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; }
.skel { min-height: 112px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: skel 1.4s linear infinite; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (max-width: 560px) {
  .kpis, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .val, .stat .v { font-size: 19px; }
  .card { padding: 14px; }
  h1 { font-size: 22px; }
  .clock b { display: none; }
}

.ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.ico svg { width: 15px; height: 15px; }
.ico.blue { background: color-mix(in srgb, var(--inc) 14%, transparent); color: var(--inc); }
.ico.orange { background: color-mix(in srgb, var(--exp) 14%, transparent); color: var(--exp); }
.ico.green { background: var(--good-soft); color: var(--good); }
.ico.violet { background: var(--accent-soft); color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip svg { width: 11px; height: 11px; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }

/* кнопки и поля: одна высота, один радиус */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h); min-height: var(--h); padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.glow { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.glow .orb { width: 8px; height: 8px; }
.btn.sm { height: 32px; min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.confirm, .icon-btn.confirm { background: var(--bad); border-color: var(--bad); color: #FFFFFF; }
.link { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; transition: background-color 0.15s; }
.link:hover { background: var(--accent-soft); }
.icon-btn { height: 28px; padding: 0 9px; border: 0; border-radius: 8px; background: none; color: var(--text-3); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

form.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1 1 150px; }
.field.grow { flex: 3 1 220px; }
.field.tight { flex: 0 1 140px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], input[type="search"], select, textarea {
  width: 100%; height: var(--h); padding: 0 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask input:focus { box-shadow: none; }

.seg { display: inline-flex; height: var(--h); padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); }
.seg label { display: flex; align-items: center; padding: 0 14px; border-radius: 7px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

.chk { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background-color 0.15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.box { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; flex: none; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface) center / 70% no-repeat; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.box:hover { border-color: var(--accent); }
.box:checked { background-color: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><path d='m5 12.5 4.5 4.5L19 7.5'/></svg>"); }

/* списки */
ul.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.list li { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 0; border-top: 1px solid var(--border); }
ul.list li:first-child { border-top: 0; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li-title { font-weight: 600; overflow-wrap: anywhere; }
.li-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--text-2); font-size: 12.5px; }
.done .li-title { text-decoration: line-through; color: var(--text-3); }
.amt { font-weight: 650; white-space: nowrap; }
.amt.in { color: var(--good); }
.empty { color: var(--text-2); padding: 6px 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fbtn { height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
.fbtn:hover { color: var(--text); }
.fbtn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }

/* привычки */
.hab-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.hab-row:first-child { border-top: 0; }
.habit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px 0; border-top: 1px solid var(--border); }
.habit:first-child { border-top: 0; padding-top: 0; }
.days { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; }
.day { aspect-ratio: 1; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text-3); font-size: 11.5px; font-weight: 650; cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
.day:hover { border-color: var(--accent); }
.day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.day.today { border: 2px solid var(--text); }
@media (max-width: 560px) { .days { gap: 3px; } .day { border-radius: 6px; font-size: 10px; } }

/* цели */
.rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.ring-card { align-items: stretch; gap: 12px; }
.ring-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ring { position: relative; width: 112px; height: 112px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .arc { transition: stroke-dashoffset 0.6s ease; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.ring-name { text-align: center; font-weight: 650; overflow-wrap: anywhere; }
.ring-sub { text-align: center; color: var(--text-2); font-size: 12.5px; }
.ring-upd { display: flex; gap: 6px; }
.ring-upd input { height: 32px; }
.add-card { align-items: center; justify-content: center; min-height: 260px; text-align: center; color: var(--text-2); border-style: dashed; background: none; cursor: pointer; font: inherit; transition: border-color 0.15s, color 0.15s; }
.add-card:hover { border-color: var(--accent); color: var(--accent); }
.add-card .ico { width: 40px; height: 40px; }
.mini-goal { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.mini-goal:first-child { border-top: 0; }
.mini-goal .ring { width: 46px; height: 46px; margin: 0; flex: none; }
.mini-goal .ring b { font-size: 11px; }

/* заметки */
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.note { gap: 8px; }
.note.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.note h3 { overflow-wrap: anywhere; }
.note .body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.note .body.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; color: var(--text-3); font-size: 12px; }

/* графики */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.tip { position: absolute; z-index: 2; transform: translate(-50%, -100%); padding: 9px 12px; border-radius: var(--r-sm); background: var(--text); color: var(--surface); font-size: 12.5px; line-height: 1.6; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-pop); }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.catbars { display: flex; flex-direction: column; gap: 12px; }
.catbar { display: grid; grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.catbar > span:first-child { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catbar .track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.catbar .track i { display: block; height: 100%; min-width: 3px; border-radius: 4px; background: var(--exp); }
@media (max-width: 560px) { .catbar { grid-template-columns: minmax(70px, 100px) minmax(0, 1fr) auto; } }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { color: var(--text-3); font-size: 12px; font-weight: 650; }
td.r, th.r { text-align: right; }

/* расходы: чат */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 220px; max-height: 460px; overflow-y: auto; padding: 2px; }
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-radius: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.cl { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg.new { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } }
.txcard { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); white-space: normal; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.chipbtn:hover { border-color: var(--accent); background: var(--accent-soft); }
.chipbtn.ghost { color: var(--text-2); }
.chat-in { display: flex; gap: 8px; }
.chat-in input { flex: 1; min-width: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
select.catsel { width: auto; max-width: 160px; height: 32px; padding: 0 8px; font-size: 13px; flex: none; }
.bars rect.bar { fill: var(--exp); }
.bars rect.bar.today { fill: var(--accent); }
@media (max-width: 560px) { #s-list li { flex-wrap: wrap; } .msg { max-width: 96%; } }

.toast { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--r-sm); background: var(--text); color: var(--surface); font-weight: 600; box-shadow: var(--shadow-pop); animation: fade 0.15s ease; }
@media (max-width: 860px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); } }

/* вход */
.login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.login .brand { padding: 0 0 6px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
