/* ============================================================
   AIBABAK Refinery AI Command Center — industrial dark theme
   ============================================================ */
:root {
  color-scheme: dark;
  --bg-0: #04070e;
  --bg-1: #070c17;
  --panel: rgba(13, 21, 38, 0.72);
  --panel-2: rgba(9, 15, 28, 0.85);
  --glass-line: rgba(56, 189, 248, 0.16);
  --glass-line-strong: rgba(56, 189, 248, 0.34);
  --ink: #dbe7f7;
  --muted: #8aa0bd;
  --faint: #5c7192;
  --cyan: #22d3ee;
  --cyan-soft: #38bdf8;
  --gold: #f5a524;
  --gold-soft: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --red-soft: #fb7185;
  --user-bubble: linear-gradient(135deg, #0e7490 0%, #155e75 100%);
  --radius: 14px;
  --radius-lg: 18px;
  --font: "Segoe UI", Tahoma, "Vazirmatn", ui-sans-serif, system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(1100px 620px at 80% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
    radial-gradient(900px 560px at 10% 110%, rgba(245, 178, 90, 0.06), transparent 55%),
    linear-gradient(160deg, #0b111d 0%, var(--bg-0) 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint moving data-grid backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(120, 150, 180, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 180, 0.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 78%);
  animation: gridDrift 24s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 46px 46px, 46px 46px; }
}

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.hidden { display: none !important; }
.mono { font-family: var(--mono); }
[dir="ltr"] { direction: ltr; }

/* ---------- Shell ---------- */
.cc-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Header ---------- */
.cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: linear-gradient(180deg, rgba(9, 16, 30, 0.92), rgba(9, 16, 30, 0.62));
  border-bottom: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
}

.cc-brand { display: flex; align-items: center; gap: 14px; }

.cc-logo {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #04121a;
  font-weight: 900;
  font-family: var(--mono);
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-soft) 100%);
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.55);
}

.cc-titles { line-height: 1.15; }
.cc-title-main {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #f2f7ff;
}
.cc-title-fa { font-size: 13px; color: #c3d2e6; margin-top: 2px; font-weight: 600; }
.cc-title-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-top: 1px;
}

.cc-hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cc-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--panel);
}
.cc-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink 2.2s ease-in-out infinite;
}
.cc-pill-online { color: var(--green); border-color: rgba(52, 211, 153, 0.35); }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.6} }

.cc-tag {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--panel);
  color: var(--muted);
}
.cc-tag b { color: var(--cyan-soft); font-family: var(--mono); font-weight: 700; }
.cc-tag.ok { color: var(--green); border-color: rgba(52,211,153,0.3); }
.cc-clock { font-family: var(--mono); color: var(--gold-soft); letter-spacing: 1px; }

.cc-operator {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--panel);
}
.cc-op-meta { text-align: right; line-height: 1.2; }
.cc-op-role { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.cc-op-sub { font-size: 10.5px; color: var(--faint); }
.cc-op-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #04121a;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
  box-shadow: 0 0 12px rgba(245, 165, 36, 0.45);
}

.ghost-btn {
  padding: 7px 12px;
  border: 1px solid var(--glass-line-strong);
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--cyan-soft);
  cursor: pointer;
  font-size: 12.5px;
  transition: background .15s ease, border-color .15s ease;
}
.ghost-btn:hover { background: rgba(34, 211, 238, 0.16); }

/* ---------- Main grid ---------- */
.cc-main {
  direction: ltr; /* keep left/right column placement fixed as designed */
  flex: 1;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 16px 18px 20px;
  min-height: 0;
}

