/* ===== Ops AI console: dark navy / cyan, frosted glass ===== */
.ai {
  --g: 96, 165, 250;
  --ai-text: #e6f1ff;
  --ai-muted: #8aa0bf;
  --ai-line: rgba(140, 200, 255, .14);
  position: relative; isolation: isolate;
  margin: -22px -26px; padding: 22px 26px 26px; min-height: calc(100vh - 36px);
  color: var(--ai-text);
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(var(--g), .16), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(59, 130, 246, .12), transparent 60%),
    linear-gradient(180deg, #060b17, #081226 60%, #050a15);
  transition: background .8s;
  overflow: hidden;
}
.ai::before { /* faint grid */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35; pointer-events: none;
  background-image: linear-gradient(rgba(140, 200, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(140, 200, 255, .06) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 75%);
}
.ai[data-state="listening"] { --g: 34, 211, 238; }
.ai[data-state="thinking"] { --g: 167, 139, 250; }
.ai[data-state="working"] { --g: 251, 176, 59; }
.ai[data-state="speaking"] { --g: 52, 211, 153; }

.ai-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ai-eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; color: rgb(var(--g)); transition: color .6s; }
.ai h1 { color: #fff; }
.ai-status { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(var(--g), .35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .6s; font-size: 13px; }
.ai-status b { color: rgb(var(--g)); transition: color .6s; }
.ai-hint { color: var(--ai-muted); }
.ai-led { width: 9px; height: 9px; border-radius: 50%; background: rgb(var(--g)); box-shadow: 0 0 10px rgb(var(--g)); animation: led 1.6s ease-in-out infinite; }
@keyframes led { 50% { opacity: .45; } }
.ai-scope { margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; border: 1px dashed rgba(140, 200, 255, .3); color: var(--ai-muted); font-size: 12.5px; background: rgba(255, 255, 255, .03); }

.ai-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 330px; gap: 14px; align-items: stretch; }
.ai-panel {
  position: relative; border-radius: 16px; min-width: 0;
  background: linear-gradient(180deg, rgba(20, 34, 62, .62), rgba(10, 18, 36, .6));
  border: 1px solid rgba(var(--g), .28);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset, 0 0 34px -12px rgba(var(--g), .55), 0 20px 40px -24px rgba(0, 0, 0, .8);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  transition: border-color .7s, box-shadow .7s;
}
.ai-ph { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--ai-line); }
.ai-ph h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: #cfe3ff; }
.ai-ph span { font-size: 11.5px; color: var(--ai-muted); }

/* Stage */
.ai-stage { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.orb-wrap { position: relative; aspect-ratio: 1 / 1; width: 100%; max-width: 280px; margin: 0 auto; }
.orb-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.orb-css { position: absolute; inset: 22%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, rgba(var(--g), 1) 35%, rgba(var(--g), .25) 70%, transparent 72%);
  box-shadow: 0 0 60px rgba(var(--g), .7); animation: breathe 3s ease-in-out infinite; transition: background .6s, box-shadow .6s; }
.has-canvas .orb-css { display: none; }
.ai-states { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ai-states button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(var(--c), .3); background: rgba(var(--c), .07); color: #b8c9e2; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 11.5px; font-weight: 700; transition: all .25s; }
.ai-states button i { width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--c)); }
.ai-states button.on { background: rgba(var(--c), .2); color: #fff; border-color: rgb(var(--c)); box-shadow: 0 0 14px -2px rgba(var(--c), .7); }
.ai-prompts h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ai-muted); margin: 4px 2px 8px; }
.ai-prompt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; margin-bottom: 7px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ai-line); background: rgba(255, 255, 255, .04); color: var(--ai-text); font-size: 13px; font-weight: 600;
  transition: background .2s, border-color .2s, transform .15s; }
.ai-prompt b { color: rgb(var(--g)); font-size: 18px; line-height: 1; transition: transform .2s; }
.ai-prompt:hover { background: rgba(var(--g), .1); border-color: rgba(var(--g), .5); }
.ai-prompt:hover b { transform: translateX(3px); }
.ai-prompt.on { border-color: rgb(var(--g)); background: rgba(var(--g), .14); }

