/* Jovanny Lemonad — Bender-Light (SIL OFL 1.1) */
@font-face {
  font-family: "Bender Light";
  src: url("../../fonts/Jovanny Lemonad - Bender-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000000;
  --panel: #070707;
  --ink: #f2f2f2;
  --muted: #8a8a8a;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --active: #d6f26a;
  --active-dim: rgba(214, 242, 106, 0.18);
  --warn: #f0c674;
  --bad: #e07a5f;
  --font: "Bender Light", "Segoe UI", sans-serif;
  --pad: clamp(14px, 2vw, 28px);
  --radius: 0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 300;
  letter-spacing: 0.04em;
}

.cc-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.cc-frame {
  pointer-events: none;
  position: fixed;
  inset: 10px;
  z-index: 40;
  border: 1px solid var(--line);
}

.cc-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
}
.cc-corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.cc-corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.cc-corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.cc-corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.cc-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: calc(var(--pad) + 8px) calc(var(--pad) + 8px) 12px;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

.cc-brand-mark {
  display: block;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  color: var(--active);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
}

.cc-brand-sub {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.cc-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.cc-nav-link {
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  padding: 10px 14px;
  border: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.cc-nav-link:hover {
  color: var(--ink);
  border-color: var(--line);
}

.cc-nav-link.is-active {
  color: var(--active);
  border-color: var(--active);
  background: var(--active-dim);
}

.cc-top-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.cc-chip {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.cc-chip.muted { color: var(--muted); }
.cc-chip.link {
  color: var(--active);
  text-decoration: none;
}
.cc-chip.ok { border-color: var(--active); color: var(--active); }
.cc-chip.warn { border-color: var(--warn); color: var(--warn); }

.cc-main {
  flex: 1;
  padding: var(--pad);
  z-index: 1;
}

/* —— Monitor CSS3D stage (periodic-table style plane) —— */
.cc-body[data-page="monitor"] {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}

.cc-body[data-page="monitor"] .cc-main {
  position: relative;
  padding: 0;
  overflow: hidden;
  /* Force flex child to take remaining viewport (avoids 0-height stage) */
  flex: 1 1 0;
  min-height: 0;
  height: 0;
}

.cc-monitor-root {
  /* Query container: Monitor reflows by its own pane size, not the browser viewport */
  container-type: size;
  container-name: ccstage;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(214, 242, 106, 0.04), transparent 55%),
    #000;
}

.cc-stage3d {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.cc-stage3d .cc-css3d {
  width: 100%;
  height: 100%;
}

.cc-screen {
  /* Fills 100% of the Monitor pane at any resolution; inner scale via cqw/cqh (see below) */
  container-type: size;
  container-name: ccscreen;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  padding: clamp(6px, 1.2cqw, 18px) clamp(8px, 1.4cqw, 20px);
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(214, 242, 106, 0.08),
    0 40px 120px rgba(0, 0, 0, 0.85);
  display: grid;
  /* Every track is minmax(0,fr): proportional scaling, no fixed-px row can squish the rest */
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr) minmax(0, 0.95fr);
  grid-template-rows: minmax(0, auto) minmax(0, 1.6fr) minmax(0, 0.85fr);
  gap: clamp(5px, 0.9cqw, 14px);
  overflow: hidden;
  z-index: 2;
}

/* Pane-size reflow (tablet / small laptop panes, whatever the outer window is) */
@media (max-width: 900px), (max-height: 700px) {
  .cc-screen {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, 1.5fr) minmax(0, 0.45fr) minmax(0, 0.7fr);
  }
  .cc-screen .cc-kpis { grid-column: 1 / -1; grid-row: 1; }
  .cc-screen .cc-stage { grid-column: 1 / -1; grid-row: 2; }
  .cc-screen .cc-side-left { grid-column: 1; grid-row: 3; }
  .cc-screen .cc-side-right { grid-column: 2; grid-row: 3; }
  .cc-screen .cc-bottom-stack { grid-column: 1 / -1; grid-row: 4; }
}
@container ccstage (max-width: 900px) {
  .cc-screen {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, 1.5fr) minmax(0, 0.45fr) minmax(0, 0.7fr);
  }
  .cc-screen .cc-kpis { grid-column: 1 / -1; grid-row: 1; }
  .cc-screen .cc-stage { grid-column: 1 / -1; grid-row: 2; }
  .cc-screen .cc-side-left { grid-column: 1; grid-row: 3; }
  .cc-screen .cc-side-right { grid-column: 2; grid-row: 3; }
  .cc-screen .cc-bottom-stack { grid-column: 1 / -1; grid-row: 4; }
}
@container ccstage (max-height: 560px) {
  .cc-screen .cc-kpi .hint { display: none; }
}

