/* ===========================================================================
   IONITY CENTRAL — AEDI CONTROL CENTER (ICC) VIEWPORT STYLES
   Author     : Johan Wilhelm van Antwerp | Ionity (Pty) Ltd | AEDI
   Governance : Policy 986 AED | (c) 2018-2026 All Rights Reserved TM2
   ---------------------------------------------------------------------------
   Rides on Central's own tokens (main.css). The only new colours are the two
   ICC brand blues; everything else reuses the existing palette so the merged
   suite reads as one product rather than two bolted together.
   =========================================================================== */

:root {
  --icc-cyan: #00C6FF;
  --icc-cyan-soft: rgba(0, 198, 255, 0.14);
  --icc-deep: #0D1B2A;
  --icc-grid: rgba(255, 255, 255, 0.06);
}

.icc-container {
  padding: 22px 26px 90px;
  max-width: 1560px;
  margin: 0 auto;
  animation: iccFade .28s ease;
}

@keyframes iccFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ header */
.icc-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle);
}
.icc-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; display: flex; align-items: center; gap: 10px; }
.icc-head p { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; max-width: 780px; line-height: 1.6; }

/* Mode badge — the interface never lies about which mode it is in. */
.icc-mode {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 800; letter-spacing: .8px;
  padding: 5px 11px; border-radius: 4px; text-transform: uppercase;
  border: 1px solid; white-space: nowrap;
}
.icc-mode .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.icc-mode.live   { color: var(--status-green); border-color: rgba(0,230,118,.4);  background: var(--status-green-bg); }
.icc-mode.sim    { color: var(--accent-8bit-gold); border-color: rgba(255,160,0,.4); background: var(--accent-8bit-gold-subtle); }
.icc-mode.probe  { color: var(--status-cyan); border-color: rgba(0,229,255,.4); background: var(--status-cyan-bg); }
.icc-mode .dot { animation: iccPulse 1.8s ease-in-out infinite; }
@keyframes iccPulse { 0%,100% { opacity: 1; } 50% { opacity: .28; } }

.icc-simnote {
  border: 1px dashed rgba(255,160,0,.45); background: rgba(255,160,0,.06);
  color: var(--accent-8bit-gold); border-radius: 8px; padding: 10px 14px;
  font-size: 12px; line-height: 1.6; margin-bottom: 18px;
}
.icc-simnote strong { color: var(--accent-8bit-gold); }
.icc-simnote code { background: rgba(0,0,0,.35); padding: 1px 5px; border-radius: 3px; font-size: 11px; }

