/* Operator Helper — Aurora Control Desk */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #070a12;
  --bg-soft: #0b1020;
  --rail: rgba(9, 13, 25, .94);
  --surface: rgba(17, 24, 42, .78);
  --surface-solid: #11182a;
  --surface-2: #171f35;
  --surface-3: #202a44;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .25);
  --text: #f4f7ff;
  --text-soft: #c5ccda;
  --muted: #7f8aa3;
  --accent: #7c8cff;
  --accent-2: #a76df5;
  --cyan: #4de2d0;
  --ok: #42d69a;
  --warn: #f7c65f;
  --danger: #ff7085;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

html, body { width: 100%; height: 100%; }

body {
  color: var(--text);
  background:
    radial-gradient(900px 620px at 82% -8%, rgba(124, 140, 255, .15), transparent 64%),
    radial-gradient(700px 520px at 25% 110%, rgba(77, 226, 208, .08), transparent 65%),
    var(--bg);
  font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  overflow: hidden;
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .26;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.hidden { display: none !important; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3751; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #3a4867; }

/* Rail */
#titlebar {
  grid-column: 1;
  grid-row: 1;
  height: 100vh;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--rail);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(22px);
  position: relative;
  z-index: 20;
}

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: #fff; font-size: 12px; font-weight: 900; letter-spacing: -.5px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px rgba(124, 140, 255, .28), inset 0 1px rgba(255,255,255,.28);
}
.brand-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.brand-copy b { font-size: 14px; letter-spacing: -.15px; white-space: nowrap; }
.brand-copy span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 1.45px; }

#tabs { display: flex; flex-direction: column; gap: 5px; }
.tab {
  width: 100%; min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  font: inherit; font-size: 13px; font-weight: 620;
  text-align: left; cursor: pointer;
  transition: color .18s, background .18s, border-color .18s, box-shadow .18s;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.055); }
.tab.active {
  color: #fff;
  background: rgba(124, 140, 255, .11);
  border-color: rgba(124, 140, 255, .3);
  box-shadow: inset 3px 0 var(--accent);
}
.tab-icon {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: grid; place-items: center;
  color: #8290ad;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: color .18s, background .18s, border-color .18s;
}
.tab-icon svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.tab:hover .tab-icon { color: #aebbd4; background: rgba(255,255,255,.035); }
.tab.active .tab-icon {
  color: var(--cyan);
  background: rgba(83, 224, 215, .08);
  border-color: rgba(83, 224, 215, .14);
}

.rail-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 5px; }
.system-state {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; color: var(--muted); font-size: 11px;
  border: 1px solid var(--border); border-radius: 12px;
  background: rgba(255,255,255,.025);
}
.system-state i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 12px rgba(66,214,154,.75);
}
.ontop { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; cursor: pointer; padding: 5px 10px; }
.ontop input { width: 14px; height: 14px; accent-color: var(--accent); }
html.web .ontop { display: none !important; }

/* Main canvas */
main { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; overflow: hidden; display: flex; position: relative; }
.tab-page { flex: 1; min-width: 0; overflow-y: auto; padding: 30px clamp(20px, 3vw, 44px) 44px; }
.tab-page:not(#tab-assistant) { animation: page-in .25s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-intro { max-width: 920px; margin: 0 0 26px; }
.page-intro h1 { margin-top: 6px; font-size: clamp(26px, 3vw, 38px); line-height: 1.12; letter-spacing: -1.2px; }
.page-desc { color: var(--muted); font-size: 13.5px; line-height: 1.65; max-width: 780px; margin-top: 9px; }
.eyebrow { color: var(--cyan); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.8px; }

/* Controls */
button, input, textarea, select { font-family: inherit; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 22, .62);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  user-select: text;
}
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(124,140,255,.72);
  box-shadow: 0 0 0 3px rgba(124,140,255,.1);
  background: rgba(9, 14, 27, .92);
}
input::placeholder, textarea::placeholder { color: #566078; }
select option { background: var(--surface-solid); color: var(--text); }

.btn {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-soft);
  padding: 8px 14px;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer;
  transition: transform .16s, filter .16s, border-color .16s, background .16s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: wait; transform: none; }
