/* Aven — Visual Prototype. Только для UX/продуктового проектирования. Не production. */

:root {
  --bg: #f4f5fa;
  --panel: #ffffff;
  --panel-2: #fafbff;
  --text: #191c26;
  --muted: #6b7280;
  --border: #e6e8ef;
  --accent: #5a5fd8;
  --accent-strong: #4a4fc9;
  --accent-soft: #eeeefc;
  --accent-text: #ffffff;
  --ok: #17966b;
  --ok-soft: #e2f6ee;
  --warn: #b26a00;
  --warn-soft: #fdf0dc;
  --danger: #cf3f4f;
  --danger-soft: #fde9ec;
  --shadow: 0 1px 2px rgba(16, 18, 33, .05), 0 8px 24px rgba(16, 18, 33, .06);
  --shadow-lg: 0 12px 40px rgba(16, 18, 33, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --topbar-h: 62px;
  /* glow за персонажем (CSS, не часть PNG); адаптируется под тему */
  --char-glow: rgba(90, 95, 216, .16);
  --char-glow-strong: rgba(90, 95, 216, .30);
  --char-glow-listen: rgba(23, 150, 107, .18);
}
html[data-theme="dark"] {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1c202c;
  --text: #e8eaf2;
  --muted: #9aa1b3;
  --border: #262b3a;
  --accent: #7b80f0;
  --accent-strong: #8f93f5;
  --accent-soft: #23263d;
  --accent-text: #0d0e14;
  --ok: #34c08c;
  --ok-soft: #12301f;
  --warn: #e0a23c;
  --warn-soft: #322511;
  --danger: #e5626f;
  --danger-soft: #34161b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --char-glow: rgba(123, 128, 240, .20);
  --char-glow-strong: rgba(123, 128, 240, .36);
  --char-glow-listen: rgba(52, 192, 140, .20);
}
html.reduce-motion * { transition: none !important; animation: none !important; }

* { box-sizing: border-box; }
html { font-size: 16px; }
html.text-sm { font-size: 14px; }
html.text-lg { font-size: 17.5px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 14px;
  font-weight: 700; font-size: 1.15rem; letter-spacing: .2px;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #6a5df0, #4a7cf0);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(90, 95, 216, .35);
}
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.side-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; font-size: .95rem;
  transition: background .15s;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
html[data-theme="dark"] .nav-item.active { color: var(--accent-strong); }
.nav-item .ico { width: 22px; text-align: center; font-size: 1.05rem; }
.side-bottom { border-top: 1px solid var(--border); padding: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 700; font-size: 1.08rem; flex: 1; }
.demo-badge {
  font-size: .7rem; font-weight: 700; letter-spacing: 1px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid transparent; border-radius: 999px; padding: 4px 10px;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel);
  cursor: pointer; font-size: 1rem; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--panel-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #f0a05a, #e05a7a);
  color: #fff; font-weight: 700; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
}
.content { padding: 26px; max-width: 1220px; width: 100%; margin: 0 auto; }

body.assistant-mode .sidebar, body.assistant-mode .topbar { display: none; }
body.assistant-mode .content { padding: 0; max-width: none; }

/* ---------- Common components ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: .92rem; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px;
}
.card h3 { margin: 0 0 12px; font-size: 1rem; }
.card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.card .head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.home-grid .span-2 { grid-column: span 2; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); border-radius: 10px; padding: 8px 14px;
  cursor: pointer; font-size: .92rem; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: .84rem; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="password"], input[type="search"], input[type="email"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2); color: var(--text);
  font: inherit; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 5px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 999px; cursor: pointer; transition: background .2s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: none; background: none; cursor: pointer;
  padding: 9px 14px; color: var(--muted); font-size: .93rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tab .cnt { font-size: .75rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }

/* pills / badges */
.pill { display: inline-block; font-size: .76rem; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* table */
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* list rows */
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.row-item:last-child { border-bottom: none; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-weight: 600; }
.row-item .s { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; width: 52px; flex: 0 0 52px; }

/* checkbox rows */
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.check-row:last-child { border-bottom: none; }
.check-row .label { flex: 1; }
.check-row.done .label { text-decoration: line-through; color: var(--muted); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 24, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 16px 16px; z-index: 100; backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 84vh; overflow: auto;
  animation: slideUp .18s ease;
}
.modal.wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-head h3 { margin: 0; font-size: 1.08rem; }
.modal-body { padding: 14px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* toast */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--text); color: var(--bg);
  border-radius: 12px; padding: 11px 16px; font-size: .9rem;
  box-shadow: var(--shadow-lg); animation: slideUp .2s ease;
  max-width: 340px;
}