/* -------------------------------------------------------------------- grid */
.icc-grid { display: grid; gap: 16px; }
.icc-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.icc-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.icc-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.icc-grid.auto { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
@media (max-width: 1180px) { .icc-grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .icc-grid.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px)  { .icc-grid.c2, .icc-grid.c3, .icc-grid.c4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------- cards */
.icc-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 16px 18px; position: relative; overflow: hidden;
  transition: border-color .18s ease, transform .18s ease;
}
.icc-card:hover { border-color: var(--border-highlight); }
.icc-card h3 {
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center;
  gap: 8px; justify-content: space-between;
}
.icc-card .icc-hint { font-size: 11px; color: var(--text-subtle); line-height: 1.6; margin-top: 10px; }

/* Verdict spine on the left edge of a card. */
.icc-card[data-verdict]::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.icc-card[data-verdict="ok"]::before    { background: var(--status-green); }
.icc-card[data-verdict="watch"]::before { background: var(--status-yellow); }
.icc-card[data-verdict="act"]::before   { background: var(--accent-8bit-gold); }
.icc-card[data-verdict="fault"]::before { background: var(--status-red); }

/* ------------------------------------------------------------------ gauges */
.icc-gauge { text-align: center; }
.icc-gauge .val { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.icc-gauge .unit { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-left: 3px; }
.icc-gauge .lbl { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .7px; margin-top: 8px; font-weight: 700; }
.icc-gauge .bar { height: 5px; background: var(--bg-surface-elevated); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.icc-gauge .bar span { display: block; height: 100%; border-radius: 3px; transition: width .5s ease, background .5s ease; }

.icc-spark { width: 100%; height: 46px; display: block; margin-top: 10px; }

/* ------------------------------------------------------------------ tables */
.icc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.icc-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-subtle); font-weight: 800; padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.icc-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: middle; }
.icc-table tr:last-child td { border-bottom: 0; }
.icc-table td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ------------------------------------------------------------------- pills */
.icc-pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
  border: 1px solid; white-space: nowrap;
}
.icc-pill.ok      { color: var(--status-green);      border-color: rgba(0,230,118,.35);  background: var(--status-green-bg); }
.icc-pill.watch   { color: var(--status-yellow);     border-color: rgba(255,214,0,.35);  background: var(--status-yellow-bg); }
.icc-pill.act     { color: var(--accent-8bit-gold);  border-color: rgba(255,160,0,.35);  background: var(--accent-8bit-gold-subtle); }
.icc-pill.fault   { color: var(--status-red);        border-color: rgba(255,61,113,.35); background: var(--status-red-bg); }
.icc-pill.info    { color: var(--icc-cyan);          border-color: rgba(0,198,255,.35);  background: var(--icc-cyan-soft); }
.icc-pill.muted   { color: var(--text-subtle);       border-color: var(--border-subtle); background: transparent; }
.icc-pill.high    { color: var(--status-red);        border-color: rgba(255,61,113,.5);  background: var(--status-red-bg); }
.icc-pill.medium  { color: var(--accent-8bit-gold);  border-color: rgba(255,160,0,.4);   background: var(--accent-8bit-gold-subtle); }
.icc-pill.low     { color: var(--status-green);      border-color: rgba(0,230,118,.35);  background: var(--status-green-bg); }

/* ----------------------------------------------------------------- buttons */
.icc-btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700;
  padding: 8px 14px; border-radius: 7px; cursor: pointer; border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated); color: var(--text-main);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  font-family: inherit;
}
.icc-btn:hover { background: var(--bg-surface-hover); border-color: var(--border-highlight); }
.icc-btn:active { transform: translateY(1px); }
.icc-btn.primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.icc-btn.primary:hover { background: var(--accent-hover); }
.icc-btn.danger { background: var(--status-red-bg); border-color: rgba(255,61,113,.45); color: var(--status-red); }
.icc-btn.ghost { background: transparent; }
.icc-btn.sm { font-size: 11px; padding: 5px 10px; }
.icc-btn[disabled] { opacity: .45; cursor: not-allowed; }
.icc-btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------- tabs */
.icc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border-subtle); }
.icc-tab {
  padding: 9px 15px; font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--text-muted); border-bottom: 2px solid transparent; background: none;
  border-top: 0; border-left: 0; border-right: 0; font-family: inherit;
}
.icc-tab:hover { color: var(--text-main); }
.icc-tab.active { color: var(--icc-cyan); border-bottom-color: var(--icc-cyan); }