/* Conversation */
.ai-chat { display: flex; flex-direction: column; min-height: 520px; }
.ai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; max-height: 560px; scroll-behavior: smooth; }
.ai-empty { color: var(--ai-muted); font-size: 13px; text-align: center; margin: auto; max-width: 340px; line-height: 1.6; }
.ai-empty.sm { margin: 18px auto; font-size: 12px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; animation: msgIn .35s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg .who { font-size: 10px; font-weight: 800; letter-spacing: .12em; color: var(--ai-muted); }
.msg .bubble { padding: 11px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; white-space: pre-line; }
.msg.you { align-self: flex-end; align-items: flex-end; }
.msg.you .bubble { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .who { color: rgb(var(--g)); transition: color .6s; }
.msg.bot .bubble { background: rgba(255, 255, 255, .06); border: 1px solid rgba(var(--g), .25); border-bottom-left-radius: 4px; color: #e6f1ff; transition: border-color .6s; }
.bubble.typing::after { content: ""; display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: rgb(var(--g)); animation: caret .8s steps(1) infinite; }
.dots { display: inline-flex; gap: 5px; padding: 4px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--g)); animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.ai-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--ai-line); }
.ai-input input { flex: 1; min-width: 0; border-radius: 12px; border: 1px solid var(--ai-line); background: rgba(0, 0, 0, .25); color: var(--ai-text); padding: 10px 12px; font: inherit; font-size: 13.5px; }
.ai-input input:focus { outline: none; border-color: rgb(var(--g)); box-shadow: 0 0 0 3px rgba(var(--g), .2); }
.ai-input input::placeholder { color: #5f7393; }
.ai-mic, .ai-send { border-radius: 12px; border: 1px solid rgba(var(--g), .4); background: rgba(var(--g), .12); color: #fff; font-weight: 700; padding: 0 14px; transition: background .2s; }
.ai-mic { width: 42px; padding: 0; display: grid; place-items: center; }
.ai-mic:hover, .ai-send:hover { background: rgba(var(--g), .25); }
.ai[data-state="listening"] .ai-mic { box-shadow: 0 0 0 0 rgba(var(--g), .6); animation: micPulse 1.2s infinite; }
@keyframes micPulse { 70% { box-shadow: 0 0 0 10px rgba(var(--g), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--g), 0); } }

/* Side: activity + timeline */
.ai-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ai-tools { padding: 8px 10px; max-height: 280px; overflow-y: auto; display: grid; gap: 6px; }
.tool { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid transparent; animation: msgIn .3s var(--ease) both; font-size: 12px; }
.tool.running { border-color: rgba(251, 176, 59, .35); background: rgba(251, 176, 59, .06); }
.tool .st { width: 12px; height: 12px; margin-top: 2px; border-radius: 50%; }
.tool.running .st { border: 2px solid rgba(251, 176, 59, .3); border-top-color: #fbb03b; animation: spin .7s linear infinite; }
.tool.done .st { background: #34d399; box-shadow: 0 0 8px rgba(52, 211, 153, .8); transform: scale(.8); animation: pop .3s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(0); } }
.tool code { font-family: var(--mono); color: #7dd3fc; font-weight: 700; font-size: 12px; }
.tool .args { display: block; font-family: var(--mono); color: #6f86a8; font-size: 11px; word-break: break-word; }
.tool .res { color: #c9d8ee; margin-top: 2px; }
.tool.running .res { color: #fbb03b; }
.tool .ms { font-family: var(--mono); font-size: 10.5px; color: #5f7393; white-space: nowrap; }

.ai-tl { list-style: none; margin: 0; padding: 12px 14px 14px 14px; display: grid; gap: 0; max-height: 420px; overflow-y: auto; }
.ai-tl > li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding-bottom: 12px; animation: msgIn .3s var(--ease) both; }
.ai-tl > li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--ai-line); }
.ai-tl > li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 2px solid rgb(var(--g)); background: #081226; transition: border-color .6s; }
.ai-tl b { display: block; font-size: 12.5px; font-weight: 600; color: #dbe8fb; }
.ai-tl small { font-family: var(--mono); font-size: 10.5px; color: #5f7393; }
.ai-tl li.ok .tl-dot { border-color: #34d399; background: #34d399; }
.ai-tl li.no .tl-dot { border-color: #f87171; }
.ai-tl li.approve .tl-dot { border-color: #22d3ee; background: #22d3ee; box-shadow: 0 0 10px #22d3ee; }
.ap-card { border-radius: 14px; padding: 12px 14px; border: 1px solid rgba(34, 211, 238, .5); background: linear-gradient(180deg, rgba(34, 211, 238, .12), rgba(34, 211, 238, .03)); box-shadow: 0 0 30px -10px rgba(34, 211, 238, .7); }
.ap-k { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: #67e8f9; margin-bottom: 4px; }
.ap-card b { font-size: 14px; color: #fff; }
.ap-card ul { margin: 6px 0 10px; padding-left: 16px; color: #a9bcd8; font-size: 12px; }
.ap-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-actions button { flex: 1; border-radius: 10px; padding: 8px 12px; font-weight: 800; font-size: 13px; border: 1px solid transparent; transition: transform .12s, filter .2s; }
.ap-actions button:active { transform: scale(.97); }
.ap-ok { background: linear-gradient(135deg, #22d3ee, #34d399); color: #04121f; }
.ap-ok:hover { filter: brightness(1.1); }
.ap-no { background: transparent; border-color: rgba(248, 113, 113, .5) !important; color: #fca5a5; }
.ap-no:hover { background: rgba(248, 113, 113, .1); }
.ap-done { font-size: 12px; font-weight: 800; }
.ap-done.ok { color: #34d399; }
.ap-done.no { color: #fca5a5; }
.approve.is-ok .ap-card { border-color: rgba(52, 211, 153, .6); box-shadow: 0 0 30px -10px rgba(52, 211, 153, .8); }
.approve.is-no .ap-card { border-color: rgba(248, 113, 113, .4); box-shadow: none; opacity: .75; }

.ai-foot { display: flex; gap: 8px 18px; flex-wrap: wrap; justify-content: center; margin-top: 16px; font-size: 11.5px; color: #5f7393; }
.ai-foot span::before { content: "•"; margin-right: 8px; color: rgb(var(--g)); }

@media (max-width: 1280px) {
  .ai-grid { grid-template-columns: 270px minmax(0, 1fr); }
  .ai-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  .ai { margin: -16px; padding: 16px 16px 22px; min-height: 0; }
}
@media (max-width: 760px) {
  .ai-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-side { grid-template-columns: minmax(0, 1fr); }
  .orb-wrap { max-width: 220px; }
  .ai-chat { min-height: 420px; }
  .ai-log { max-height: 460px; }
  .msg { max-width: 96%; }
  .ai-status .ai-hint { display: none; }
}