.cc-col { direction: rtl; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cc-col-left { overflow: visible; }

/* ---------- Cards (preview) ---------- */
.cc-card {
  position: relative;
  padding: 14px 15px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(4, 10, 22, 0.32), inset 0 1px 0 rgba(255,255,255,0.03);
}
.cc-card::after {
  content: "";
  position: absolute; inset-inline-start: 0; top: 12px; bottom: 12px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--cyan), transparent);
}
.cc-card.accent-gold::after { background: linear-gradient(180deg, var(--gold), transparent); }
.cc-card.accent-amber::after { background: linear-gradient(180deg, var(--gold-soft), transparent); }
.cc-card.accent-red::after { background: linear-gradient(180deg, var(--red), transparent); }
.cc-card.accent-amber .num { color: #ffe0b0; }

.cc-preview-badge {
  position: absolute;
  top: 10px; inset-inline-end: 10px;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: .5px;
  color: var(--gold-soft);
  border: 1px solid rgba(245, 165, 36, 0.4);
  border-radius: 999px;
  background: rgba(245, 165, 36, 0.08);
}

.cc-card h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cc-metric { display: flex; align-items: baseline; gap: 8px; }
.cc-metric .num {
  font-family: var(--mono);
  font-size: 30px; font-weight: 800; line-height: 1;
  color: #eef5ff;
}
.cc-card.accent-red .num { color: #ffd7d7; }
.cc-metric .unit { font-size: 12px; color: var(--muted); }
.cc-sub { margin-top: 6px; font-size: 11.5px; color: var(--faint); }

.cc-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 3px 0; }
.cc-kv span:first-child { color: var(--muted); }
.cc-kv span:last-child { font-family: var(--mono); color: #e8f0fb; }
.cc-kv + .cc-kv { border-top: 1px dashed rgba(90, 113, 146, 0.18); }

.cc-progress { margin-top: 10px; height: 7px; border-radius: 999px; background: rgba(90,113,146,0.2); overflow: hidden; }
.cc-progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--cyan-soft)); box-shadow: 0 0 10px rgba(34,211,238,.5); }
.cc-progress > i.p72 { inline-size: 72%; }
.cc-progress > i.p92 { inline-size: 92%; }

.cc-section-label {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 2px;
  color: var(--faint);
  padding: 2px 2px 0;
}

