/* Work-Life Manager — оформление.
   Один файл, без внешних зависимостей и шрифтов: страница должна открываться
   мгновенно даже с телефона в театре. */

/* ---------- палитра ---------- */

:root {
  --accent-h: 243;
  --accent-s: 62%;
  --accent-l: 56%;

  --accent: hsl(var(--accent-h) var(--accent-s) var(--accent-l));
  --accent-soft: hsl(var(--accent-h) var(--accent-s) var(--accent-l) / 0.12);
  --accent-line: hsl(var(--accent-h) var(--accent-s) var(--accent-l) / 0.32);
  --accent-ink: hsl(var(--accent-h) 45% 42%);

  --bg: hsl(240 20% 98%);
  --bg-sunk: hsl(240 18% 95%);
  --surface: #fff;
  --surface-2: hsl(240 24% 97%);
  --line: hsl(240 14% 89%);
  --line-soft: hsl(240 14% 93%);

  --ink: hsl(232 18% 12%);
  --ink-2: hsl(232 10% 38%);
  --ink-3: hsl(232 8% 55%);

  --danger: hsl(2 68% 52%);
  --danger-bg: hsl(2 78% 96%);
  --warn: hsl(36 82% 44%);
  --warn-bg: hsl(40 88% 95%);
  --info: hsl(206 72% 46%);
  --info-bg: hsl(206 80% 96%);
  --ok: hsl(152 46% 40%);
  --ok-bg: hsl(152 52% 95%);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px hsl(240 20% 10% / 0.04), 0 1px 3px hsl(240 20% 10% / 0.03);
  --shadow-2: 0 4px 14px hsl(240 20% 10% / 0.07), 0 1px 3px hsl(240 20% 10% / 0.04);

  --pad-y: 14px;
  --gap: 16px;
}

[data-accent="teal"]  { --accent-h: 176; --accent-s: 58%; --accent-l: 38%; }
[data-accent="amber"] { --accent-h: 34;  --accent-s: 78%; --accent-l: 48%; }
[data-accent="rose"]  { --accent-h: 342; --accent-s: 52%; --accent-l: 52%; }

[data-density="compact"] { --pad-y: 9px; --gap: 11px; }

[data-theme="dark"] {
  --bg: hsl(232 16% 9%);
  --bg-sunk: hsl(232 16% 7%);
  --surface: hsl(232 14% 12%);
  --surface-2: hsl(232 13% 15%);
  --line: hsl(232 10% 22%);
  --line-soft: hsl(232 10% 18%);

  --ink: hsl(228 22% 94%);
  --ink-2: hsl(228 12% 72%);
  --ink-3: hsl(228 9% 56%);

  --accent-l: 66%;
  --accent-soft: hsl(var(--accent-h) var(--accent-s) var(--accent-l) / 0.16);
  --accent-ink: hsl(var(--accent-h) 60% 74%);

  --danger: hsl(2 76% 68%);
  --danger-bg: hsl(2 40% 18%);
  --warn: hsl(38 84% 62%);
  --warn-bg: hsl(38 44% 16%);
  --info: hsl(206 76% 66%);
  --info-bg: hsl(206 44% 17%);
  --ok: hsl(152 46% 58%);
  --ok-bg: hsl(152 34% 15%);

  --shadow-1: 0 1px 2px hsl(0 0% 0% / 0.3);
  --shadow-2: 0 6px 20px hsl(0 0% 0% / 0.4);
}

/* ---------- база ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-feature-settings: "cv05", "ss01";
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: clamp(21px, 4.2vw, 27px); font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1160px, 100%); margin: 0 auto; padding: 0 clamp(14px, 3vw, 24px); }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0; z-index: 100;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- шапка ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: hsl(from var(--bg) h s l / 0.82);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
@supports not (background: hsl(from red h s l)) {
  .topbar { background: var(--bg); }
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 56px; }

.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 620; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(140deg, var(--accent), hsl(var(--accent-h) 70% 68%));
  box-shadow: inset 0 0 0 1px hsl(0 0% 100% / 0.18);
  flex: none;
}

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--ink-2); padding: 7px 12px; border-radius: 999px; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 550; }

.topbar-tools { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer; font-size: 14px; padding: 0; line-height: 1;
}
.icon-btn:hover { border-color: var(--accent-line); color: var(--ink); text-decoration: none; }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
[data-theme="light"] .icon-moon, [data-theme="dark"] .icon-sun { display: none; }

/* ---------- уведомления ---------- */

.flashes { display: grid; gap: 8px; margin: 20px 0 0; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 14px; font-size: 14px; box-shadow: var(--shadow-1);
}
.flash-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--ink-3); }
.flash-ok .flash-dot { background: var(--ok); }
.flash-error .flash-dot { background: var(--danger); }
.flash-warn .flash-dot { background: var(--warn); }

/* ---------- страница ---------- */