/* stat card */
.stat { padding: 16px; }
.stat .v { font-size: 1.5rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .84rem; }
.stat .d { font-size: .82rem; margin-top: 6px; color: var(--muted); }

/* home */
/* ---------- hero с персонажем Female Aven (FINAL 2D master, transparent) ----------
   Персонаж — часть интерфейса: без рамки и прямоугольного фона; glow/круги/waveform
   рисует CSS под персонажем (НЕ часть PNG). Персонаж отключён → hero во всю ширину. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 37%, 430px);
  grid-template-areas: "top char" "interact char";
  gap: 4px 30px;
  align-items: start;
  margin-bottom: 18px;
  position: relative;
}
.hero.no-char { grid-template-columns: 1fr; grid-template-areas: "top" "interact"; }
.hero-top { grid-area: top; }
.hero-interact { grid-area: interact; min-width: 0; }
.hero h1 { margin: 0 0 4px; font-size: 1.7rem; }
.hero-sign { color: var(--muted); font-size: .84rem; margin-bottom: 8px; }
.hero-state-row { margin: 0 0 10px; }
.aven-state { font-size: .86rem; font-weight: 600; color: var(--muted); letter-spacing: .2px; }
.aven-state[data-state="listening"] { color: var(--ok); }
.aven-state[data-state="thinking"] { color: var(--accent); }
.aven-state[data-state="speaking"] { color: var(--accent); }
.aven-state[data-state="preparing"] { color: var(--accent); animation: aven-prep 1.2s ease-in-out infinite; }
@keyframes aven-prep { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
html.reduce-motion .aven-state[data-state="preparing"] { animation: none; }
.aven-state[data-state="waiting"] { color: var(--warn); }
.aven-state[data-state="success"] { color: var(--ok); }
.aven-state[data-state="important"] { color: var(--danger); }
.hero-ask { font-size: 1.06rem; font-weight: 600; margin: 0 0 8px; }
.cmdbar { display: flex; gap: 8px; margin: 0 0 10px; }
.cmdbar input { flex: 1; height: 48px; font-size: 1.02rem; border-radius: 13px; }
.cmdbar .mic { width: 48px; height: 48px; border-radius: 13px; font-size: 1.2rem; flex: 0 0 48px; }
.cmdbar .go { width: 48px; height: 48px; border-radius: 13px; font-size: 1.15rem; flex: 0 0 48px; }
.hero-sugg { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.hero-sugg[hidden] { display: none; }
.hero-last { color: var(--muted); font-size: .88rem; line-height: 1.45; min-height: 1.2em; margin: 0 0 8px; max-width: 62ch; }
.hero-next { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; margin: 0 0 10px; }
.hero-next b { color: var(--text); }
.hero-links { margin: 0; }

/* ---------- персонаж в hero ---------- */
.hero-char {
  grid-area: char;
  position: relative;
  align-self: stretch;
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  outline-offset: 6px;
}
.hero-char:focus-visible { outline: 2px solid var(--accent); border-radius: 18px; }
.hc-img {
  width: 100%;
  max-width: 430px;
  height: auto;
  display: block;
  position: relative;
  z-index: 2;
  /* естественное исчезновение бюста у нижней границы hero */
  -webkit-mask-image: linear-gradient(to bottom, #000 76%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 76%, transparent 99%);
  filter: drop-shadow(0 8px 26px rgba(16, 18, 33, .16));
}
html[data-theme="dark"] .hc-img { filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .5)); }
.hc-glow {
  position: absolute;
  inset: 6% 2% -4% 2%;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--char-glow), transparent 72%);
  transition: background .45s ease, opacity .45s ease;
  pointer-events: none;
}
.hero[data-state="speaking"] .hc-glow {
  background: radial-gradient(closest-side, var(--char-glow-strong), transparent 75%);
  animation: hc-breathe 2.4s ease-in-out infinite;
}
.hero[data-state="listening"] .hc-glow {
  background: radial-gradient(closest-side, var(--char-glow-listen), transparent 75%);
}
@keyframes hc-breathe { 0%, 100% { opacity: .95; } 50% { opacity: .55; } }
.hc-ring {
  position: absolute;
  z-index: 1;
  border: 1px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
}
.hc-ring.r1 { width: 82%; aspect-ratio: 1; left: 9%; bottom: -10%; opacity: .10; }
.hc-ring.r2 { width: 58%; aspect-ratio: 1; left: 21%; bottom: 0%; opacity: .07; }
.hc-wave {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  display: none;
  gap: 4px;
  align-items: flex-end;
  height: 26px;
  pointer-events: none;
}
.hero[data-state="speaking"] .hc-wave,
.hero[data-state="listening"] .hc-wave { display: flex; }
.hc-wave i { width: 4px; height: 30%; background: var(--accent); border-radius: 2px; opacity: .85; }
.hero[data-state="listening"] .hc-wave i { background: var(--ok); }
.hero[data-state="speaking"] .hc-wave i { animation: hc-eq 1s ease-in-out infinite; }
.hero[data-state="listening"] .hc-wave i { animation: hc-eq 1.7s ease-in-out infinite; }
.hc-wave i:nth-child(2) { animation-delay: .12s; }
.hc-wave i:nth-child(3) { animation-delay: .24s; }
.hc-wave i:nth-child(4) { animation-delay: .36s; }
.hc-wave i:nth-child(5) { animation-delay: .48s; }
@keyframes hc-eq { 0%, 100% { height: 25%; } 50% { height: 95%; } }
html.reduce-motion .hc-glow,
html.reduce-motion .hc-wave i { animation: none !important; }
html.reduce-motion .hero[data-state="speaking"] .hc-wave i,
html.reduce-motion .hero[data-state="listening"] .hc-wave i { height: 60%; }