@media (max-width: 640px) {
  .cc-screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, 1.4fr) minmax(0, 0.4fr) minmax(0, 0.4fr) minmax(0, 0.65fr);
  }
  .cc-screen .cc-side-left,
  .cc-screen .cc-side-right {
    grid-column: 1;
  }
  .cc-screen .cc-side-left { grid-row: 3; }
  .cc-screen .cc-side-right { grid-row: 4; }
  .cc-screen .cc-bottom-stack { grid-row: 5; }
}
@container ccstage (max-width: 640px) {
  .cc-screen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, 1.4fr) minmax(0, 0.4fr) minmax(0, 0.4fr) minmax(0, 0.65fr);
  }
  .cc-screen .cc-side-left,
  .cc-screen .cc-side-right {
    grid-column: 1;
  }
  .cc-screen .cc-side-left { grid-row: 3; }
  .cc-screen .cc-side-right { grid-row: 4; }
  .cc-screen .cc-bottom-stack { grid-row: 5; }
  .cc-screen .cc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Visible before / without CSS3D — contain-fit already applied in JS */
.cc-screen.is-flat {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  transform-origin: center center;
  scale: var(--cc-fit, 1);
}

.cc-screen.is-css3d {
  /* CSS3DRenderer owns transform; clear flat centering */
  translate: none;
  scale: none;
  left: auto;
  top: auto;
  /*
   * Let orbit/pinch hit the CSS3D stage (tablets). HUD chrome is display-only;
   * re-enable pointers on real controls if added later.
   */
  pointer-events: none;
}

.cc-screen.is-css3d a,
.cc-screen.is-css3d button,
.cc-screen.is-css3d input,
.cc-screen.is-css3d select,
.cc-screen.is-css3d textarea,
.cc-screen.is-css3d label,
.cc-screen.is-css3d .cc-bottom-stack,
.cc-screen.is-css3d .cc-side-left,
.cc-screen.is-css3d .cc-side-right,
.cc-screen.is-css3d .cc-table-wrap {
  /* Orbit layer still sits above CSS3D; dashboard.js routes wheel/touch to these. */
  pointer-events: auto;
}

.cc-stage3d,
.cc-stage3d .cc-css3d {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Full-pane capture surface for OrbitControls (tablets + mouse) */
.cc-orbit-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  touch-action: none;
  background: transparent;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.cc-orbit-layer:active {
  cursor: grabbing;
}

.cc-screen-bevel {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  z-index: 0;
}

.cc-orbit-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  translate: -50% 0;
  z-index: 3;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0.75;
}

.cc-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px calc(var(--pad) + 8px) calc(var(--pad) + 4px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  z-index: 2;
}

/* —— Dashboard grid (non-monitor pages keep fluid layout) —— */
.cc-dash:not(.cc-screen) {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr) minmax(240px, 1fr);
  grid-template-rows: auto minmax(320px, 1fr) auto;
  gap: 14px;
  min-height: calc(100vh - 180px);
}

.cc-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 40%), var(--panel);
  border: 1px solid var(--line);
  /* Inside Monitor these resolve against the screen container; other pages fall back via clamp mins */
  padding: clamp(8px, 1.1cqw, 16px) clamp(10px, 1.3cqw, 18px);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.cc-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 28px 100%;
  opacity: 0.08;
  pointer-events: none;
}

.cc-panel-hd {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: clamp(6px, 0.8cqw, 12px);
  margin-bottom: clamp(6px, 0.9cqw, 12px);
  min-width: 0;
  z-index: 1;
}