/* ---------- Login panel ---------- */
.login-panel {
  display: flex; flex-direction: column; gap: 10px;
  padding: 15px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
}
.login-panel .login-head { font-size: 12.5px; color: var(--cyan-soft); font-family: var(--mono); letter-spacing: 1px; }
.login-panel label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.login-panel input {
  width: 100%; padding: 10px 11px;
  background: #050a14; border: 1px solid #1e2c44; border-radius: 9px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.login-panel input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,0.16); }
.captcha-row { display: grid; grid-template-columns: minmax(0,1fr) 80px; gap: 8px; align-items: center; }
.captcha-row img { width: 100%; height: 46px; object-fit: contain; background: #d7e2ef; border: 1px solid #1e2c44; border-radius: 9px; }
.captcha-refresh {
  min-height: 46px; border: 1px solid #1e2c44; border-radius: 9px;
  background: rgba(34,211,238,0.07); color: var(--cyan-soft); cursor: pointer; font-size: 12px; font-weight: 700;
}
.captcha-refresh:hover { background: rgba(34,211,238,0.15); }
.primary-btn {
  padding: 11px 14px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 700;
  color: #04121a;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-soft) 100%);
  box-shadow: 0 8px 22px rgba(34,211,238,0.28);
  transition: filter .15s ease, transform .05s ease;
}
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }
.hint { min-height: 16px; margin: 0; font-size: 12px; color: var(--faint); }
.hint.error { color: var(--red-soft); }

/* ---------- History ---------- */
.history-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.new-chat-btn {
  padding: 10px 12px; border: 1px solid var(--glass-line-strong); border-radius: 10px; cursor: pointer;
  color: var(--cyan-soft); background: rgba(34,211,238,0.08); font-weight: 700;
}
.new-chat-btn:hover { background: rgba(34,211,238,0.16); }
.session-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 240px; }
.session-btn {
  width: 100%; text-align: right; padding: 9px 11px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.02); color: var(--ink);
}
.session-btn:hover { background: rgba(34,211,238,0.07); }
.session-btn.active { border-color: var(--glass-line-strong); background: rgba(34,211,238,0.12); }
.session-title { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: block; margin-top: 3px; font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Center stage: AI core + modules ---------- */
.cc-center { direction: rtl; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.cc-stage {
  position: relative;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(520px 360px at 50% 42%, rgba(34, 211, 238, 0.10), transparent 62%),
    var(--panel-2);
  overflow: hidden;
  padding: 16px;
  min-height: 340px;
}
.cc-stage-title {
  position: absolute; top: 12px; inset-inline-start: 16px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 2px; color: var(--faint);
}

.cc-ring {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
  margin: 6px auto 0;
  container-type: inline-size;
}

.cc-spokes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.cc-spokes line { stroke: url(#spokeGrad); stroke-width: 1.2; opacity: 0.6; }
.cc-spokes circle { fill: none; stroke: rgba(56,189,248,0.10); stroke-width: 1; }

/* AI operations hub core */
.cc-core {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 3;
  width: 138px; height: 138px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #eafcff;
  background: radial-gradient(circle at 50% 40%, #1fb6d6 0%, #0e6b7e 52%, #0a2233 100%);
  border: 2px solid rgba(245, 178, 90, 0.6);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.32), 0 0 48px rgba(34,211,238,0.14), inset 0 0 20px rgba(4,18,26,0.55);
  animation: coreBreathe 5.5s ease-in-out infinite;
}
.cc-core-txt { font-family: var(--mono); font-size: 30px; font-weight: 800; letter-spacing: 2px; text-shadow: 0 0 12px rgba(34, 211, 238, 0.55); }
.cc-core-cap { font-size: 10.5px; color: #bfe6ef; letter-spacing: .3px; }
@keyframes coreBreathe {
  0%, 100% { box-shadow: 0 0 22px rgba(34,211,238,0.30), 0 0 48px rgba(34,211,238,0.12), inset 0 0 20px rgba(4,18,26,0.55); }
  50% { box-shadow: 0 0 28px rgba(34,211,238,0.42), 0 0 62px rgba(34,211,238,0.18), inset 0 0 20px rgba(4,18,26,0.55); }
}
.cc-core-halo {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 2; width: 196px; height: 196px; border-radius: 50%;
  border: 1px solid rgba(245, 178, 90, 0.22);
  box-shadow: inset 0 0 30px rgba(56,189,248,0.06);
}

/* module nodes */
.cc-modules { position: absolute; inset: 0; z-index: 4; }
.module-node {
  position: absolute; top: 50%; left: 50%;
  width: 108px; min-height: 60px;
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-1 * var(--r))) rotate(calc(-1 * var(--a)));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 10px 8px;
  border: 1px solid var(--glass-line);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(24,34,54,0.92), rgba(15,22,38,0.92));
  color: var(--ink); cursor: pointer;
  box-shadow: 0 5px 14px rgba(2,6,16,0.4);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}
.cc-ring .module-node { --r: 41cqi; }
.cc-ring .module-node:nth-child(1)  { --a: 0deg; }
.cc-ring .module-node:nth-child(2)  { --a: 30deg; }
.cc-ring .module-node:nth-child(3)  { --a: 60deg; }
.cc-ring .module-node:nth-child(4)  { --a: 90deg; }
.cc-ring .module-node:nth-child(5)  { --a: 120deg; }
.cc-ring .module-node:nth-child(6)  { --a: 150deg; }
.cc-ring .module-node:nth-child(7)  { --a: 180deg; }
.cc-ring .module-node:nth-child(8)  { --a: 210deg; }
.cc-ring .module-node:nth-child(9)  { --a: 240deg; }
.cc-ring .module-node:nth-child(10) { --a: 270deg; }
.cc-ring .module-node:nth-child(11) { --a: 300deg; }
.cc-ring .module-node:nth-child(12) { --a: 330deg; }
.module-node:hover {
  border-color: var(--glass-line-strong);
  background: linear-gradient(180deg, rgba(30,44,68,0.95), rgba(18,28,46,0.95));
  box-shadow: 0 0 14px rgba(34,211,238,0.22);
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-1 * var(--r))) rotate(calc(-1 * var(--a))) scale(1.05);
}
.module-node .lbl { font-size: 12.5px; font-weight: 600; color: #d5e2f2; text-align: center; line-height: 1.2; }

/* ---------- Chat panel ---------- */
.chat-panel {
  display: flex; flex-direction: column;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  backdrop-filter: blur(8px);
  min-height: 420px;
  flex: 1;
  overflow: hidden;
}
.chat-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--glass-line);
  background: linear-gradient(180deg, rgba(34,211,238,0.05), transparent);
}
.chat-header h2 { margin: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.chat-head-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px; color: var(--cyan-soft); }
.chat-head-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

