/* Connection map + usage tank from Cizi Code Desktop (src/renderer/styles.css).
   Shared by the customer panel and the landing page; expects --ground,
   --panel, --line... from the page stylesheet. */
:root {
  --flow-rgb: 238 101 27;
  --spark-rgb: 181 120 38;
  --online: #3cd312;
  --tank-full-a: #e86e45;
  --tank-full-b: #e85321;
  --tank-empty-a: #861018;
  --tank-empty-b: #420307;
  --tank-danger-mix: 0%;
  --tank-liquid-a: color-mix(in srgb, var(--tank-full-a), var(--tank-empty-a) var(--tank-danger-mix));
  --tank-liquid-b: color-mix(in srgb, var(--tank-full-b), var(--tank-empty-b) var(--tank-danger-mix));
  --tank-value: #ffffff;
}

/* --- connection map (desktop dashboard) --------------------------------- */
.connection-panel {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, rgb(var(--flow-rgb) / 5%), transparent 36%), var(--panel);
}
.motion-panel::before,
.motion-halo { position: absolute; pointer-events: none; border-radius: 999px; filter: blur(1px); }
.motion-panel::before {
  content: "";
  width: 38vmax;
  height: 38vmax;
  top: -27vmax;
  right: -14vmax;
  border: 1px solid rgb(var(--flow-rgb) / 16%);
  box-shadow: 0 0 0 28px rgb(var(--flow-rgb) / 3%), 0 0 0 58px rgb(var(--flow-rgb) / 2%);
  animation: motion-orbit 12s ease-in-out infinite;
}
.motion-halo {
  width: 260px;
  height: 260px;
  right: 14%;
  bottom: -190px;
  background: radial-gradient(circle, rgb(var(--spark-rgb) / 16%), transparent 68%);
  animation: motion-breathe 5.4s ease-in-out infinite;
}
@keyframes motion-orbit { 50% { transform: translate(-44px, 30px) scale(1.06); opacity: .58; } }
@keyframes motion-breathe { 50% { transform: scale(1.23) translateY(-18px); opacity: .55; } }
/* The map needs three columns; on a phone it scrolls inside its own panel. */
.map-scroll { position: relative; z-index: 1; overflow-x: auto; }
#connection-map { min-width: 620px; }

#connection-map.cbh {
  --cbh-panel: transparent;
  --cbh-card: var(--raised);
  --cbh-card-2: var(--sunken);
  --cbh-provider: var(--sunken);
  --cbh-provider-glow: color-mix(in srgb, var(--flow) 16%, transparent);
  --cbh-line: var(--line);
  --cbh-line-soft: var(--line);
  --cbh-text: var(--ink);
  --cbh-muted: var(--ink-soft);
  --cbh-dim: var(--ink-dim);
  --cbh-title: var(--ink-dim);
  --cbh-ghost: color-mix(in srgb, var(--flow) 5%, transparent);
  --cbh-ghost-mark: var(--ink-dim);
  --cbh-sheen: color-mix(in srgb, var(--ink) 10%, transparent);
  --cbh-cloud: var(--ink-soft);
  --cbh-ticon-bg: var(--panel);
  --cbh-ticon-line: var(--line-strong);
  --cbh-ticon-ink: var(--ink-soft);
  --cbh-wire: var(--flow-rgb);
  --cbh-wire-b: var(--flow-rgb);
  --cbh-ok: var(--online);
  --cbh-dot: 8px;
  --cbh-card-h: 38px;
  --cbh-card-h-min: 26px;
  --cbh-card-h-max: 52px;
  --cbh-row-gap: 6px;
  --cbh-col-w: clamp(126px, 14vw, 168px);
  --cbh-data-col-w: clamp(164px, 23vw, 320px);
  --cbh-radius: var(--r-md);
  padding: 8px 12px 10px;
  background: transparent;
  border-radius: 0;
  font-family: var(--font);
}
#connection-map .cbh__head { display: none; }
#connection-map .cbh__stage {
  grid-template-columns: var(--cbh-col-w) var(--cbh-data-col-w) var(--cbh-data-col-w);
  justify-content: space-between;
  column-gap: 0;
  row-gap: 6px;
}
#connection-map .cbh__coltitle { color: var(--ink-dim); letter-spacing: .12em; }
#connection-map .cbh__coltitle--provider { text-align: left; }
#connection-map .cbh__card { box-shadow: none; }
#connection-map .cbh__card--model,
#connection-map .cbh__card--tool {
  gap: 8px;
  padding: 0 10px;
  transition:
    border-color 160ms var(--ease), background 160ms var(--ease),
    opacity var(--in-dur, 500ms), transform var(--in-dur, 500ms), filter var(--in-dur, 500ms);
}
#connection-map .cbh__mname,
#connection-map .cbh__tname {
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#connection-map .cbh__meta { flex: none; font-size: 11px; }
#connection-map .cbh__icon--model { width: 16px; height: 16px; }
#connection-map .cbh__card--model .brand { width: 17px; height: 17px; }
#connection-map .cbh__ticon { width: 20px; height: 20px; }
#connection-map .cbh-empty {
  flex: none;
  align-self: center;
  max-width: 260px;
  color: var(--ink-dim);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}