main { padding-bottom: 40px; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  flex-wrap: wrap; margin: 26px 0 20px;
}
.lead { color: var(--ink-2); max-width: 66ch; margin-top: 6px; font-size: 14.5px; }
.sub { color: var(--ink-3); font-size: 13.5px; }
.muted { color: var(--ink-3); }
.hint { color: var(--ink-3); font-size: 13px; margin-top: 10px; }
.nowrap { white-space: nowrap; }
.eyebrow {
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}

/* ---------- карточки-показатели ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 15px; box-shadow: var(--shadow-1);
}
.stat-num { font-size: 23px; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.stat-danger { border-color: hsl(from var(--danger) h s l / 0.4); }
.stat-danger .stat-num { color: var(--danger); }
.stat-warn .stat-num { color: var(--warn); }

/* ---------- панели ---------- */

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-1);
}
.panel > h2 { margin-bottom: 4px; }
.panel > h3 { margin: 22px 0 4px; }
.panel-quiet { background: var(--surface-2); box-shadow: none; }

/* ---------- формы ---------- */

input[type=text], input[type=number], input[type=time], input[type=file], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: var(--accent-line); }
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=file] { padding: 8px; cursor: pointer; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

.field-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-top: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.field > span { color: var(--ink-2); font-weight: 520; }
.field small { color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
.field-wide { grid-column: 1 / -1; }
.field-toggle {
  flex-direction: row; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer;
}
.field-toggle > span { font-weight: 450; }

.settings-form { padding-bottom: 70px; }
.actions-bar {
  position: sticky; bottom: 0; display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 0 max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}

/* ---------- кнопки ---------- */

button, .btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 520; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  transition: filter .15s, transform .08s, border-color .15s;
  text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.07); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn-ghost, .btn-quiet {
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn-ghost:hover, .btn-quiet:hover { border-color: var(--accent-line); filter: none; background: var(--surface-2); }
.btn-quiet { color: var(--ink-2); }
.btn-danger { background: transparent; border-color: hsl(from var(--danger) h s l / 0.4); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); filter: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- загрузка файлов ---------- */

.uploader { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 14px; }
.uploader input[type=file] { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .uploader { grid-template-columns: 2fr 1fr auto; }
  .uploader input[type=file] { grid-column: auto; }
}

/* ---------- фильтры ---------- */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select { width: auto; min-width: 150px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- таблица ---------- */

.table-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-1);
}
.table-scroll { overflow-x: auto; }
.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.grid th {
  position: sticky; top: 56px; z-index: 2;
  background: var(--surface-2); color: var(--ink-2); text-align: left; white-space: nowrap;
  padding: 10px 14px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.grid td { padding: var(--pad-y) 14px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid tbody tr:first-child td { border-top: 0; }
.row-hard { box-shadow: inset 3px 0 0 var(--danger); }
.row-soft { box-shadow: inset 3px 0 0 var(--warn); }
.row-info { box-shadow: inset 3px 0 0 var(--info); }
.cell-strong { font-weight: 520; }
.cell-time { font-variant-numeric: tabular-nums; }
.note { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.empty { text-align: center; color: var(--ink-3); padding: 44px 20px; }

.conflict-cell { max-width: 320px; }
.conflict-mini { font-size: 12.5px; color: var(--ink-2); padding-left: 9px; border-left: 2px solid var(--line); margin-bottom: 4px; }
.conflict-mini.is-hard { border-color: var(--danger); }
.conflict-mini.is-soft { border-color: var(--warn); }
.conflict-mini.is-info { border-color: var(--info); }

/* ---------- метки ---------- */

.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 520; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-soft);
}
.tag-concert, .tag-performance { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag-runthrough { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag-soundcheck { background: var(--info-bg); color: var(--info); border-color: transparent; }
.tag-travel { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.tag-content { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tag-q { background: var(--warn-bg); color: var(--warn); border-color: transparent; font-weight: 600; }
.badge-cross { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* ---------- конфликты ---------- */

.conflict-list { display: grid; gap: 10px; }
.conflict-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; box-shadow: var(--shadow-1); border-left: 3px solid var(--ink-3);
}
.conflict-card.is-hard { border-left-color: var(--danger); }
.conflict-card.is-soft { border-left-color: var(--warn); }
.conflict-card.is-info { border-left-color: var(--info); }
.conflict-head { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 7px; }
.conflict-date { font-weight: 600; }
.conflict-reason { font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.conflict-pair { display: grid; gap: 9px; align-items: stretch; }
@media (min-width: 720px) { .conflict-pair { grid-template-columns: 1fr auto 1fr; align-items: center; } }
.conflict-ev { background: var(--surface-2); border-radius: var(--r-md); padding: 11px 13px; font-size: 13.5px; }
.conflict-vs { color: var(--ink-3); font-size: 11.5px; text-align: center; text-transform: uppercase; letter-spacing: .07em; }

/* ---------- план дня ---------- */

.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin: 26px 0 6px; }
.day-line {
  color: var(--ink-2); font-size: 14.5px; margin: 10px 0 20px;
  padding-left: 12px; border-left: 2px solid var(--accent-line);
}
.day-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.day-nav select { width: auto; }

.timeline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.tl-item {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: baseline;
  padding: var(--pad-y) 16px; border-top: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
}
.tl-item:first-child { border-top: 0; }
.tl-time { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.tl-title { font-weight: 500; }
.tl-detail { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.tl-min { color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tl-work { border-left-color: var(--accent); background: var(--accent-soft); }
.tl-work .tl-title { font-weight: 620; }
.tl-practice { border-left-color: hsl(266 52% 60%); }
.tl-meal { border-left-color: hsl(28 72% 55%); }
.tl-study { border-left-color: hsl(152 46% 45%); }
.tl-reading { border-left-color: hsl(198 62% 48%); }
.tl-sport { border-left-color: hsl(6 66% 58%); }
.tl-family { border-left-color: hsl(320 48% 58%); }
.tl-routine { border-left-color: var(--line); color: var(--ink-3); }
.tl-routine .tl-title { font-weight: 420; color: var(--ink-3); }

.warn-box {
  background: var(--warn-bg); border: 1px solid hsl(from var(--warn) h s l / 0.28);
  border-radius: var(--r-md); padding: 13px 16px; margin-bottom: 16px;
  font-size: 13.5px; display: grid; gap: 5px; color: var(--ink);
}
.warn-box b { font-weight: 600; }

.summary-strip {
  display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 11px 15px; margin-bottom: 16px; font-size: 13px; color: var(--ink-2);
}
.summary-strip b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.empty-box {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg);
  padding: 48px 24px; text-align: center; color: var(--ink-3);
}

/* ---------- нижняя навигация (телефон) ---------- */

.tabbar { display: none; }

@media (max-width: 780px) {
  .nav, .topbar-tools .icon-btn[href] { display: none; }
  .grid th { top: 0; }

  .tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: hsl(from var(--surface) h s l / 0.94);
    backdrop-filter: blur(14px) saturate(1.5);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 2px 7px; font-size: 10.5px; color: var(--ink-3);
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.is-active { color: var(--accent-ink); }
  .tab-ico { font-size: 16px; line-height: 1.1; }

  body { padding-bottom: 62px; }
  main { padding-bottom: 20px; }
  .actions-bar { bottom: 58px; }
  .foot { padding-bottom: 76px; }
}

/* Таблица на телефоне превращается в карточки. */
@media (max-width: 640px) {
  .table-card { border: 0; background: transparent; box-shadow: none; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    margin-bottom: 9px; padding: 11px 13px; box-shadow: var(--shadow-1);
    position: relative;
  }
  .grid td { border: 0; padding: 2px 0; }
  .grid td::before {
    content: attr(data-label) " "; color: var(--ink-3); font-size: 12px;
  }
  .grid td:empty { display: none; }
  .conflict-cell { max-width: none; }
  .tl-item { grid-template-columns: 78px 1fr; }
  .tl-min { display: none; }
}

/* ---------- подвал ---------- */

.foot {
  color: var(--ink-3); font-size: 12.5px; padding: 30px 0 44px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.foot-sep { opacity: .5; }

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

/* ---------- ассистент на главной ---------- */

.hero {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 22px; margin: 24px 0 30px; box-shadow: var(--shadow-2);
}
.hero-glow {
  position: absolute; inset: -40% 30% auto -10%; height: 320px; pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  filter: blur(6px);
}
.hero > *:not(.hero-glow) { position: relative; }
.hero-top { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 18px; }
.hero-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none; margin-top: 2px;
  background: linear-gradient(150deg, var(--accent), hsl(var(--accent-h) 70% 62%));
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.hero-title { font-size: clamp(20px, 3.4vw, 27px); line-height: 1.25; margin: 2px 0 0; }
.hero-tune { margin-left: auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.hero-tune:hover { color: var(--accent-ink); }
@media (max-width: 560px) {
  .hero-top { flex-wrap: wrap; }
  .hero-top > div { flex: 1 1 100%; order: 2; }
  .hero-tune { order: 1; margin-left: auto; }
}

.chat-log { display: none; gap: 10px; margin-bottom: 16px; }
.hero.has-chat .chat-log {
  display: grid; max-height: 46vh; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin;
}
.bubble {
  padding: 11px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.55;
  white-space: pre-line; max-width: min(46em, 92%);
  animation: bubble-in .22s ease-out both;
}
.bubble-bot { background: var(--surface-2); border: 1px solid var(--line-soft); justify-self: start; border-bottom-left-radius: 6px; }
.bubble-me { background: var(--accent); color: #fff; justify-self: end; border-bottom-right-radius: 6px; }
.bubble.is-typing::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  background: var(--accent); vertical-align: -2px; animation: caret 1s steps(1) infinite;
}
.bubble.is-thinking { display: flex; gap: 5px; align-items: center; padding: 15px; }
.bubble.is-thinking span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3);
  animation: thinking 1.15s ease-in-out infinite;
}
.bubble.is-thinking span:nth-child(2) { animation-delay: .16s; }
.bubble.is-thinking span:nth-child(3) { animation-delay: .32s; }

@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes thinking {
  0%, 70%, 100% { opacity: .3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.chat-form { position: relative; display: flex; }
.chat-form input {
  flex: 1; padding: 14px 54px 14px 18px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 15px;
}
.chat-form input:focus { background: var(--surface); }
.chat-send {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 17px; line-height: 1;
}
.chat-send:active { transform: translateY(-50%) scale(.94); }
.chat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.chat-chips .chip { cursor: pointer; font-size: 13px; padding: 7px 13px; }
.chat-chips .chip:hover { border-color: var(--accent-line); color: var(--accent-ink); }

.section-head { margin: 30px 0 14px; }
.section-head h2 { margin: 0 0 4px; }

/* чат в конструкторе — тот же язык, но компактнее и в рамке панели */
.try-panel .chat-log {
  display: grid; margin-top: 14px; background: var(--surface-2);
  border-radius: var(--r-md); padding: 12px; max-height: 300px; overflow-y: auto;
}
.try-panel .chat-log:empty { display: none; }
.try-panel .bubble-bot { background: var(--surface); border-color: var(--line); }
.try-panel .chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.try-panel .chat-form input { padding: 10px 16px; }
.bubble-rule { display: block; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }

/* ---------- занятия: библиотека ---------- */

.role-tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 560; white-space: nowrap; margin-right: 6px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-soft);
}
.role-warmup { background: var(--info-bg); color: var(--info); border-color: transparent; }
.role-technique { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.role-etude { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.role-cantilena { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.role-piece { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.role-orchestra { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line-soft); margin-left: 6px;
}
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

.preview-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 12px; }
.preview-day { background: var(--surface-2); border-radius: var(--r-md); padding: 11px 13px; }
.preview-date { font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.preview-list { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 13px; }
.preview-empty { color: var(--ink-3); font-size: 13px; }

.lib-row {
  display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line-soft);
  grid-template-columns: 1fr auto;
}
.lib-row:first-of-type { border-top: 0; }
.lib-row.is-off { opacity: .55; }
.lib-title { font-weight: 540; }
.lib-current { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.lib-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.lib-bar { height: 4px; background: var(--line-soft); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.lib-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.lib-actions form { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-edit { grid-column: 1 / -1; }
.lib-edit summary { cursor: pointer; color: var(--ink-3); font-size: 13px; }
.lib-add { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 4px; }

.grid-form {
  display: grid; gap: 12px; margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.grid-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form .check { flex-direction: row; align-items: center; gap: 8px; }
.grid-form textarea { font: inherit; }
.tl-mark { display: flex; gap: 6px; margin-top: 7px; }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: 8px; }

/* ---------- конструктор правил ---------- */

.builder { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 20px; }
@media (min-width: 900px) { .builder { grid-template-columns: 280px 1fr; align-items: start; } }

.palette {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-1); position: sticky; top: 70px;
  max-height: calc(100vh - 90px); overflow-y: auto;
}
.palette h2 { font-size: 14px; margin: 20px 0 10px; }
.palette h2:first-child { margin-top: 0; }
.palette h2 + * { margin-top: 0; }
.pal-block {
  border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 8px; cursor: grab;
  font-size: 13.5px; color: #fff; border: 0; user-select: none;
}
.pal-block em { font-style: normal; opacity: .8; }
.pal-trigger { background: hsl(206 62% 46%); }
.pal-condition { background: hsl(36 74% 44%); }
.pal-response { background: hsl(266 46% 52%); }
.pal-block:active { cursor: grabbing; }

.var-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 14px 0 6px; }
.var-chip {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 5px 11px; margin-bottom: 5px; font-size: 12.5px; cursor: grab;
}
.var-chip:hover { border-color: var(--accent-line); }
.var-value { color: var(--ink-3); font-variant-numeric: tabular-nums; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.canvas-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.canvas-head .inline { display: inline; }
.save-state { font-size: 12.5px; color: var(--ink-3); }
.save-state.is-dirty { color: var(--warn); }
.save-state.is-ok { color: var(--ok); }
.save-state.is-err { color: var(--danger); }

.rule {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-1);
}
.rule.is-active { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.rule.is-drop { border-style: dashed; border-color: var(--accent); }
.rule-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rule-name { flex: 1 1 200px; font-weight: 560; }
.rule-prio { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.rule-prio input { width: 68px; }
.rule-tools { display: flex; gap: 4px; margin-left: auto; }
.rule-body { display: grid; gap: 8px; margin: 12px 0; }
.rule-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.rule-foot .check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.rule-foot select { width: auto; }
.rule-hint { font-size: 12px; color: var(--ink-3); }

.block {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  border-radius: var(--r-md); padding: 9px 11px; font-size: 13.5px;
  border-left: 4px solid transparent; background: var(--surface-2);
}
.block-trigger { border-left-color: hsl(206 62% 46%); }
.block-condition { border-left-color: hsl(36 74% 44%); }
.block-response { border-left-color: hsl(266 46% 52%); }
.block-lead { color: var(--ink-2); font-weight: 540; white-space: nowrap; }
.block-input { flex: 1 1 160px; width: auto; }
.block select { width: auto; }
.block-text { flex: 1 1 260px; font: inherit; min-height: 64px; resize: vertical; }
.block-text.is-target { outline: 2px dashed var(--accent); }
.block-x { background: transparent; border: 0; color: var(--ink-3); padding: 2px 6px; cursor: pointer; }
.block-x:hover { color: var(--danger); filter: none; }
.block-empty { font-size: 13px; color: var(--ink-3); padding: 8px 2px; }
.try-panel { margin-top: 20px; }

/* ---------- вторая версия: наставники, голос, чек-лист, письма, интеграции ---------- */

.chat-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
.voice-tools { display: flex; gap: 8px; margin-top: 13px; }
.chip-voice { font-size: 13px; padding: 7px 13px; cursor: pointer; }
.chip-voice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.mic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
#mic-btn[aria-pressed="true"] .mic-dot { background: var(--danger); animation: thinking 1s ease-in-out infinite; }

.mentor-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip-mentor { cursor: pointer; font-size: 13px; padding: 7px 13px; }
.chip-mentor[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip-mentor:hover { border-color: var(--accent-line); }
.hint-tight { margin-top: 12px; }

.bubble-ai { position: relative; border-color: var(--accent-line); }
.bubble-ai::before {
  content: attr(data-who); display: block; font-size: 11px; letter-spacing: .02em;
  text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px; font-weight: 600;
}

.adjust-box {
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-md);
  padding: 13px 16px; margin-bottom: 16px; font-size: 13.5px; display: grid; gap: 5px;
}
.adjust-head { font-weight: 600; color: var(--accent-ink); }
.adjust-list { display: grid; gap: 6px; margin-bottom: 10px; font-size: 13.5px; }
.inline-form { display: inline; }

/* чек-лист */
.review-list { display: grid; border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.review-row {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center;
  padding: var(--pad-y) 16px; border-top: 1px solid var(--line-soft);
}
.review-row:first-child { border-top: 0; }
.review-time { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 13px; }
.review-title { font-weight: 500; }
.review-detail { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.rating { display: flex; gap: 4px; }
.rate { position: relative; cursor: pointer; }
.rate input { position: absolute; opacity: 0; inset: 0; }
.rate span {
  display: inline-block; padding: 6px 11px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--surface);
}
.rate input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.rate-good input:checked + span { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.rate-medium input:checked + span { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.rate-skip input:checked + span { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.rate-energy input:checked + span { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.energy { display: flex; gap: 4px; }
.review-extra { display: grid; grid-template-columns: auto 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.review-form .actions-bar { margin-top: 14px; }
.rv-work .review-title::before { content: "♪ "; color: var(--accent-ink); }
@media (max-width: 640px) {
  .review-row { grid-template-columns: 1fr; gap: 6px; }
  .review-extra { grid-template-columns: 1fr; }
}

.bars { display: grid; gap: 8px; margin-top: 16px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-sunk); }
.bar-good { background: var(--ok); }
.bar-medium { background: var(--warn); }
.bar-skip { background: var(--danger); opacity: .8; }
.bar-note { grid-column: 2; color: var(--ink-3); font-size: 12px; }
.bar-note:empty { display: none; }

.advice-out { margin-top: 14px; display: grid; gap: 12px; }
.advice-changes { display: grid; gap: 8px; }
.advice-changes .chip { justify-self: start; }

.recent-days { display: grid; gap: 4px; }
.recent-day { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; color: inherit; text-decoration: none; border-top: 1px solid var(--line-soft); }
.recent-day:first-child { border-top: 0; }
.recent-date { color: var(--ink-3); font-size: 13px; min-width: 70px; }
.recent-score { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ok); }
.recent-score.is-low { color: var(--danger); }
.recent-note { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* письма */
.compose { display: grid; gap: var(--gap); }
.fields-help { margin-top: 12px; font-size: 13.5px; }
.fields-help summary { cursor: pointer; color: var(--ink-2); }
.fields-help .var-group { margin-top: 10px; }
.steps { padding-left: 20px; margin: 10px 0 0; display: grid; gap: 6px; }
.steps code, .fields-help code { background: var(--bg-sunk); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
.ev-pick { display: grid; max-height: 320px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.ev-row { display: grid; grid-template-columns: auto 150px 1fr; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line-soft); font-size: 13.5px; cursor: pointer; }
.ev-row:first-child { border-top: 0; }
.ev-row:has(input:checked) { background: var(--accent-soft); }
.ev-row .ev-meta { grid-column: 3; font-size: 12px; }
.ev-date { font-variant-numeric: tabular-nums; color: var(--ink-2); }
@media (max-width: 640px) { .ev-row { grid-template-columns: auto 1fr; } .ev-row .ev-meta, .ev-row .ev-title { grid-column: 2; } }
.contact-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.contact-pick .chip { cursor: pointer; }
.contact-pick input { margin: 0; }
.messages-out { display: grid; gap: 14px; margin-top: 14px; }
.msg-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-1); }
.msg-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.msg-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg-brief { width: 260px; max-width: 100%; padding: 6px 10px; font-size: 13px; }
.msg-text { width: 100%; font: inherit; font-size: 14px; line-height: 1.5; }
.lib-rows { display: grid; }

/* A calm workspace: conversation first, the full day beside it. */
.welcome-row { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:34px 0 24px; }
.welcome-row h1 { font-size:clamp(26px,4vw,38px); font-weight:600; margin-top:7px; }
.hero-glow { opacity:.35; }
.hero-title { font-size:25px; }
.hero-top { margin-bottom:10px; }
.hero-tune { font-size:14px; }
.bubble { font-size:15px; overflow-wrap:anywhere; }
summary { cursor:pointer; color:var(--ink-2); font-weight:550; padding:10px 0; }
.day-column { background:var(--surface); border:1px solid var(--line); border-radius:24px; padding:22px; margin-top:28px; }
.tl-body { min-width:0; }
.day-column .day-head { margin:0 0 20px; }
.day-column h1 { font-size:22px; }
.day-column .stats { grid-template-columns:1fr 1fr; gap:8px; }
.day-column .stat { padding:12px; }
.day-column .stat-num { font-size:23px; }
.day-column .day-nav { gap:5px; }
.day-column .tl-item { grid-template-columns:76px minmax(0,1fr); gap:10px; }
.day-column .tl-min { display:block; grid-column:2; font-size:12px; margin-top:-8px; }
.day-column .tl-detail { overflow-wrap:anywhere; }
.week-details { margin-bottom:14px; }
.destination-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-bottom:24px; }
.destination { position:relative; display:flex; flex-direction:column; gap:7px; padding:24px 44px 24px 24px; background:var(--surface); border:1px solid var(--line); border-radius:18px; color:var(--ink); }
.destination:hover { border-color:var(--accent); text-decoration:none; }
.destination strong { font-size:18px; }
.destination span { color:var(--ink-2); }
.destination b { position:absolute; right:20px; top:24px; color:var(--accent-ink); }
.quick-links { display:flex; gap:10px; flex-wrap:wrap; margin:0 0 24px; }
.memory-note { display:flex; align-items:start; justify-content:space-between; gap:20px; }
.memory-note p { white-space:pre-wrap; overflow-wrap:anywhere; }
.login-page { min-height:100dvh; display:grid; place-items:center; padding:24px; background:radial-gradient(ellipse at top left,var(--accent-soft),transparent 70%),var(--bg); }
.login-card { background:var(--surface); padding:clamp(24px,6vw,48px); border:1px solid var(--line); border-radius:28px; width:min(100%,460px); box-shadow:var(--shadow-2); }
.login-card h1 { margin:16px 0; font-size:32px; }
.login-card form { display:grid; gap:18px; margin:28px 0 16px; }
.login-card input { font-size:16px; }
#login-error { color:var(--danger); margin-top:16px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.file-list { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0; }
.file-chip { display:flex; align-items:center; gap:8px; min-width:0; max-width:100%; border:1px solid var(--line); border-radius:12px; padding:8px 10px; font-size:13px; background:var(--surface); }
.file-chip a { overflow-wrap:anywhere; }
.file-chip img { width:42px; height:42px; border-radius:6px; object-fit:cover; }
.file-chip button { flex-shrink:0; padding:4px 10px; }
.tool-steps { display:grid; gap:5px; font-size:13px; color:var(--ink-2); margin:6px 0 12px; }
.tool-steps div::before { content:'· '; color:var(--ink-3); }
.proposal-card { width:100%; min-width:0; border:1px solid var(--accent-line); background:var(--surface); border-radius:16px; padding:16px; margin:8px 0; }
.proposal-card h3 { color:var(--ink); font-size:16px; }
.proposal-changes { max-height:330px; overflow:auto; margin:12px 0; }
.proposal-change { border-top:1px solid var(--line); padding:12px 0; font-size:14px; white-space:pre-wrap; overflow-wrap:anywhere; }
.proposal-change small { display:block; color:var(--ink-2); margin-top:6px; }
.proposal-state { color:var(--accent-ink); font-size:14px; margin-top:10px; }
.proposal-state a { text-decoration:underline; }
button:disabled { opacity:.55; cursor:wait; }
input, select, textarea { max-width:100%; }
code { overflow-wrap:anywhere; }
@media (max-width:780px) {
  .welcome-row { margin:22px 0 18px; align-items:start; }
  .welcome-row > .btn { max-width:135px; text-align:center; font-size:13px; }
  .welcome-row .eyebrow { font-size:10px; }
  .day-column { padding:18px; border-radius:20px; }
  .destination-grid { grid-template-columns:1fr; }
  .destination { padding:20px 42px 20px 20px; }
  input, select, textarea { font-size:16px; }
  .btn, .icon-btn, .chip { min-height:44px; }
  .tabbar { background:var(--surface); }
  .tabbar a { min-height:56px; justify-content:center; font-size:10px; color:var(--ink-2); }
  body { padding-bottom:calc(70px + env(safe-area-inset-bottom)); }
  .actions-bar { bottom:calc(56px + env(safe-area-inset-bottom)); }
  .memory-note { flex-direction:column; }
  .day-column .tl-min { display:block; }
  .login-page { padding:20px; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }

/* ---------- чат: диалоги слева, лента и композер справа ---------- */
.chat-shell { display:grid; grid-template-columns:260px minmax(0,1fr); margin:0; padding:0; border-radius:24px; overflow:hidden; height:clamp(520px, 78dvh, 860px); box-shadow:var(--shadow-2); }
.chat-shell .hero-glow { inset:auto -10% -30% 40%; height:360px; opacity:.45; }
.dialogs { display:flex; flex-direction:column; min-height:0; border-right:1px solid var(--line-soft); background:var(--surface-2); padding:18px 12px 12px; }
.dialogs-head { display:flex; align-items:center; justify-content:space-between; padding:0 6px 10px; }
.dialogs-head .icon-btn { width:32px; height:32px; padding:0; font-size:20px; line-height:1; }
.dialogs-search { width:100%; border-radius:12px; padding:9px 12px; font-size:14px; background:var(--surface); }
.dialog-list { flex:1; min-height:0; overflow-y:auto; margin-top:10px; display:grid; gap:2px; align-content:start; scrollbar-width:thin; }
.dialog { display:flex; align-items:center; border-radius:10px; min-width:0; }
.dialog:hover, .dialog.is-active { background:var(--surface); }
.dialog-open:hover, .dialog-more:hover, .starter:hover, .composer-btn:hover, .composer-send:hover, .dialog-menu > *:hover { filter:none; transform:none; }
.dialog.is-active { box-shadow:inset 3px 0 0 var(--accent); }
.dialog-open { flex:1; min-width:0; display:block; justify-content:flex-start; font-weight:500; text-align:left; background:none; border:0; padding:10px 6px 10px 12px; font:inherit; font-size:14.5px; color:var(--ink); cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dialog-more { flex:none; display:block; background:none; border:0; color:var(--ink-3); font-size:15px; letter-spacing:1px; padding:8px 10px; cursor:pointer; border-radius:8px; opacity:0; }
.dialog:hover .dialog-more, .dialog.is-active .dialog-more, .dialog-more:focus-visible { opacity:1; }
.dialog-more:hover { color:var(--ink); background:var(--surface-2); }
.dialog-none { padding:12px; }
.chat-shell > .dialog-menu[hidden] { display:none; }
.chat-shell > .dialog-menu { position:absolute; z-index:5; min-width:190px; display:grid; padding:6px; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow-2); }
.dialog-menu > * { display:block; justify-content:flex-start; font-weight:500; text-align:left; background:none; border:0; padding:9px 12px; border-radius:8px; font:inherit; font-size:14px; color:var(--ink); cursor:pointer; }
.dialog-menu > *:hover { background:var(--surface-2); text-decoration:none; }
.dialog-menu .is-danger { color:var(--danger); }
.chat-main { display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; padding:18px 22px 16px; position:relative; }
.chat-head { display:flex; align-items:center; gap:12px; padding-bottom:14px; border-bottom:1px solid var(--line-soft); }
.chat-head .hero-mark { margin:0; width:36px; height:36px; }
.chat-head-text { flex:1; min-width:0; }
.chat-title { font-weight:600; font-size:17px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#chat-status { margin:2px 0 0; min-height:18px; font-size:12.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-head .icon-btn { width:36px; height:36px; font-size:16px; }
.balance-pill { display:inline-flex; align-items:center; height:32px; padding:0 12px; border-radius:999px; background:var(--surface-2); border:1px solid var(--line-soft); color:var(--ink-2); font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
.balance-pill:hover { border-color:var(--accent-line); color:var(--ink); text-decoration:none; }
.balance-pill.is-low { color:var(--danger); border-color:var(--danger); }
.balance-pill[hidden] { display:none; }
.dialogs-toggle { display:none; }
.chat-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:24px 8px; }
.chat-empty h2 { font-size:clamp(20px,3vw,26px); margin:0 0 6px; }
.chat-empty p { color:var(--ink-2); margin:0 0 22px; }
.starter-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; width:100%; max-width:820px; }
.starter { display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:6px; font-weight:400; text-align:left; padding:16px 18px; background:var(--surface); border:1px solid var(--line); border-radius:16px; font:inherit; color:var(--ink); cursor:pointer; min-height:96px; }
.starter:hover { border-color:var(--accent-line); box-shadow:var(--shadow-1); }
.starter strong { font-size:14.5px; font-weight:600; }
.starter span { font-size:13px; color:var(--ink-2); line-height:1.4; }
.chat-shell .chat-log { display:none; }
.chat-shell.has-chat .chat-log { display:grid; flex:1; min-height:0; max-height:none; overflow-y:auto; align-content:start; padding:18px 4px 12px; margin:0; scrollbar-width:thin; }
.chat-shell.has-chat .chat-empty { display:none; }
.composer-wrap { margin-top:auto; padding-top:12px; }
.drop-hint { display:none; position:absolute; inset:8px; z-index:4; border:2px dashed var(--accent); border-radius:20px; background:color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter:blur(2px); place-items:center; text-align:center; font-size:18px; font-weight:600; color:var(--accent-ink); pointer-events:none; }
.drop-hint small { display:block; margin-top:4px; font-size:13px; font-weight:400; color:var(--ink-2); }
.chat-main.is-dragover .drop-hint { display:grid; }
.chat-main.is-dragover > :not(.drop-hint) { opacity:.6; }
.composer { display:flex; align-items:flex-end; gap:6px; padding:8px 8px 8px 10px; background:var(--surface); border:1px solid var(--line); border-radius:26px; box-shadow:var(--shadow-1); }
.composer:focus-within { border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }
.composer textarea { flex:1; min-width:0; border:0; background:none; resize:none; overflow-y:hidden; padding:10px 6px; font:inherit; font-size:16px; line-height:1.4; color:var(--ink); max-height:200px; }
.composer textarea:focus { outline:none; box-shadow:none; }
.composer-btn { flex:none; width:40px; height:40px; padding:0; border-radius:50%; border:0; background:none; color:var(--ink-2); display:grid; place-items:center; cursor:pointer; }
.composer-btn:hover { background:var(--surface-2); color:var(--ink); }
.composer-btn[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent-ink); }
.composer-send { flex:none; width:40px; height:40px; padding:0; border-radius:50%; border:0; background:var(--accent); color:#fff; display:grid; place-items:center; cursor:pointer; }
.composer-send:active { transform:scale(.94); }
.pill-select { flex:none; display:inline-flex; align-items:center; gap:4px; height:36px; margin-bottom:2px; padding:0 10px 0 10px; border-radius:999px; background:var(--surface-2); color:var(--ink-2); font-size:13px; max-width:150px; }
.pill-select select { border:0; background:none; padding:0 14px 0 0; font:inherit; font-size:13px; color:var(--ink-2); max-width:120px; text-overflow:ellipsis; cursor:pointer; appearance:none; -webkit-appearance:none; background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%); background-position:right 4px top 55%,right 0 top 55%; background-size:4px 4px; background-repeat:no-repeat; }
.pill-select select:focus { box-shadow:none; }
.pill-icon { color:var(--accent-ink); font-size:14px; }
.voice-tools { display:inline-flex; gap:2px; }
.composer-extras { display:contents; }
.composer-note { margin:8px 12px 0; font-size:12px; text-align:center; }
.chat-shell .file-list { margin:0 8px 8px; }
@media (max-width:1000px) {
  .chat-shell { grid-template-columns:1fr; height:clamp(480px, 82dvh, 800px); }
  .chat-shell > .dialogs { position:absolute; inset:0 auto 0 0; width:min(300px, 86%); z-index:6; transform:translateX(-102%); transition:transform .2s ease; box-shadow:var(--shadow-2); }
  .chat-shell > .dialogs.is-open { transform:none; }
  .dialogs-toggle { display:grid; }
  .chat-main { padding:14px 14px 12px; }
  .chat-head .hero-mark { display:none; }
  .starter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:640px) {
  .composer { flex-wrap:wrap; }
  .composer textarea { flex:1 1 0; order:1; }
  .composer-send { order:2; }
  .composer-extras { display:flex; align-items:center; gap:4px; flex:1 1 100%; order:3; padding:2px 0 0 2px; }
  .composer-extras .voice-tools { margin-left:auto; }
  .starter-grid { grid-template-columns:1fr; }
  .starter { min-height:0; }
  .pill-select { max-width:120px; }
  .pill-select select { max-width:90px; }
  .composer { border-radius:22px; }
}
.th-sort a { color:inherit; display:inline-flex; gap:4px; align-items:center; }
.th-sort a:hover { color:var(--accent-ink); text-decoration:none; }
.th-sort.is-sorted a { color:var(--accent-ink); }
.sort-mark { font-size:11px; min-width:9px; }
