/* CIF Command UI — Central Core + Voice Orb visuals (state-driven).
   Phase 0 lays the stage + state classes; Phase 1 wires the live renderer. */

.cifc-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: flex-start;
}

.cifc-core-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 420px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cif-line);
  border-radius: var(--cif-radius-lg);
  background:
    radial-gradient(420px 420px at 50% 45%, rgba(57, 214, 242, 0.08), transparent 70%),
    var(--cif-glass);
  backdrop-filter: blur(var(--cif-blur));
  -webkit-backdrop-filter: blur(var(--cif-blur));
  overflow: hidden;
}

.cifc-core {
  position: relative;
  width: 240px; height: 240px;
  display: grid;
  place-items: center;
}
/* Particle/radar field — sits centred behind the rings, sized to the wrap. */
.cifc-core__canvas {
  position: absolute;
  width: 340px; height: 340px;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.9;
  z-index: 0;
}
.cifc-core__ring, .cifc-core__nucleus, .cifc-core__state { z-index: 1; }
.cifc-core__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(57, 214, 242, 0.35);
  box-shadow:
    0 0 40px rgba(57, 214, 242, 0.18),
    inset 0 0 40px rgba(57, 214, 242, 0.12);
}
.cifc-core__ring--2 { inset: 26px; border-color: rgba(57, 214, 242, 0.22); }
.cifc-core__ring--3 { inset: 54px; border-color: rgba(201, 162, 75, 0.22); }
.cifc-core__nucleus {
  width: 96px; height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(57, 214, 242, 0.9), rgba(14, 124, 158, 0.5) 55%, rgba(11, 16, 32, 0.2) 80%);
  box-shadow: 0 0 60px var(--cif-cyan-glow);
}
.cifc-core__state {
  position: absolute;
  bottom: 14px;
  left: 0; right: 0;
  text-align: center;
}
.cifc-core__state-label {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cif-cyan);
}
.cifc-core__state-sub {
  font-size: 12px;
  color: var(--cif-text-dim);
  margin-top: 4px;
}

/* Core micro-stats sit BELOW the core (do not compete as panels). */
.cifc-core-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 560px;
}
.cifc-core-metric {
  text-align: center;
  padding: 8px 6px;
  border: 1px solid var(--cif-line-soft);
  border-radius: var(--cif-radius-sm);
  background: var(--cif-glass-2);
}
.cifc-core-metric__v {
  font-size: 18px; font-weight: 700;
  color: var(--cif-text);
  font-variant-numeric: tabular-nums;
}
.cifc-core-metric__k {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--cif-text-faint);
  margin-top: 2px;
}

/* Voice Orb docked under the core (recognition + typed command + transcript). */
.cifc-orb {
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--cif-line);
  border-radius: var(--cif-radius);
  background: var(--cif-glass);
}
.cifc-orb__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cifc-orb__btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(57, 214, 242, 0.5);
  background: rgba(57, 214, 242, 0.10);
  display: grid; place-items: center;
  color: var(--cif-cyan);
  flex: 0 0 auto;
  cursor: pointer;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}