.cc-panel-hd h2 {
  font-size: 0.78rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.cc-panel-hd .val {
  color: var(--active);
  font-size: clamp(0.95rem, 1.6cqw, 1.5rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.cc-panel-hd .val.ok { color: var(--active); }
.cc-panel-hd .val.warn { color: var(--warn); }

.cc-kpis {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(5px, 0.7cqw, 10px);
  min-width: 0;
  min-height: 0;
}

.cc-kpi {
  border: 1px solid var(--line);
  padding: clamp(6px, 0.9cqw, 12px) clamp(6px, 0.9cqw, 12px);
  background: rgba(0, 0, 0, 0.35);
  min-width: 0;
  overflow: hidden;
}

.cc-kpi .label {
  display: block;
  font-size: clamp(0.5rem, 0.72cqw, 0.66rem);
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: clamp(4px, 0.6cqw, 8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-kpi .num {
  display: block;
  font-size: clamp(1rem, 2.1cqw, 2rem);
  color: var(--active);
  line-height: 1;
  white-space: nowrap;
}

.cc-kpi .hint {
  display: block;
  margin-top: 4px;
  font-size: clamp(0.46rem, 0.62cqw, 0.6rem);
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-height: 700px) {
  .cc-kpi .hint { display: none; }
}

.cc-stage {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.cc-side-left {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
  z-index: 4;
  cursor: default;
}

.cc-side-right {
  grid-column: 3;
  grid-row: 2;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  position: relative;
  z-index: 4;
  cursor: default;
}

#dash-viewport {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.cc-readout {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  /* Equal columns so the divider sits on the dial center (not pushed wide) */
  display: grid;
  grid-template-columns: clamp(3rem, 6cqw, 5rem) 1px clamp(3rem, 6cqw, 5rem);
  align-items: center;
  justify-items: center;
  column-gap: clamp(6px, 0.9cqw, 12px);
  width: max-content;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
  text-align: center;
}

.cc-readout-sep {
  width: 1px;
  align-self: stretch;
  min-height: 2.6rem;
  background: var(--line-strong);
}

.cc-readout-col {
  width: 100%;
  text-align: center;
}

.cc-readout .label {
  display: block;
  font-size: clamp(0.55rem, 1.1vw, 0.64rem);
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cc-readout .value {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.3rem, 3cqw, 2.8rem);
  color: var(--ink);
  line-height: 1;
  white-space: nowrap;
}

.cc-side {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 0.9cqw, 12px);
  z-index: 1;
  position: relative;
}

.cc-meter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.cc-meter-track {
  height: 8px;
  background: #1a1a1a;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.cc-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--active);
  box-shadow: 0 0 12px rgba(214, 242, 106, 0.35);
  transition: width 400ms ease;
}

.cc-meter-row span {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.cc-led-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, 0.6cqw, 8px);
  min-width: 0;
}

.cc-led {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: #121212;
  transition: background 200ms ease, border-color 200ms ease;
}

.cc-led.on {
  background: var(--active);
  border-color: var(--active);
  box-shadow: 0 0 10px rgba(214, 242, 106, 0.35);
}

.cc-led.warn {
  background: var(--warn);
  border-color: var(--warn);
}

.cc-wave {
  width: 100%;
  height: clamp(36px, 10cqh, 84px);
  min-height: 0;
  display: block;
}

.cc-bottom-stack {
  grid-column: 1 / -1;
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Equal proportional rows — panels share the band instead of flex-shrinking unevenly */
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(5px, 0.8cqw, 12px);
  -webkit-overflow-scrolling: touch;
  /* Above CSS3D siblings for hit-testing once orbit punches through */
  position: relative;
  z-index: 4;
  cursor: default;
}

.cc-bottom-stack.cc-bottom-stack-lifecycle {
  grid-template-rows: minmax(0, 1.15fr) minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.cc-bottom-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(5px, 0.8cqw, 12px);
  min-height: 0;
}

.cc-bottom-trio > .cc-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.cc-bottom-stack > .cc-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.cc-bottom-stack > .cc-panel .cc-stat-row {
  flex: 1 1 auto;
  align-content: center;
  min-height: 0;
}

.cc-stat-row-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cc-issue-list,
.cc-customer-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
}

.cc-issue {
  display: grid;
  grid-template-columns: 52px minmax(72px, 120px) 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.cc-issue-sev {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 0.58rem;
}

.cc-issue-crit .cc-issue-sev { color: #ff6b6b; }
.cc-issue-warn .cc-issue-sev { color: var(--warn); }
.cc-issue-info .cc-issue-sev { color: var(--muted); }

.cc-issue-code {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-issue-msg {
  color: #e8e8e8;
  line-height: 1.35;
}

.cc-customer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
}

.cc-customer-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-customer-inst {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  max-width: 28%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .cc-bottom-trio {
    grid-template-columns: 1fr;
  }
  .cc-stat-row-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .cc-issue {
    grid-template-columns: 48px 1fr;
  }
  .cc-issue-code { display: none; }
}

.cc-table-wrap {
  flex: 0 0 auto;
  /* Wide inventory rows: allow horizontal scroll inside each table panel */
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.cc-table th,
.cc-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.cc-table th {
  color: var(--muted);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.62rem;
}

.cc-table td.accent { color: var(--active); }

.cc-badge {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
}

.cc-badge.ok { color: var(--active); border-color: var(--active); }
.cc-badge.plan { color: var(--muted); }
.cc-badge.warn { color: var(--warn); border-color: var(--warn); }

/* —— Forms / lists —— */
.cc-page-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.cc-page-hd h1 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--active);
}

.cc-page-hd p {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  max-width: 42ch;
}

.cc-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.cc-form {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.cc-form label {
  display: grid;
  gap: 6px;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.cc-form input,
.cc-form select,
.cc-form textarea {
  background: #050505;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  outline: none;
}

.cc-form input:focus,
.cc-form select:focus,
.cc-form textarea:focus {
  border-color: var(--active);
}

.cc-form textarea { min-height: 90px; resize: vertical; }

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cc-btn {
  appearance: none;
  border: 1px solid var(--active);
  background: var(--active-dim);
  color: var(--active);
  font: inherit;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.cc-btn:hover {
  background: var(--active);
  color: #000;
}

.cc-btn.ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.cc-btn.is-active,
.cc-btn.ghost.is-active,
.cc-actions .cc-btn.is-active {
  border-color: var(--active);
  background: var(--active);
  color: #000;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.cc-btn.is-active:hover,
.cc-btn.ghost.is-active:hover {
  background: var(--active);
  color: #000;
}

.cc-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cc-msg {
  margin-top: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  min-height: 1.2em;
}

.cc-msg.ok { color: var(--active); }
.cc-msg.err { color: var(--bad); }

.cc-list {
  list-style: none;
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.cc-list li {
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.cc-list .title {
  color: var(--ink);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.cc-list .meta {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* login */
.cc-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--pad);
}

.cc-login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  padding: 28px 24px;
  background: var(--panel);
}

.cc-login-card h1 {
  color: var(--active);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 300;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.cc-login-card p {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.cc-stat-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.cc-stat-row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cc-inline-link {
  color: var(--active);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cc-inline-link:hover {
  color: var(--ink);
}

/* Cmds Add — mic overlay (bottom-left); dictate only, never auto-save */
.cc-mic-field {
  display: block;
}

.cc-mic-wrap {
  position: relative;
  display: block;
}

.cc-mic-wrap textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding-bottom: calc(2.6rem + 10px);
  padding-left: calc(2.6rem + 12px);
}

.cc-mic-btn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 5;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(8, 14, 24, 0.88);
  color: var(--active);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  cursor: pointer;
  pointer-events: auto;
}

.cc-mic-btn .cc-mic-icon {
  display: block;
  width: 16px;
  height: 16px;
}

.cc-mic-btn:hover {
  border-color: var(--active);
  color: var(--ink);
}

.cc-mic-btn.is-listening {
  border-color: var(--bad);
  color: var(--bad);
  background: rgba(224, 122, 95, 0.18);
}

.cc-mic-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cc-fs-wrap {
  position: relative;
  display: block;
}

.cc-fs-wrap textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  /* Extra inset clears typical scrollbar under the overlay control */
  padding-right: calc(2.6rem + 18px);
}

.cc-fs-overlay {
  position: absolute;
  top: 8px;
  right: calc(8px + 18px);
  z-index: 5;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(8, 14, 24, 0.88);
  color: var(--active);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.cc-fs-overlay:hover {
  border-color: var(--active);
  color: var(--ink);
}

.cc-panel.is-fullscreen {
  position: fixed;
  inset: 12px;
  z-index: 9000;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg, #0b1018);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  overflow: auto;
}

.cc-panel.is-fullscreen .cc-fs-field,
.cc-panel.is-fullscreen .cc-fs-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cc-panel.is-fullscreen #cmds-chat-text,
.cc-panel.is-fullscreen #cmds-completed-text {
  flex: 1;
  min-height: calc(100vh - 160px);
  height: calc(100vh - 160px);
}

.cc-panel.is-fullscreen .cc-fs-overlay {
  top: 12px;
  right: calc(12px + 18px);
}

body.cc-fs-open {
  overflow: hidden;
}

.cc-stat {
  border: 1px solid var(--line);
  padding: clamp(6px, 0.9cqw, 12px) clamp(6px, 0.9cqw, 10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(3px, 0.5cqw, 6px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.cc-stat-n {
  font-size: clamp(1rem, 1.7cqw, 1.45rem);
  color: var(--active);
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.cc-stat-l {
  font-size: clamp(0.52rem, 0.72cqw, 0.7rem);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-msg.muted,
.muted {
  color: var(--muted);
}

.cc-appr-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cc-appr {
  border: 1px solid var(--line);
  padding: 12px;
}

.cc-appr-hd {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cc-appr-hd strong {
  color: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 300;
}

@media (max-width: 1100px) {
  .cc-dash:not(.cc-screen) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .cc-dash:not(.cc-screen) .cc-kpis { grid-template-columns: repeat(3, 1fr); }
  .cc-dash:not(.cc-screen) .cc-stage { grid-column: 1 / -1; grid-row: auto; }
  .cc-grid-2 { grid-template-columns: 1fr; }
  .cc-stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cc-stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-top { grid-template-columns: 1fr; justify-items: start; }
  .cc-nav { justify-content: flex-start; }
  .cc-top-meta { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .cc-dash:not(.cc-screen) .cc-kpis { grid-template-columns: repeat(2, 1fr); }
  .cc-dash:not(.cc-screen) { grid-template-columns: 1fr; }
  .cc-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-stat-row-4 { grid-template-columns: 1fr 1fr; }
}