.btn.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(120deg, #6678f4, #9165e8);
  box-shadow: 0 10px 28px rgba(104, 120, 244, .18);
}
.btn.ghost { background: rgba(255,255,255,.025); }
.btn.danger { color: #ff9cab; border-color: rgba(255,112,133,.22); background: rgba(255,112,133,.08); }
.btn.subtle-danger { min-height: 32px; font-size: 11px; }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 11.5px; }
.btn.wide { width: 100%; }
.btn.wide-big { width: 100%; min-height: 48px; font-size: 13px; }
.btn small { margin-left: 7px; opacity: .68; font-size: 9px; font-weight: 600; }

/* Assistant workspace */
#tab-assistant { display: grid; grid-template-columns: 278px minmax(0, 1fr); padding: 0; overflow: hidden; }
#chatListPane {
  min-width: 0; padding: 22px 15px 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: rgba(10, 15, 28, .62);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.pane-heading { display: flex; flex-direction: column; gap: 5px; padding: 0 4px 4px; }
.pane-heading strong { font-size: 15px; letter-spacing: -.25px; }
#chatList { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.chat-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 43px; padding: 9px 11px;
  border: 1px solid transparent; border-radius: 12px;
  color: var(--muted); background: transparent;
  font-size: 12.5px; cursor: pointer;
  transition: .16s ease;
}
.chat-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.chat-item.active {
  color: #fff; border-color: rgba(124,140,255,.22);
  background: linear-gradient(105deg, rgba(124,140,255,.15), rgba(124,140,255,.04));
}
.chat-item .dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(66,214,154,.5); }
.chat-item .name { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-rename-btn {
  width: 28px; height: 28px; flex: 0 0 28px; margin-left: auto; padding: 0;
  display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); background: transparent; cursor: pointer; opacity: .52;
  transition: opacity .16s, color .16s, border-color .16s, background .16s;
}
.chat-rename-btn svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.chat-item:hover .chat-rename-btn, .chat-rename-btn:focus-visible, .chat-rename-btn.editing {
  color: var(--text-soft); opacity: 1; border-color: var(--border); background: rgba(255,255,255,.04);
}
.chat-rename-input {
  min-width: 0; height: 29px; flex: 1; padding: 5px 7px; border-radius: 7px;
  color: var(--text); background: rgba(7,11,22,.86); font-size: 12px;
}
.chat-item.renaming { cursor: default; border-color: rgba(77,226,208,.26); }
.chat-pane-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.pane-note { color: var(--muted); font-size: 10.5px; line-height: 1.55; }

#chatWorkArea { min-width: 0; overflow-y: auto; padding: 26px clamp(18px, 3vw, 42px) 46px; }
#chatSession { width: min(1120px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; animation: page-in .22s ease both; }
#sessionHeader { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 2px; }
.session-identity { flex: 1; display: flex; flex-direction: column; gap: 3px; }
#sessionHeader input {
  border: 0; padding: 2px 0; border-radius: 0; background: transparent;
  font-size: clamp(21px, 2vw, 29px); font-weight: 760; letter-spacing: -.7px;
  box-shadow: none;
}
#sessionHeader input:focus { box-shadow: none; background: transparent; }

