:root {
  --bg: #050606; --card: #0d0f10; --card-2: #15181a; --line: #1e2224; --text: #f2f4f1; --muted: #7d8582; --dim: #454b49;
  --lime: #c3e03d; --lime-deep: #6d8418; --amber: #f5a632; --violet: #8e77f0; --blue: #5ab2f0; --rose: #e85c70; --ok: #8fce4a;
  --ink: #0b0d05;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg); }
body { color: var(--text); font: 14px/1.42 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible, label:focus-within { outline: 2px solid var(--lime); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { display: grid; grid-template: 42px minmax(0, 1fr) / minmax(0, 1.2fr) minmax(380px, 1fr); height: 100dvh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 18px; font-size: 10.5px; letter-spacing: .14em; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); transition: background .3s; }
.brand i.on { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.health { margin-left: auto; display: flex; gap: 12px; overflow: hidden; white-space: nowrap; letter-spacing: .04em; }
.health span { display: inline-flex; align-items: center; gap: 5px; }
.health i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.health .bad { color: var(--rose); }
.health .bad i { background: var(--rose); }
.link { color: var(--muted); font-size: 11px; letter-spacing: .04em; flex: none; }
.link:hover { color: var(--text); }

/* сцена */
.stage { display: flex; flex-direction: column; align-items: center; min-height: 0; padding: 6px 24px 24px; text-align: center; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; letter-spacing: .18em; color: var(--mood, var(--muted)); transition: color .4s; min-height: 18px; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
#orb { flex: 1 1 0; width: 100%; min-height: 150px; max-height: 58vh; display: block; }
.role { font-size: 10px; letter-spacing: .24em; color: var(--mood, var(--lime)); margin-top: 2px; transition: color .4s; }
.subtitle { margin: 10px auto 0; max-width: 640px; min-height: 2.5em; font-size: clamp(22px, 2.5vw, 34px); line-height: 1.24; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.subtitle .w { color: #30353a; transition: color .18s; }
.subtitle .w.on { color: var(--text); }
.controls { display: flex; align-items: center; gap: 14px; margin-top: 16px; min-height: 68px; }
.mic { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--lime); box-shadow: 0 0 0 6px color-mix(in srgb, var(--lime) 18%, transparent), 0 0 30px color-mix(in srgb, var(--lime) 40%, transparent); transition: transform .12s, background .25s, box-shadow .25s; }
.mic:hover { transform: scale(1.04); }
.mic:active { transform: scale(.95); }
.mic svg { width: 27px; height: 27px; }
.mic.live { background: var(--amber); box-shadow: 0 0 0 6px color-mix(in srgb, var(--amber) 22%, transparent), 0 0 34px color-mix(in srgb, var(--amber) 50%, transparent); }
.mic.live svg rect { fill: currentColor; }
.ghost { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); background: var(--card); font-size: 12.5px; }
.ghost:hover { color: var(--text); border-color: var(--dim); }
.ghost[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }
.timer { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

/* панель */
.panel { display: flex; flex-direction: column; gap: 10px; padding: 4px 18px 18px 0; min-height: 0; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; min-width: 0; }
.tile b { display: block; font-size: 20px; line-height: 1.2; letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.hot b { color: var(--lime); }
.decision { background: var(--card-2); border: 1px solid var(--lime-deep); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; }
.decision-text { flex: 1; min-width: 0; }
.decision-text small { display: block; font-size: 9.5px; letter-spacing: .16em; color: var(--lime); }
.decision-text b { margin-right: 6px; }
.decision-text span { color: #b8bebb; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.decision-actions { display: flex; gap: 6px; flex: none; }
.primary { padding: 7px 13px; border-radius: 9px; background: var(--lime); color: var(--ink); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.card.main { flex: 1; min-height: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; flex: none; }
.tabs button { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 12.5px; }
.tabs button[aria-selected="true"] { background: var(--card-2); color: var(--text); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#view-work { overflow-y: auto; padding: 4px 14px 14px; }

/* разговор */
.messages { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 5px; overscroll-behavior: contain; }
.day { align-self: center; margin: 9px 0 5px; font-size: 10.5px; letter-spacing: .08em; color: var(--dim); }
.msg { max-width: 88%; padding: 7px 11px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop .16s ease-out; }
.msg.in { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 3px; }
.msg.out { align-self: flex-end; background: color-mix(in srgb, var(--lime) 15%, var(--card-2)); border-bottom-right-radius: 3px; }
.msg.notice { align-self: stretch; max-width: none; background: transparent; border-left: 2px solid var(--lime-deep); border-radius: 0; padding: 2px 10px; color: #c2c8c4; }
.msg.event { align-self: center; max-width: 94%; background: transparent; color: var(--muted); font-size: 12px; text-align: center; padding: 2px 8px; }
.msg.voice::before { content: "голосом"; display: block; font-size: 9.5px; letter-spacing: .1em; color: var(--lime); text-transform: uppercase; }
.msg.pending { opacity: .6; }
.meta { float: right; margin: 5px 0 -2px 9px; font-size: 10px; color: var(--dim); user-select: none; }
.msg.out .meta { color: #7f8a6d; }
.msg a { color: var(--lime); }
.msg code { font: 12.5px ui-monospace, Consolas, monospace; background: #fff1; padding: 0 4px; border-radius: 4px; }
.msg img.attach { display: block; max-width: 100%; border-radius: 8px; margin-bottom: 4px; }
.typing-row { align-self: flex-start; display: flex; gap: 4px; padding: 10px 12px; background: var(--card-2); border-radius: 12px; border-bottom-left-radius: 3px; }
.typing-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing-row i:nth-child(2) { animation-delay: .2s; } .typing-row i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }

.composer { display: flex; align-items: flex-end; gap: 4px; padding: 7px 8px; border-top: 1px solid var(--line); flex: none; }
.composer textarea { flex: 1; resize: none; border: 0; background: transparent; color: var(--text); font: inherit; padding: 8px 4px; max-height: 130px; outline: none; }
.composer textarea::placeholder { color: var(--dim); }
.attach, .send { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; }
.attach:hover { color: var(--text); }
.send { background: var(--lime); color: var(--ink); }
.send svg { width: 19px; height: 19px; stroke-width: 2.2; }

/* дела */
.work-title { display: flex; justify-content: space-between; font-weight: 600; padding: 14px 0 7px; }
.work-title em { color: var(--muted); font-style: normal; font-weight: 400; font-size: 12px; }
.work-item { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.work-item b { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.work-item span { color: var(--muted); font-size: 12.5px; }
.chip { font-size: 10px; padding: 1px 8px; border-radius: 9px; font-weight: 600; background: var(--lime); color: var(--ink); flex: none; align-self: center; }
.chip.wait { background: var(--card); color: var(--amber); border: 1px solid var(--amber); }
.chip.urgent { background: var(--rose); color: #fff; }
.work-empty { color: var(--dim); font-size: 12.5px; padding-bottom: 4px; }
.bar-row { margin-bottom: 9px; }
.bar-row div:first-child { display: flex; justify-content: space-between; font-size: 12.5px; color: #c2c8c4; margin-bottom: 3px; }
.bar { height: 7px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--lime-deep), var(--lime)); border-radius: 4px; transition: width .6s; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 9px 15px; background: #000; border: 1px solid var(--line); color: var(--text); border-radius: 10px; z-index: 20; }

/* вход */
.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 16px; overflow: auto; }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-orb { display: block; width: 220px; height: 220px; margin: 0 auto -8px; }
.login-card h1 { margin: 0 0 2px; font-size: 24px; font-weight: 600; }
.login-card p { margin: 0 0 16px; color: var(--muted); }
.login-card input { width: 100%; padding: 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; text-align: center; }
.login-card button { width: 100%; margin-top: 10px; padding: 12px; border-radius: 11px; background: var(--lime); color: var(--ink); font-weight: 600; }
.login-error { color: var(--rose); font-size: 13px; min-height: 18px; margin-top: 8px; }

@media (max-width: 900px) {
  .app { grid-template: 36px auto minmax(0, 1fr) / minmax(0, 1fr); }
  .top { padding: 0 14px; }
  .health { display: none; }
  .link { margin-left: auto; }
  .stage { padding: 0 16px 8px; display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; column-gap: 8px; align-items: center; text-align: left; }
  .pill { grid-column: 2 / 3; grid-row: 1; align-self: end; }
  #orb { grid-column: 1; grid-row: 1 / 4; width: 112px; height: 112px; min-height: 0; flex: none; }
  .role { display: none; }
  .subtitle { grid-column: 2 / 3; grid-row: 2 / 4; align-self: start; margin: 3px 0 0; min-height: 3em; font-size: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .controls { grid-column: 3; grid-row: 1 / 4; margin: 0; flex-direction: column; gap: 4px; min-height: 0; }
  .mic { width: 52px; height: 52px; }
  .mic svg { width: 22px; height: 22px; }
  #mute { padding: 3px 6px; font-size: 10px; max-width: 76px; }
  .timer { font-size: 11px; }
  .panel { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .tiles { display: none; }
  .composer textarea { font-size: 16px; }
  .decision { flex-direction: column; align-items: stretch; gap: 7px; }
  .decision-actions > * { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