/* ---------- адаптив hero ---------- */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-areas: "top" "char" "interact";
    gap: 2px;
  }
  .hero.no-char { grid-template-areas: "top" "interact"; }
  .hero-char { min-height: 230px; max-height: 280px; }
  .hc-img { max-width: 300px; }
  .hc-ring.r1 { bottom: -16%; }
}

/* day / timeline */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 8px 0 8px 10px; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 16px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel);
}
.tl-item.task::before { background: var(--ok); }
.tl-item.done::before { background: var(--muted); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; color: var(--muted); font-size: .78rem; padding: 4px 0; }
.cal-cell {
  min-height: 86px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; font-size: .85rem;
}
.cal-cell.other { opacity: .38; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-day-num { font-weight: 600; font-size: .8rem; margin-bottom: 4px; }
.cal-ev {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 6px; padding: 2px 6px; margin-bottom: 3px;
  font-size: .74rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-theme="dark"] .cal-ev { color: var(--accent-strong); }

/* notes */
.notes-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.note-li { padding: 11px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.note-li:hover { background: var(--panel-2); }
.note-li.active { background: var(--accent-soft); border-color: transparent; }
.note-li .nt { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.note-li .np { color: var(--muted); font-size: .8rem; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.note-body { white-space: pre-wrap; line-height: 1.55; }

/* finance */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 10px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 70%; max-width: 46px; background: var(--accent); opacity: .85; border-radius: 7px 7px 3px 3px; transition: height .3s; }
.bar-wrap .bl { font-size: .74rem; color: var(--muted); }
.bar-wrap .bv { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-row { margin-bottom: 12px; }
.cat-row .cat-top { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 5px; }
.cat-bar { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; }
.cat-bar > div { height: 100%; background: var(--accent); border-radius: 999px; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* auto */
.car-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.car-emoji {
  width: 74px; height: 74px; border-radius: 18px; font-size: 2.1rem;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
}
.mileage { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* purchases */
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.shop-card { text-align: left; cursor: pointer; }
.shop-card .ph {
  height: 110px; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; margin-bottom: 12px;
}

/* tools */
.tools-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tool-card { cursor: pointer; text-align: left; }
.tool-card .ph { font-size: 1.7rem; margin-bottom: 8px; }
.tool-card .tt { font-weight: 600; }
.tool-card .td { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.tool-out {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88rem; white-space: pre-wrap; word-break: break-all; min-height: 44px;
}
.diff-del { background: var(--danger-soft); }
.diff-add { background: var(--ok-soft); }

/* assistant */
.assistant {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg); display: flex; flex-direction: column;
  align-items: center; padding: 34px 16px;
}
.assistant .a-inner { width: 100%; max-width: 720px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.assistant .a-top { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.assistant .a-logo { text-align: center; margin: 4px 0 18px; }
.assistant .a-logo .mark { margin: 0 auto 10px; width: 52px; height: 52px; font-size: 1.5rem; }
.assistant .a-logo h1 { margin: 0; font-size: 1.5rem; }
.assistant .a-logo p { color: var(--muted); margin: 4px 0 0; }
.chat { flex: 1; overflow-y: auto; padding: 6px 4px 14px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 11px 15px; border-radius: 16px; line-height: 1.5; font-size: .97rem; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 5px; }
.msg.aven { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 5px; box-shadow: var(--shadow); }
.msg .speak {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel-2);
  border-radius: 8px; padding: 4px 10px; font-size: .8rem; cursor: pointer; color: var(--muted);
}
.msg .speak:hover { color: var(--accent); }
.msg .speak.playing { color: var(--accent); border-color: var(--accent); }
.a-input { display: flex; gap: 8px; padding-top: 10px; }
.a-input input { flex: 1; height: 50px; font-size: 1.02rem; border-radius: 14px; }
.a-input button { width: 50px; height: 50px; border-radius: 14px; font-size: 1.2rem; flex: 0 0 50px; }
.sugg { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 12px 0 2px; }

/* automation */
.auto-li { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.auto-li:last-child { border-bottom: none; }
.auto-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex: 0 0 42px; }
.canvas-preview { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.cnode {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow);
}
.cnode.trigger { border-color: var(--accent); color: var(--accent); }
.carrow { color: var(--muted); font-size: 1.05rem; }

/* settings */
.set-layout { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.set-nav .nav-item { padding: 8px 12px; font-size: .92rem; }
.set-h { margin: 0 0 4px; font-size: 1.25rem; }
.set-sub { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: none; }
.set-row .grow { flex: 1; }
.set-row .t { font-weight: 600; font-size: .95rem; }
.set-row .s { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.set-row select, .set-row input[type="number"] { width: 200px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row .val { width: 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .88rem; }
.mem-li { display: flex; align-items: flex-start; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--border); }

/* profile */
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-head .big { width: 72px; height: 72px; font-size: 1.7rem; }

/* empty */
.empty { color: var(--muted); text-align: center; padding: 28px 10px; font-size: .92rem; }

/* responsive */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .cols-4, .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: 100%; flex: none; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .side-scroll { display: flex; padding: 6px; }
  .side-group, .side-bottom { display: none; }
  .nav-item { white-space: nowrap; width: auto; }
  .notes-layout, .set-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; }
  .cols-2, .cols-3, .home-grid, .shop-grid, .tools-grid, .cols-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ---- Голос: движок речи / приватность / нормализация (TTS research, эксперимент) ---- */
.tts-note { font-size: .82rem; color: var(--muted); padding: 8px 4px; line-height: 1.45; }
.tts-note b { color: var(--text); }
.tts-priv { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.08)); margin: 6px 0; }
.tts-priv.warn { background: rgba(230, 160, 0, .12); }
.tts-norm { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; white-space: pre-wrap; color: var(--muted); margin-top: 6px; }
.pill.lic-yes { background: rgba(40, 170, 90, .15); color: var(--ok); }
.pill.lic-unclear { background: rgba(230, 160, 0, .15); color: var(--warn); }
.pill.lic-no { background: rgba(220, 60, 60, .13); color: var(--danger); }

/* ================= Срез Stage 1.0: аккаунт, история действий, админка =================
   Добавлено 2026-09-26 вместе с js/auth.js, js/history.js, js/admin.js.
   Спецификации: docs/MVP_SCOPE.md §4.1 (п.1, 9, 11), §5.1, §5.9; docs/ADMIN.md. */

.grow { flex: 1; min-width: 0; }

/* метки этапов в меню и настройках: честно показывают, что НЕ входит в срез 1.0 (MVP_SCOPE §4.3, §8) */
.stage-badge {
  margin-left: auto; font-size: .66rem; line-height: 1.5; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
  background: var(--surface-2, rgba(127, 127, 127, .08));
}
.stage-badge.next { color: var(--warn); border-color: var(--warn); }
.stage-badge.later { color: var(--muted); }

/* ---- экраны аккаунта: без сайдбара и топбара ---- */
body.auth-mode .sidebar,
body.auth-mode .topbar { display: none; }
body.auth-mode .main { width: 100%; }
body.auth-mode .content { max-width: 480px; padding: 0 16px; margin: 6vh auto; }
.auth-wrap { display: flex; justify-content: center; }
.auth-card { width: 100%; padding: 26px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.auth-title { font-size: 1.25rem; margin: 0 0 4px; }
.auth-sub { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.auth-body { display: flex; flex-direction: column; gap: 2px; }
.auth-body .btn.block { margin-top: 10px; }
.auth-field { margin-bottom: 10px; }
.auth-field > span:first-child { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.auth-field .s { display: block; font-size: .76rem; color: var(--muted); margin-top: 4px; }
.auth-field input { width: 100%; }
.auth-field.invalid input { border-color: var(--danger); }
.auth-err { display: block; color: var(--danger); font-size: .8rem; margin-top: 4px; }
.auth-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.auth-demo {
  margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border);
  color: var(--muted); font-size: .78rem; line-height: 1.5;
}

/* ---- история действий и Undo ---- */
.hist-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.hist-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.hist-item.undone { opacity: .6; }
.hist-item.undone .hist-object { text-decoration: line-through; }
.hist-ico { font-size: 1.15rem; line-height: 1.5; }
.hist-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .95rem; }
.hist-object { font-size: .88rem; margin-top: 3px; }
.hist-meta { color: var(--muted); font-size: .8rem; margin-top: 5px; }
.hist-meta code, .set-row code, .tbl code { font-size: .78rem; color: var(--muted); }
.hist-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.hist-filters { margin-top: 14px; }
.hist-filters .field { margin-bottom: 0; }
.hist-filters .field > span { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.hist-filters select, .hist-filters input { width: 100%; }
.hist-note { margin-top: 14px; }
.hist-note ul li { margin-bottom: 5px; }

/* ---- административная область ---- */
.adm-principle { margin-bottom: 14px; }
.adm-principle .set-row { border-bottom: none; padding: 4px; align-items: flex-start; }

/* ---- адаптивность новых экранов (вопрос №34: одна колонка на малых экранах) ---- */
@media (max-width: 860px) {
  body.auth-mode .content { margin: 3vh auto; }
  .hist-item { flex-wrap: wrap; }
  .hist-actions { flex-direction: row; width: 100%; align-items: center; }
  .hist-filters .field-row { flex-direction: column; gap: 10px; }
  .adm-principle .set-row { flex-direction: column; align-items: flex-start; }
  .tbl { display: block; overflow-x: auto; }
}