#noChatPlaceholder {
  width: min(560px, 100%); height: 100%; min-height: 470px; margin: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); padding: 35px;
}
.empty-orbit {
  width: 92px; height: 92px; margin-bottom: 24px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  color: #fff; font-size: 28px;
  background: radial-gradient(circle at 35% 30%, rgba(167,109,245,.5), rgba(124,140,255,.12) 55%, transparent 57%);
  border: 1px solid rgba(124,140,255,.25);
  box-shadow: 0 0 70px rgba(124,140,255,.16);
}
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; inset: -11px; border: 1px solid rgba(124,140,255,.12); border-radius: 50%; }
.empty-orbit::after { inset: -24px; border-style: dashed; animation: orbit 16s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
#noChatPlaceholder h2 { color: var(--text); font-size: 26px; letter-spacing: -.7px; margin: 8px 0; }
#noChatPlaceholder p { max-width: 490px; font-size: 13px; line-height: 1.65; }
.empty-add { margin-top: 20px; min-width: 175px; }

.card, #libraryBox {
  background: linear-gradient(145deg, rgba(20,28,49,.82), rgba(13,19,34,.78));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 42px rgba(0,0,0,.13), inset 0 1px rgba(255,255,255,.025);
}
.card { padding: 17px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { color: var(--text-soft); font-size: 13px; letter-spacing: -.1px; }
.hint { color: var(--muted); font-size: 10.5px; line-height: 1.55; }
#historyInput { min-height: 168px; resize: vertical; line-height: 1.58; font-size: 13px; }
.controls-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.controls-row select { flex: 1 1 210px; }
#analyzeBtn { min-width: 230px; }
.generation-actions { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; }
.first-message-btn {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-soft); border-color: rgba(77,226,208,.18); background: rgba(77,226,208,.045);
}
.first-message-btn:hover { color: #dffffa; border-color: rgba(77,226,208,.36); background: rgba(77,226,208,.08); }
.first-message-btn.is-loading .button-icon { animation: reply-spin .8s linear infinite; }
#statusLine { min-height: 16px; color: var(--ok); font-size: 11.5px; }
#statusLine.err, .err { color: var(--danger) !important; }
.ok { color: var(--ok) !important; }

.exp-row {
  min-height: 48px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px dashed var(--border); border-radius: 13px;
  background: rgba(9,14,27,.35);
}
#expOutcomeBtns { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.btn.outcome.active { color: #fff; background: rgba(124,140,255,.25); border-color: rgba(124,140,255,.45); }

#resultArea { display: flex; flex-direction: column; gap: 14px; }
.response-studio-head {
  display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: 18px;
  padding: 4px 2px 2px;
}
.response-studio-title { min-width: 0; }
.response-studio-title h2 { margin-top: 5px; font-size: 22px; letter-spacing: -.55px; }
.response-studio-title p { max-width: 600px; margin-top: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.response-controls { display: flex; align-items: flex-end; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.tone-picker { display: flex; flex-direction: column; gap: 5px; }
.tone-caption { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .7px; }
.tone-options {
  display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(7,11,22,.58);
}
.tone-option {
  min-height: 32px; padding: 6px 11px; border: 0; border-radius: 8px;
  color: var(--muted); background: transparent; font: 700 11px inherit; cursor: pointer;
  transition: color .16s, background .16s, box-shadow .16s;
}
.tone-option:hover { color: var(--text-soft); }
.tone-option.active {
  color: #fff; background: rgba(124,140,255,.2);
  box-shadow: inset 0 0 0 1px rgba(124,140,255,.26), 0 4px 14px rgba(0,0,0,.12);
}
.tone-option:disabled { opacity: .48; cursor: wait; }
.regenerate-reply-btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.regenerate-reply-btn.is-loading .button-icon { animation: reply-spin .8s linear infinite; }
@keyframes reply-spin { to { transform: rotate(360deg); } }
.button-icon, .details-chevron svg {
  width: 15px; height: 15px; flex: 0 0 15px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.answer-card { position: relative; overflow: hidden; }
.answer-card.best {
  min-height: 176px; justify-content: space-between; padding: 22px 23px 24px;
  border-color: rgba(77,226,208,.3);
  background: linear-gradient(135deg, rgba(20,34,52,.96), rgba(17,24,42,.82));
  box-shadow: 0 18px 60px rgba(77,226,208,.055);
}
.answer-card.best::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--cyan), var(--accent)); }
.answer-card-head > div { display: flex; flex-direction: column; gap: 4px; }
.answer-card-head h3 { color: var(--text); font-size: 14px; }
.answer-kicker { color: var(--cyan); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.copy-answer-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.answer-card.best .copy-answer-btn { color: #dffffa; border-color: rgba(77,226,208,.2); background: rgba(77,226,208,.07); }
.answer-text { color: #f7f9ff; font-size: 16px; line-height: 1.62; overflow-wrap: anywhere; user-select: text; }
.answer-card.best .answer-text { max-width: 910px; font-size: clamp(19px, 2vw, 25px); line-height: 1.48; letter-spacing: -.25px; }
.alternatives-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px -3px; }
.alternatives-heading h3 { color: var(--text-soft); font-size: 12.5px; }
.alternatives-heading span { color: var(--muted); font-size: 10px; }
.alts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.alts-grid .answer-card { min-height: 138px; justify-content: space-between; }
.alts-grid .answer-text { color: var(--text-soft); font-size: 14px; }
.continuation-card {
  margin-top: 3px; padding: 20px;
  border-color: rgba(124,140,255,.24);
  background: linear-gradient(135deg, rgba(23,31,53,.88), rgba(13,19,34,.82));
}
.continuation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.continuation-head > div { min-width: 0; }
.continuation-head h3 { margin-top: 4px; color: var(--text); font-size: 16px; letter-spacing: -.25px; }
.continuation-head p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.continuation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.continuation-field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.continuation-field > span {
  color: var(--text-soft); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .48px;
}
.continuation-field textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.continuation-field small { min-height: 30px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.continuation-field-new textarea {
  border-color: rgba(124,140,255,.34);
  background: rgba(9,14,27,.82);
}
.continuation-field-new textarea:focus { border-color: rgba(124,140,255,.78); }
.continuation-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.continue-chat-btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.continue-chat-btn.is-loading .button-icon { animation: reply-spin .8s linear infinite; }
.analysis-details {
  border: 1px solid var(--border); border-radius: 14px;
  background: rgba(10,15,28,.48); overflow: hidden;
}
.analysis-details summary {
  min-height: 58px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  cursor: pointer; list-style: none; color: var(--text-soft);
}
.analysis-details summary::-webkit-details-marker { display: none; }
.analysis-details summary:hover { background: rgba(255,255,255,.022); }
.analysis-summary-copy { display: flex; flex-direction: column; gap: 3px; }
.analysis-summary-copy strong { font-size: 12px; }
.analysis-summary-copy small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.details-chevron { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); transition: transform .18s; }
.analysis-details[open] .details-chevron { transform: rotate(180deg); }
.analysis-details-body { padding: 0 14px 14px; border-top: 1px solid var(--border); }
.analysis-panel { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.022); }
.analysis-panel h3, .analysis-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .65px; }
#strategyCard { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#strategyCard .analysis-label { margin: 0; }
.analysis-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-soft); font: 12.5px/1.6 inherit; user-select: text; }

.chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 9.5px; font-weight: 750; }
.chip.subtle { background: rgba(255,255,255,.05); color: var(--muted); }
.chip.slow { color: #bdb7ff; background: rgba(124,140,255,.13); border: 1px solid rgba(124,140,255,.2); }
.chip.fast { color: #ff9fb0; background: rgba(255,112,133,.1); border: 1px solid rgba(255,112,133,.2); }
.chip.donate { color: #f6d57e; background: rgba(247,198,95,.1); border: 1px solid rgba(247,198,95,.2); }

#libraryBox { padding: 15px 17px; }
#libraryBox summary { cursor: pointer; color: var(--text-soft); font-size: 12.5px; font-weight: 700; }
#libraryBox input { margin: 13px 0 9px; }
#libList { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.lib-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: rgba(255,255,255,.025); border: 1px solid transparent; border-radius: 11px; }
.lib-row:hover { border-color: var(--border); background: rgba(255,255,255,.04); }
.lib-en { flex: 2; color: var(--text-soft); font-size: 12.5px; user-select: text; }
.lib-ru { flex: 1.4; color: var(--muted); font-size: 11px; }

/* Music */
#musicGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 13px; }
.music-card { padding: 15px; display: flex; flex-direction: column; gap: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.music-top { display: flex; align-items: center; gap: 10px; }
.music-num { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 10px; color: var(--cyan); background: rgba(77,226,208,.08); border: 1px solid rgba(77,226,208,.15); font-size: 11px; font-weight: 800; }
.music-card input { min-width: 0; }
.music-btns { display: flex; gap: 8px; }
.music-player-shell { display: flex; flex-direction: column; gap: 9px; }
.music-frame { width: 100%; height: 170px; border: 0; border-radius: 12px; background: #000; }
.music-volume {
  min-height: 40px; padding: 7px 10px; display: grid;
  grid-template-columns: auto minmax(80px, 1fr) 38px; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 11px; background: rgba(7,11,22,.56);
}
.music-volume-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 10.5px; font-weight: 700; }
.music-volume-label svg {
  width: 15px; height: 15px; fill: none; stroke: var(--cyan); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.music-volume .m-volume { width: 100%; height: 18px; padding: 0; border: 0; background: transparent; box-shadow: none; accent-color: var(--accent); cursor: pointer; }
.music-volume .m-volume:focus { box-shadow: none; }
.music-volume .m-volume:disabled { opacity: .45; cursor: not-allowed; }
.m-volume-value { color: var(--cyan); font-size: 10.5px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* Menus and goal workshop */
#tmSearch { width: min(500px, 100%); margin-bottom: 16px; }
.pill-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.pill { min-height: 34px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.025); color: var(--muted); font: 700 11.5px inherit; cursor: pointer; transition: .16s; }
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.active { color: #fff; border-color: rgba(124,140,255,.45); background: rgba(124,140,255,.18); box-shadow: inset 0 0 18px rgba(124,140,255,.07); }
#tmGrid, .tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 9px; }
.tm-item, .gg-item { min-width: 0; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.tm-item { display: flex; align-items: center; justify-content: space-between; gap: 9px; font-size: 12.5px; }
.tm-item:hover, .gg-item:hover { border-color: rgba(124,140,255,.32); }
.tm-item span { user-select: text; }
.tm-copy { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--muted); padding: 5px 9px; font-size: 10px; cursor: pointer; }
.tm-copy:hover { color: #fff; border-color: rgba(124,140,255,.45); }
.tm-en, .gg-en { color: var(--text-soft); font-size: 12.5px; line-height: 1.42; }
.tm-ru, .gg-ru { color: var(--muted); font-size: 10.5px; margin-top: 3px; }
.gg-item { display: flex; flex-direction: column; gap: 4px; }
.gg-item.gg-ai { border-color: rgba(167,109,245,.32); }
.gg-btns { display: flex; gap: 6px; margin-top: 7px; }
.row-gap { display: flex; align-items: center; gap: 10px; }

/* Experience */
.exp-actions { margin: -7px 0 18px; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { padding: 17px 12px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.kpi-v { color: var(--text); font-size: 25px; font-weight: 790; letter-spacing: -.8px; }
.kpi-l { color: var(--muted); font-size: 10px; margin-top: 5px; text-transform: uppercase; letter-spacing: .55px; }
#tab-experience .card { margin-bottom: 12px; }
.str-row { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 8px; align-items: center; min-height: 38px; padding: 7px 10px; border-radius: 9px; color: var(--text-soft); font-size: 11.5px; }
.str-row:nth-child(even) { background: rgba(255,255,255,.025); }
.str-head { color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px; }
.str-row .good { color: var(--ok); font-weight: 800; }
.str-row .mid { color: var(--warn); font-weight: 800; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-chip { padding: 6px 11px; border-radius: 999px; color: var(--text-soft); background: rgba(124,140,255,.08); border: 1px solid rgba(124,140,255,.14); font-size: 11px; }
.topic-chip b { color: var(--cyan); }
.weeks-row { min-height: 165px; display: flex; align-items: flex-end; justify-content: space-around; gap: 10px; padding-top: 8px; }
.week-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.week-bars { height: 112px; display: flex; align-items: flex-end; gap: 4px; }
.bar-total { width: 15px; background: #2d3750; border-radius: 5px 5px 1px 1px; }
.bar-won { width: 15px; background: linear-gradient(var(--cyan), var(--accent)); border-radius: 5px 5px 1px 1px; }
.week-l { color: var(--text-soft); font-size: 10.5px; }
.week-d { color: var(--muted); font-size: 9px; }

/* Settings */
.settings-wrap { width: min(820px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 13px; }
.settings-wrap .page-intro { margin-bottom: 7px; }
.field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }
.field-row label { color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.field-grid:first-of-type { grid-template-columns: 1fr .55fr .85fr 1.45fr; }
.key-line { display: flex; gap: 8px; }
.key-line input { flex: 1; }
input[type="range"] { height: 20px; padding: 0; accent-color: var(--accent); }
#saveStatus, #testKeyStatus { font-size: 11.5px; }

/* Modal and toast */
#modalOverlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(2,4,10,.74); backdrop-filter: blur(14px); }
#modal { width: min(430px, 100%); padding: 28px; text-align: center; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: linear-gradient(150deg, #171f36, #0e1424); box-shadow: 0 30px 100px rgba(0,0,0,.58); }
.modal-icon { width: 48px; height: 48px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 34px rgba(124,140,255,.24); }
#modal h3 { margin: 7px 0 9px; font-size: 21px; letter-spacing: -.55px; }
#modal p { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-bottom: 20px; }
.modal-btns { display: flex; justify-content: center; gap: 9px; }
#toast { position: fixed; z-index: 110; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 17px; border: 1px solid rgba(77,226,208,.22); border-radius: 11px; color: #dffffa; background: #111d29; box-shadow: var(--shadow); font-size: 11.5px; }

/* Compact rail */
@media (max-width: 1120px) {
  body { grid-template-columns: 82px minmax(0, 1fr); }
  #titlebar { padding-inline: 10px; align-items: center; }
  .brand { padding: 0; }
  .brand-copy, .tab-label, .system-state span, .ontop span { display: none; }
  #tabs { width: 100%; }
  .tab { justify-content: center; padding: 8px; }
  .tab.active { box-shadow: inset 0 -3px var(--accent); }
  .rail-footer { align-items: center; }
  .system-state, .ontop { justify-content: center; padding: 9px; }
  #tab-assistant { grid-template-columns: 240px minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .response-studio-head { grid-template-columns: 1fr; align-items: start; }
  .response-controls { justify-content: flex-start; }
  .analysis-grid { grid-template-columns: 1fr; }
}

/* Tablet */
@media (max-width: 800px) {
  body { display: flex; flex-direction: column; }
  #titlebar {
    width: 100%; height: 68px; flex: 0 0 68px; padding: 10px 13px;
    flex-direction: row; gap: 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand-copy { display: flex; }
  #tabs { min-width: 0; flex: 1; flex-direction: row; justify-content: flex-end; overflow-x: auto; }
  .tab { width: auto; flex: 0 0 auto; min-height: 42px; padding: 7px 9px; }
  .tab-label { display: none; }
  .rail-footer { display: none; }
  main { width: 100%; flex: 1; min-height: 0; }
  .tab-page { padding: 23px 17px 35px; }
  #tab-assistant { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  #chatListPane { max-height: 166px; padding: 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .pane-heading, .chat-pane-footer .pane-note { display: none; }
  #chatList { flex-direction: row; overflow-x: auto; overflow-y: hidden; min-height: 43px; }
  .chat-item { flex: 0 0 150px; }
  .chat-pane-footer { display: none; }
  #chatWorkArea { padding: 18px 14px 36px; }
  .alts-grid, .continuation-grid, .field-grid, .field-grid:first-of-type { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #musicGrid { grid-template-columns: minmax(0, 1fr); }
}

/* Phone */
@media (max-width: 540px) {
  body { padding-bottom: 66px; }
  body::before { display: none; }
  #titlebar { height: 56px; flex-basis: 56px; padding: 8px 12px; backdrop-filter: none; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 11px; }
  .brand-copy b { font-size: 13px; }
  .brand-copy span { font-size: 8px; }
  #tabs {
    position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
    height: 66px; padding: 7px 5px max(7px, env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
    background: rgba(9,13,25,.96); border-top: 1px solid var(--border); backdrop-filter: blur(22px);
  }
  .tab { min-width: 0; min-height: 50px; flex-direction: column; justify-content: center; gap: 1px; padding: 3px 1px; border-radius: 9px; font-size: 8px; }
  .tab-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 8px; }
  .tab-icon { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; }
  .tab-icon svg { width: 16px; height: 16px; }
  .tab.active { box-shadow: inset 0 2px var(--accent); }
  main { height: calc(100vh - 122px); flex: 0 0 calc(100vh - 122px); }
  .tab-page { padding: 19px 11px 28px; }
  .page-intro { margin-bottom: 19px; }
  .page-intro h1 { font-size: 27px; }
  #chatListPane { max-height: 122px; padding: 9px; }
  #chatListPane > .btn { min-height: 34px; }
  #chatList { min-height: 38px; }
  .chat-item { min-height: 38px; flex-basis: 128px; padding: 7px 9px; }
  #chatWorkArea { padding: 13px 9px 28px; }
  #noChatPlaceholder { min-height: 350px; padding: 24px 14px; }
  .empty-orbit { width: 74px; height: 74px; margin-bottom: 19px; }
  #noChatPlaceholder h2 { font-size: 23px; }
  #sessionHeader { align-items: stretch; }
  #sessionHeader input { font-size: 21px; }
  .card { padding: 13px; }
  .card-head { align-items: flex-start; flex-wrap: wrap; }
  #historyInput { min-height: 150px; }
  .controls-row, .key-line, .music-btns, .modal-btns { flex-direction: column; align-items: stretch; }
  .generation-actions { flex-direction: column; align-items: stretch; }
  #analyzeBtn, .first-message-btn { min-width: 0; width: 100%; }
  .controls-row select { width: 100%; }
  .response-studio-head { gap: 13px; }
  .response-studio-title h2 { font-size: 20px; }
  .response-controls, .tone-picker { width: 100%; }
  .tone-options { width: 100%; }
  .tone-option { flex: 1; padding-inline: 7px; }
  .regenerate-reply-btn { width: 100%; }
  .answer-card.best { min-height: 160px; padding: 17px 16px 19px; }
  .answer-card.best .answer-text { font-size: 18px; }
  .answer-card-head { flex-direction: row; align-items: center; flex-wrap: nowrap; }
  .copy-answer-btn span { display: none; }
  .copy-answer-btn { width: 34px; min-width: 34px; padding-inline: 8px; }
  .answer-text { font-size: 14.5px; }
  .alternatives-heading span { display: none; }
  .continuation-card { padding: 15px; }
  .continuation-head { flex-direction: column; gap: 9px; }
  .continuation-field small { min-height: 0; }
  .continuation-actions { align-items: stretch; flex-direction: column; }
  .continue-chat-btn { width: 100%; }
  .analysis-details summary { padding-inline: 12px; }
  .analysis-summary-copy small { max-width: 250px; }
  .row-gap { align-items: stretch; flex-direction: column; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 13px 10px; }
  .kpi-v { font-size: 21px; }
  #expStrategyTable { overflow-x: auto; }
  .str-row { min-width: 470px; }
  .weeks-row { overflow-x: auto; justify-content: flex-start; }
  .week-col { min-width: 52px; }
  .lib-row { flex-wrap: wrap; }
  .lib-en, .lib-ru { flex: 1 1 100%; }
  #tmGrid, .tm-grid { grid-template-columns: 1fr; }
  #modal { padding: 23px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