.messages { flex: 1; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 18px 18px 8px; scroll-behavior: smooth; }

.empty-state { max-width: 640px; margin: auto; text-align: center; padding: 20px 12px; }
.empty-mark {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 20px;
  color: #eafcff;
  background: radial-gradient(circle at 50% 38%, #2af0ff 0%, #0e7490 55%, #06202f 100%);
  border: 2px solid rgba(245,165,36,0.8);
  box-shadow: 0 0 22px rgba(34,211,238,0.5);
}
.empty-state h3 { margin: 0 0 8px; font-size: 20px; }
.empty-state p { margin: 0 auto; max-width: 480px; color: var(--muted); line-height: 1.7; }
.suggestions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 20px; }
.suggestion-chip {
  max-width: 320px; padding: 10px 14px; font-size: 13px; text-align: start; cursor: pointer;
  color: var(--ink); background: rgba(34,211,238,0.06);
  border: 1px solid var(--glass-line); border-radius: 11px;
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
}
.suggestion-chip:hover { border-color: var(--glass-line-strong); background: rgba(34,211,238,0.13); transform: translateY(-1px); }

/* bubbles */
.message { display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; }
.message.user { align-items: flex-end; }
.bubble {
  max-width: min(760px, 86%); padding: 12px 15px;
  font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere;
  border: 1px solid var(--glass-line); border-radius: 15px;
  background: rgba(15, 24, 42, 0.92);
  box-shadow: 0 6px 16px rgba(2,6,16,0.4);
}
.message.assistant .bubble { border-top-right-radius: 5px; border-color: rgba(56,189,248,0.22); }
.message.user .bubble {
  color: #ecfeff; background: var(--user-bubble);
  border-color: rgba(34,211,238,0.5); border-top-left-radius: 5px;
  box-shadow: 0 8px 20px rgba(14,116,144,0.35);
}
.message.error, .message.system { align-items: stretch; }
.message.error .bubble, .message.system .bubble {
  max-width: 100%; color: #ffdada; background: rgba(248,113,113,0.10);
  border-color: rgba(248,113,113,0.4); border-inline-start: 3px solid var(--red);
}

.thinking-bubble { display: inline-flex; align-items: center; gap: 10px; min-width: 120px; color: var(--muted); }
.thinking-dots { display: inline-flex; gap: 4px; }
.thinking-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); opacity: .35; animation: think 1.2s infinite ease-in-out; }
.thinking-dots i:nth-child(2) { animation-delay: .16s; }
.thinking-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes think { 0%,80%,100%{ transform: translateY(0); opacity:.35 } 40%{ transform: translateY(-4px); opacity:1 } }

.message-actions { display: flex; gap: 8px; margin-top: 6px; }
.speak-btn {
  min-height: 28px; padding: 0 12px; font-size: 11.5px; font-weight: 700; cursor: pointer;
  color: var(--muted); background: rgba(34,211,238,0.06);
  border: 1px solid var(--glass-line); border-radius: 999px;
}
.speak-btn:hover, .speak-btn.speaking { color: var(--cyan-soft); border-color: var(--glass-line-strong); background: rgba(34,211,238,0.14); }
.speak-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Quick chips ---------- */
.quick-chips {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px 0;
}
.quick-chip {
  padding: 7px 12px; font-size: 12.5px; cursor: pointer;
  color: var(--cyan-soft); background: rgba(34,211,238,0.06);
  border: 1px solid var(--glass-line); border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
}
.quick-chip:hover { background: rgba(34,211,238,0.15); border-color: var(--glass-line-strong); }