.cifc-orb__btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.cifc-orb__btn--active {
  background: rgba(57, 214, 242, 0.22);
  box-shadow: 0 0 18px var(--cif-cyan-glow);
}
.cifc-orb__btn--rec { animation: cifc-rec-pulse 1.4s ease-in-out infinite; }
@keyframes cifc-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(57, 214, 242, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(57, 214, 242, 0); }
}
.cifc-orb__vo {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--cif-line);
  background: var(--cif-glass-2);
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}
.cifc-orb__vo--off { opacity: 0.55; }
.cifc-orb__hint { font-size: 12px; color: var(--cif-text-dim); flex: 1; }
.cifc-orb__response:empty { display: none; }
.cifc-orb__rcard {
  font-size: 13px;
  color: var(--cif-text);
  padding: 10px 12px;
  border: 1px solid var(--cif-line-soft);
  border-radius: var(--cif-radius-sm);
  background: var(--cif-glass-2);
  line-height: 1.5;
}
.cifc-orb__form { display: flex; gap: 8px; }
.cifc-orb__input {
  flex: 1;
  background: var(--cif-deep-2);
  border: 1px solid var(--cif-line);
  border-radius: var(--cif-radius-sm);
  color: var(--cif-text);
  padding: 9px 12px;
  font: inherit; font-size: 13px;
}
.cifc-orb__input::placeholder { color: var(--cif-text-faint); }
.cifc-orb__input:focus { outline: none; border-color: rgba(57, 214, 242, 0.6); }
.cifc-orb__send {
  border: 1px solid rgba(57, 214, 242, 0.5);
  background: rgba(57, 214, 242, 0.12);
  color: var(--cif-cyan);
  border-radius: var(--cif-radius-sm);
  padding: 0 16px;
  cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
}
.cifc-orb__transcript {
  max-height: 132px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.cifc-tx__empty { color: var(--cif-text-faint); text-align: center; padding: 6px; }
.cifc-tx__line { color: var(--cif-text-dim); line-height: 1.45; }
.cifc-tx__line--user { color: var(--cif-text); }
.cifc-tx__line--cif { color: var(--cif-cyan); }
.cifc-tx__line--interim { color: var(--cif-text-faint); font-style: italic; }

/* Wake response overlay (transient "I'm already awake, Mr.T."). */
.cifc-orb__wake {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  text-align: center;
  font-size: 13px;
  color: var(--cif-gold-bright);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}
.cifc-orb__wake--show { opacity: 1; }

/* Degraded health surfaces an amber (non-alarming) core. */
.cifc-core-wrap[data-degraded="true"] .cifc-core__nucleus {
  background: radial-gradient(circle at 35% 30%, rgba(232, 184, 75, 0.85), rgba(120, 90, 20, 0.4) 70%);
  box-shadow: 0 0 50px rgba(232, 184, 75, 0.3);
}
.cifc-core-wrap[data-degraded="true"] .cifc-core__state-label { color: var(--cif-warn); }

/* State-driven accents applied to .cifc-core-wrap[data-state="..."] */
.cifc-core-wrap[data-state="LISTENING"] .cifc-core__nucleus { box-shadow: 0 0 80px var(--cif-cyan-glow); }
.cifc-core-wrap[data-state="EXECUTING"] .cifc-core__ring { border-color: rgba(57, 214, 242, 0.6); }
.cifc-core-wrap[data-state="NEEDS_APPROVAL"] .cifc-core__ring--3 { border-color: rgba(232, 198, 107, 0.7); }
.cifc-core-wrap[data-state="FAILED"] .cifc-core__nucleus {
  background: radial-gradient(circle at 35% 30%, rgba(242, 85, 107, 0.9), rgba(120, 30, 45, 0.4) 70%);
  box-shadow: 0 0 60px rgba(242, 85, 107, 0.4);
}

/* ---- Admin gate overlay (parity; shown only on 401/403) ---- */
.cifc-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 15, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cifc-gate[hidden] { display: none; }
.cifc-gate__card {
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 26px;
  border: 1px solid var(--cif-line);
  border-radius: var(--cif-radius-lg);
  background: var(--cif-glass);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.cifc-gate__title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cif-cyan);
}
.cifc-gate__sub { margin: 0; font-size: 13px; color: var(--cif-text-dim); }
.cifc-gate__input {
  background: var(--cif-deep-2);
  border: 1px solid var(--cif-line);
  border-radius: var(--cif-radius-sm);
  color: var(--cif-text);
  padding: 11px 13px;
  font: inherit; font-size: 14px;
}
.cifc-gate__input:focus { outline: none; border-color: rgba(57, 214, 242, 0.6); }
.cifc-gate__btn {
  border: 1px solid rgba(57, 214, 242, 0.5);
  background: rgba(57, 214, 242, 0.14);
  color: var(--cif-cyan);
  border-radius: var(--cif-radius-sm);
  padding: 11px;
  cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
}
.cifc-gate__err { font-size: 12px; color: var(--cif-danger); min-height: 14px; }