#connection-map .cbh__card--tool { cursor: pointer; padding-right: 28px; }
#connection-map .cbh__card--tool:hover { background: var(--hover); border-color: var(--line-strong); }
#connection-map .cbh__card--tool::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--flow);
  border-right: 2px solid var(--flow);
  transform: translateY(-50%) rotate(45deg);
}
#connection-map .cbh__card--provider {
  display: block;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--cbh-provider);
  border-color: var(--line-strong);
}
#connection-map .cbh__card--provider .cbh__icon,
#connection-map .cbh__card--provider .cbh__pname,
#connection-map .cbh__card--provider .cbh__status { display: none; }

.tank-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: var(--quota-level, 100%);
  background: linear-gradient(180deg, var(--tank-liquid-a), var(--tank-liquid-b));
  transition: height 800ms var(--ease), background 400ms var(--ease);
}
.usage-tank-entering .tank-liquid {
  animation: tank-fill-entry var(--tank-entry-duration, 1400ms) var(--ease) var(--tank-entry-delay, 0ms) both;
  transition: none;
}
@keyframes tank-fill-entry { from { height: 0; } to { height: var(--quota-level, 100%); } }
.tank-wave {
  position: absolute;
  left: 0;
  bottom: calc(100% - 1px);
  width: 200%;
  height: 13px;
  color: var(--tank-liquid-a);
  animation: tank-drift 7s linear infinite;
}
.tank-wave svg { display: block; width: 100%; height: 100%; }
@keyframes tank-drift { to { transform: translateX(-50%); } }
.tank-brand {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font: 600 14px/1 var(--brand-font);
}
.tank-submerged .tank-brand { color: var(--tank-value); }
.tank-logo { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
.tank-package {
  max-width: calc(100% - 12px);
  overflow: hidden;
  color: var(--ink-soft, var(--ink));
  font: 500 11px/1.2 var(--mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tank-package[hidden] { display: none; }
.tank-submerged .tank-package { color: var(--tank-value); }
.tank-value {
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(88px, calc(100% - var(--quota-level, 100%)), calc(100% - 26px));
  z-index: 3;
  color: var(--tank-value);
  text-align: center;
  font: 600 28px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgb(0 0 0 / 35%);
  transform: translateY(-50%);
  transition: top 800ms var(--ease);
}
.usage-unlimited .tank-value { top: 55%; font-size: 38px; }
/* The package lines sit under the brand; keep the number below them. */
/* Package: "31.5M/50M" in place of the percent, the total smaller; the unit line
   sits under the brand, so the number stays below it. */
.has-package .tank-value {
  top: clamp(100px, calc(100% - var(--quota-level, 100%)), calc(100% - 26px));
  padding: 0 6px;
  font-size: 24px;
  white-space: nowrap;
}
.pkg-fraction { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pkg-total { margin-left: 1px; font-size: .62em; font-weight: 500; opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  .motion-panel::before, .motion-halo, .tank-wave { animation: none; }
}