/* --------------------------------------------------------- curve editor SVG */
.icc-curve { width: 100%; height: 300px; display: block; touch-action: none; cursor: crosshair; }
.icc-curve .grid { stroke: var(--icc-grid); stroke-width: 1; }
.icc-curve .axis { stroke: var(--border-subtle); stroke-width: 1.5; }
.icc-curve .line { stroke: var(--icc-cyan); stroke-width: 2.5; fill: none; stroke-linejoin: round; }
.icc-curve .fill { fill: url(#iccCurveFill); }
.icc-curve .node { fill: var(--bg-primary); stroke: var(--icc-cyan); stroke-width: 2.5; cursor: grab; }
.icc-curve .node:hover { fill: var(--icc-cyan); }
.icc-curve .node.dragging { cursor: grabbing; fill: var(--icc-cyan); }
.icc-curve .op { fill: var(--accent-8bit-gold); stroke: var(--bg-primary); stroke-width: 2; }
.icc-curve text { fill: var(--text-subtle); font-size: 9.5px; font-family: inherit; }

/* --------------------------------------------------------------- LED ring */
.icc-ring { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; padding: 8px 0 4px; }
.icc-ring svg { filter: drop-shadow(0 0 14px rgba(0,198,255,.2)); }

/* -------------------------------------------------------------- terminal */
.icc-term {
  background: #0B0B0B; border: 1px solid var(--border-subtle); border-radius: 8px;
  padding: 12px 14px; font-family: 'SF Mono', 'Consolas', 'Roboto Mono', monospace;
  font-size: 11.5px; line-height: 1.65; color: #C8D6E5; max-height: 260px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.icc-term .ok { color: var(--status-green); }
.icc-term .warn { color: var(--accent-8bit-gold); }
.icc-term .err { color: var(--status-red); }
.icc-term .dim { color: var(--text-subtle); }

/* ----------------------------------------------------------------- copilot */
.icc-chat { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; padding-right: 6px; }
.icc-msg { border-radius: 10px; padding: 11px 14px; font-size: 12.5px; line-height: 1.68; }
.icc-msg.user { background: var(--accent-subtle); border: 1px solid rgba(51,102,255,.3); align-self: flex-end; max-width: 76%; }
.icc-msg.bot  { background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); max-width: 92%; }
.icc-msg code { background: rgba(0,0,0,.4); padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.icc-msg strong { color: var(--icc-cyan); }
.icc-cites { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }

/* ------------------------------------------------------------------ inputs */
.icc-input, .icc-select {
  background: var(--bg-primary); border: 1px solid var(--border-subtle); color: var(--text-main);
  border-radius: 7px; padding: 8px 11px; font-size: 12.5px; font-family: inherit; width: 100%;
}
.icc-input:focus, .icc-select:focus { outline: none; border-color: var(--border-focus); }
.icc-field { display: flex; flex-direction: column; gap: 6px; }
.icc-field label { font-size: 10px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-muted); font-weight: 800; }
.icc-range { width: 100%; accent-color: var(--icc-cyan); }

/* ------------------------------------------------------------------ stages */
.icc-stages { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.icc-stage {
  flex: 1 1 0; min-width: 74px; background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle); border-radius: 6px; padding: 7px 8px; text-align: center;
}
.icc-stage .n { font-size: 10px; font-weight: 800; letter-spacing: .5px; color: var(--text-muted); text-transform: uppercase; }
.icc-stage .ms { font-size: 13px; font-weight: 800; color: var(--icc-cyan); font-variant-numeric: tabular-nums; margin-top: 3px; }

/* ------------------------------------------------------------------ ledger */
.icc-ledger { max-height: 300px; overflow-y: auto; font-size: 11.5px; }
.icc-ledger div { padding: 7px 9px; border-bottom: 1px solid rgba(255,255,255,.045); display: flex; gap: 10px; align-items: baseline; }
.icc-ledger .t { color: var(--text-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 10.5px; }
.icc-ledger .d-denied { color: var(--status-red); font-weight: 800; }
.icc-ledger .d-granted { color: var(--status-green); font-weight: 800; }
.icc-ledger .d-revoked, .icc-ledger .d-kill-switch-on { color: var(--accent-8bit-gold); font-weight: 800; }

/* ------------------------------------------------------------------- misc */
.icc-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12px; }
.icc-kv dt { color: var(--text-muted); }
.icc-kv dd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.icc-empty { text-align: center; color: var(--text-subtle); font-size: 12.5px; padding: 34px 16px; line-height: 1.7; }
.icc-foot {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--border-subtle);
  font-size: 10.5px; color: var(--text-subtle); line-height: 1.7; text-align: center;
}