/* ---------- Composer command bar ---------- */
.composer {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 9px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--glass-line);
  background: linear-gradient(180deg, transparent, rgba(34,211,238,0.04));
}
.composer.is-busy { opacity: .96; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 46px;
  border: 1px solid var(--glass-line); border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,0.03); color: var(--ink); font-size: 12px; font-weight: 700;
  transition: background .15s ease, border-color .15s ease;
}
.icon-btn:hover:not(:disabled) { background: rgba(34,211,238,0.1); border-color: var(--glass-line-strong); }
.attach-btn { order: 1; font-size: 22px; }
#micBtn { order: 2; }
.icon-btn.recording { color: #fff; background: #b4231855; border-color: var(--red); animation: rec 1.4s infinite; }
.icon-btn.listening { color: #04121a; background: var(--cyan); }
@keyframes rec { 0%,100%{ box-shadow: 0 0 0 0 rgba(248,113,113,.4) } 50%{ box-shadow: 0 0 0 6px rgba(248,113,113,0) } }
.hidden-file { display: none; }

.voice-language {
  order: 3; height: 46px; width: 96px; padding: 0 8px;
  background: #050a14; border: 1px solid var(--glass-line); border-radius: 12px; outline: none;
}
.voice-language:focus { border-color: var(--cyan); }
.speaker-toggle {
  order: 4; height: 46px; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--glass-line); border-radius: 12px;
  background: rgba(255,255,255,0.03); color: var(--ink); font-size: 12px; font-weight: 700;
}
.speaker-toggle.active { color: #04121a; background: var(--cyan); border-color: var(--cyan); }

.composer textarea {
  order: 5; flex: 1 1 240px; width: 100%; min-height: 46px; max-height: 168px; resize: none;
  padding: 12px 14px; color: var(--ink);
  background: #050a14; border: 1px solid var(--glass-line); border-radius: 13px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer textarea::placeholder { color: var(--faint); }
.composer textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,0.14); }

.send-btn {
  order: 6; height: 46px; padding: 0 22px; border: 0; border-radius: 13px; cursor: pointer; font-weight: 800;
  color: #04121a; background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-soft) 100%);
  box-shadow: 0 8px 20px rgba(34,211,238,0.28);
  transition: filter .15s ease, transform .05s ease;
}
.send-btn:hover { filter: brightness(1.06); }
.send-btn:active { transform: translateY(1px); }

.send-btn:disabled, .composer textarea:disabled, .voice-language:disabled,
.speaker-toggle:disabled, .attach-btn:disabled, .icon-btn:disabled {
  opacity: .5; cursor: not-allowed;
}

/* ---------- Scrollbars ---------- */
.messages::-webkit-scrollbar, .session-list::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb, .session-list::-webkit-scrollbar-thumb { background: rgba(56,189,248,0.25); border-radius: 999px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .cc-main { grid-template-columns: 1fr; }
  .cc-col-left, .cc-col-right { flex-direction: row; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; }
  .cc-col-left > *, .cc-col-right > * { flex: 1 1 220px; }
  .login-panel { flex: 1 1 100%; }
  .history-panel { flex: 1 1 100%; }
}

@media (max-width: 820px) {
  .cc-header { padding: 10px 14px; gap: 10px; }
  .cc-title-main { font-size: 17px; }
  .cc-hud { gap: 7px; }
  .cc-main { padding: 12px; gap: 12px; }
  .cc-col-left, .cc-col-right { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .cc-col-left > *, .cc-col-right > * { flex: 0 0 auto; }

  /* modules become a horizontal-scroll strip; core on top */
  .cc-stage { min-height: auto; }
  .cc-ring { max-width: none; aspect-ratio: auto; margin: 0; }
  .cc-spokes, .cc-core-halo { display: none; }
  .cc-core { position: static; transform: none; margin: 6px auto 14px; width: 104px; height: 104px; animation: none; }
  .cc-core-txt { font-size: 24px; }
  .cc-modules { position: static; display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; }
  .module-node {
    position: static; transform: none; flex: 0 0 auto; width: 104px; min-height: 52px; scroll-snap-align: start;
  }
  .module-node:hover { transform: scale(1.04); }
  .chat-panel { min-height: 60vh; }
}

@media (max-width: 480px) {
  .cc-title-sub { display: none; }
  .cc-operator .cc-op-meta { display: none; }
  .suggestion-chip { max-width: 100%; flex: 1 1 100%; }
  .voice-language { flex: 1 1 auto; width: auto; }
  .composer textarea { flex-basis: 100%; }
  .send-btn { flex: 1 1 auto; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  body::before, .cc-core, .cc-pill .dot, .thinking-dots i, .icon-btn.recording {
    animation: none !important;
  }
  .messages { scroll-behavior: auto; }
}
