/* DankProxies V2 — component layer.
 *
 * Every component here is a single class family with no page-specific
 * overrides. The old panel.css problem was four parallel design systems
 * (.card / .oi-* / .customer-shell / .rental-*) sharing nothing; this file is
 * the one shared layer they should all have been built on.
 */

/* =========================================================== 1. surfaces */

.card {
  position: relative;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm), var(--glass-edge);
  padding: 20px;
}
.card.pad-lg  { padding: 28px; }
.card.pad-sm  { padding: 14px; }
.card.flush   { padding: 0; overflow: hidden; }
.card.hi      { background: var(--glass-hi); }
.card.lo      { background: var(--glass-lo); box-shadow: var(--glass-edge); }
.card.sink    { background: var(--bg-sink); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Interactive cards get lift + an accent edge, never a colour flip. */
.card.link {
  cursor: pointer;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.card.link:hover {
  transform: translateY(-3px);
  border-color: var(--line-hot);
  box-shadow: var(--shadow), var(--glass-edge);
}

/* The top-edge accent hairline: a 1px gradient rule that fades at both ends.
   Cheapest possible way to make a card feel deliberately placed. */
.card.edged::before {
  content: "";
  position: absolute;
  top: -1px; left: 14%; right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-hi), transparent);
  opacity: .75;
}

/* Cursor glare. v2.js writes --gx/--gy as a percentage of the card box; with
   no JS the layer simply never becomes visible. */
.card.glare::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t);
  background: radial-gradient(340px circle at var(--gx,50%) var(--gy,50%),
                              rgba(255,59,69,.10), transparent 62%);
}
.card.glare:hover::after { opacity: 1; }

.section { padding: clamp(56px, 8vw, 108px) 0; }
.section-tight { padding: clamp(36px, 5vw, 64px) 0; }
.container { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.container.narrow { max-width: var(--maxw-narrow); }

/* Section boundary: a gradient hairline, brightest at the centre. */
.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, var(--line-2) 22%, var(--line-hot) 50%, var(--line-2) 78%, transparent);
}

/* ============================================================ 2. eyebrow */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line-hot);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-hi);
  font: 700 var(--fs-2xs)/1 var(--font-ui);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulseDot 2.4s ease-out infinite;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(255,59,69,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(255,59,69,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,69,0); }
}
.eyebrow.ok    { border-color: rgba(47,225,167,.34);  background: var(--ok-soft);    color: var(--ok); }
.eyebrow.warn  { border-color: rgba(245,165,36,.34);  background: var(--warn-soft);  color: var(--warn); }
.eyebrow.info  { border-color: rgba(50,200,255,.34);  background: var(--info-soft);  color: var(--info); }
.eyebrow.plain { border-color: var(--line-2); background: rgba(255,255,255,.04); color: var(--muted); }

/* ============================================================ 3. buttons */

.btn {
  --btn-bg: var(--glass);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--text);
  font: 600 var(--fs)/1 var(--font-ui);
  letter-spacing: -.005em;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);
  /* Magnetic offset, written by v2.js. Absent JS it stays 0 and nothing moves. */
  translate: var(--mx, 0) var(--my, 0);
}
.btn:hover  { border-color: var(--line-hot); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn[disabled], .btn.is-disabled {
  opacity: .45; pointer-events: none; cursor: not-allowed;
}

/* Primary: gradient fill + red glow. The ::after is a brightness wipe that
   only exists on hover, so the idle button costs nothing to composite. */
.btn.primary {
  border-color: transparent;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 10px 28px -12px var(--accent-glow), var(--glass-edge);
  position: relative;
  overflow: hidden;
}
.btn.primary:hover {
  box-shadow: 0 16px 40px -14px var(--accent-glow), var(--glass-edge);
  color: #fff;
}
.btn.primary::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.28), transparent 70%);
  transform: translateX(-120%);
  transition: transform var(--t-slow);
}
.btn.primary:hover::after { transform: translateX(120%); }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,.045); }

.btn.subtle { border-color: transparent; background: rgba(255,255,255,.045); }
.btn.subtle:hover { background: rgba(255,255,255,.08); border-color: var(--line-2); }

.btn.danger {
  border-color: rgba(217,26,34,.4);
  background: rgba(217,26,34,.14);
  color: #ff8f95;
}
.btn.danger:hover { background: rgba(217,26,34,.22); color: #ffb4b8; }

.btn.sm  { padding: 7px 13px;  font-size: var(--fs-sm); border-radius: var(--r-xs); }
.btn.lg  { padding: 14px 26px; font-size: var(--fs-md); border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn.icon { padding: 9px; width: 36px; height: 36px; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Small square control used in toolbars and card headers. */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-hot); background: rgba(255,255,255,.045); }
.icon-btn svg { width: 17px; height: 17px; }

/* ============================================================== 4. pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font: 600 var(--fs-2xs)/1.5 var(--font-ui);
  letter-spacing: .01em;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pill.bare::before { display: none; }
.pill.ok      { color: var(--ok);      background: var(--ok-soft);      border-color: rgba(47,225,167,.28); }
.pill.warn    { color: var(--warn);    background: var(--warn-soft);    border-color: rgba(245,165,36,.28); }
.pill.info    { color: var(--info);    background: var(--info-soft);    border-color: rgba(50,200,255,.28); }
.pill.danger  { color: #ff8f95;        background: var(--accent-soft);  border-color: rgba(217,26,34,.30); }
.pill.violet  { color: var(--violet);  background: var(--violet-soft);  border-color: rgba(159,140,255,.28); }

/* ========================================================== 5. stat tile */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm), var(--glass-edge);
  transition: transform var(--t), border-color var(--t);
}
.tile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tile-label {
  color: var(--dim);
  font: 700 var(--fs-2xs)/1.4 var(--font-ui);
  letter-spacing: .10em;
  text-transform: uppercase;
}
.tile-icon {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-hi);
  flex: none;
}
.tile-icon svg { width: 15px; height: 15px; }
.tile-icon.ok   { background: var(--ok-soft);   color: var(--ok); }
.tile-icon.info { background: var(--info-soft); color: var(--info); }
.tile-icon.warn { background: var(--warn-soft); color: var(--warn); }
.tile-value {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -.032em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.tile-value .unit { font-size: .5em; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.tile-sub { margin-top: 5px; color: var(--muted); font-size: var(--fs-sm); }
.tile-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.tile-delta.up   { color: var(--ok); }
.tile-delta.down { color: #ff8f95; }

/* A hairline progress rail across the bottom edge of the tile. */
.tile-rail { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.06); }
.tile-rail > i {
  display: block; height: 100%;
  background: var(--accent-grad);
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  transform-origin: left;
  animation: railIn var(--t-slow) both;
}
.tile-rail.ok   > i { background: linear-gradient(90deg, #1c9d76, var(--ok)); }
.tile-rail.warn > i { background: linear-gradient(90deg, #b97a12, var(--warn)); }
@keyframes railIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ========================================================= 6. odometer */

/* Rolling-digit counter. Each digit is a 10-cell vertical strip translated by
   -N*10%. With JS off the strip sits at 0, so markup ships the final value in
   a .odo-static twin that JS hides — the number is never missing. */
.odo { display: inline-flex; align-items: baseline; font-variant-numeric: tabular-nums; }
.odo-digit {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  line-height: 1;
}
.odo-strip {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 1.15s cubic-bezier(.22,1,.36,1);
  transition-delay: var(--odo-delay, 0ms);
}
.odo-strip > span { height: 1em; line-height: 1; display: block; }
.odo-sep { display: inline-block; }

/* ============================================================ 7. tables */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  -webkit-overflow-scrolling: touch;
}
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
/* thead th only. The blanket `table.t th` version made <th scope="row">
   unusable — a row header would render as a dim uppercase label AND stick to
   the top of the viewport as you scrolled past it. */
table.t thead th {
  padding: 11px 14px;
  text-align: left;
  color: var(--dim);
  font: 700 var(--fs-2xs)/1.4 var(--font-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
  background: rgba(255,255,255,.02);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Sticky is opt-in, on the wrapper. A header that sticks inside a page that
   scrolls rather than inside its own box floats over unrelated content and
   slides under .topbar (z-index 35 against this 2). */
.table-wrap.sticky-head thead th { position: sticky; top: 0; z-index: 2; }

/* Row headers read as content, not as chrome. */
table.t tbody th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.t td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.t tbody tr { transition: background var(--t-fast); }
table.t tbody tr:hover { background: rgba(255,255,255,.028); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
table.t.dense td { padding: 8px 12px; }

/* ======================================================== 8. empty state */

/* One empty state, not two. The icon sits in a tinted disc with a soft ring;
   the CTA is always present so a dead-end screen never actually dead-ends. */
.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 52px 24px;
  text-align: center;
}
.empty-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hi);
  box-shadow: 0 0 0 8px rgba(217,26,34,.055);
}
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: var(--fs-lg); }
.empty p  { color: var(--muted); max-width: 44ch; }
.empty .btn { margin-top: 10px; }

/* ========================================================== 9. code/mono */

.code {
  position: relative;
  background: var(--bg-sink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.7;
  color: #d6d6de;
  overflow: auto;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.022);
  position: sticky;
  left: 0;
}
.code-body { padding: 12px 14px; margin: 0; white-space: pre; }
.code .tok-c { color: var(--dim); }              /* comment */
.code .tok-s { color: #9ee6c0; }                 /* string  */
.code .tok-k { color: #ff8f95; }                 /* keyword */
.code .tok-n { color: var(--info); }             /* number  */

/* Single-line copyable value: gateway host, credential line, API key. */
.copyfield {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg-sink);
  overflow: hidden;
}
.copyfield input, .copyfield .val {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  overflow-x: auto;
  white-space: nowrap;
}
.copyfield input:focus { outline: none; }
.copyfield .btn {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255,255,255,.035);
}
.copyfield .btn:hover { background: rgba(255,255,255,.075); transform: none; }

/* Copy confirmation, driven by a data attribute so it needs no extra node. */
[data-copy] { position: relative; }
[data-copy].copied::after {
  content: "Copied";
  position: absolute;
  top: 50%; right: calc(100% + 8px);
  transform: translateY(-50%);
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--ok);
  color: #04120d;
  font: 700 var(--fs-2xs)/1.4 var(--font-ui);
  white-space: nowrap;
  animation: copiedIn 180ms cubic-bezier(.2,1.5,.4,1);
}
@keyframes copiedIn { from { opacity: 0; transform: translateY(-50%) scale(.8); } }

/* ============================================================= 10. forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  color: var(--text);
  font: 600 var(--fs-sm)/1.4 var(--font-ui);
}
.field .hint { color: var(--dim); font-size: var(--fs-xs); line-height: 1.5; }
.field .err  { color: #ff8f95; font-size: var(--fs-xs); }

.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(0,0,0,.28);
  color: var(--text);
  font: 400 var(--fs)/1.5 var(--font-ui);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  appearance: none;
}
.input::placeholder { color: var(--dim); }
.input:hover  { border-color: rgba(255,255,255,.2); }
.input:focus  { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: rgba(0,0,0,.38); }
.input:disabled { opacity: .5; cursor: not-allowed; }
/* An invalid field has to look invalid, not merely have a red sentence
   underneath it that a sighted user may never connect to the control. */
.input[aria-invalid="true"], .input.is-error {
  border-color: #ff6b73;
  box-shadow: 0 0 0 3px rgba(255,59,69,.14);
}
.input.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }

/* Native select needs its own chevron once appearance is stripped. */
select.input {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a2a2ae' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
}
select.input option { background: #131318; color: var(--text); }

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input {
  appearance: none;
  width: 17px; height: 17px;
  margin: 1px 0 0;
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: rgba(0,0,0,.3);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
/* Layer order matters: the first background layer paints on TOP. The tick has
   to come first or the gradient covers it and a checked box renders as a
   plain red square. */
.check input:checked {
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / 13px no-repeat,
    var(--accent-grad);
  border-color: transparent;
}

/* Radio variant: same control, round, and a dot instead of a tick. */
.check.radio input { border-radius: 50%; }
.check.radio input:checked {
  background:
    radial-gradient(circle at 50% 50%, #fff 0 3.2px, transparent 3.4px),
    var(--accent-grad);
}

/* Segmented control — the product/range tab bar. */
.seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(0,0,0,.28);
}
.seg > * {
  padding: 7px 14px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  font: 600 var(--fs-sm)/1.2 var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.seg > *:hover { color: var(--text); background: rgba(255,255,255,.05); }
.seg > .is-on, .seg > [aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent-hi);
  box-shadow: inset 0 0 0 1px rgba(217,26,34,.3);
}
/* Fill the container and share the width evenly, for a control that spans a
   card rather than sitting inline in a toolbar. */
.seg.block { display: flex; width: 100%; }
.seg.block > * { flex: 1 1 0; text-align: center; padding-inline: 8px; }

/* Range slider — both engines need explicit thumb styling. */
.range { width: 100%; height: 22px; background: transparent; appearance: none; cursor: pointer; }
.range::-webkit-slider-runnable-track {
  height: 5px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent) var(--range-pct, 0%), rgba(255,255,255,.1) var(--range-pct, 0%));
}
.range::-moz-range-track { height: 5px; border-radius: var(--r-pill); background: rgba(255,255,255,.1); }
.range::-moz-range-progress { height: 5px; border-radius: var(--r-pill); background: var(--accent); }
.range::-webkit-slider-thumb {
  appearance: none;
  width: 17px; height: 17px;
  margin-top: -6px;
  border: 2px solid var(--accent-hi);
  border-radius: 50%;
  background: #14141a;
  box-shadow: 0 0 0 4px rgba(217,26,34,.16), 0 2px 8px rgba(0,0,0,.6);
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.range::-moz-range-thumb {
  width: 17px; height: 17px;
  border: 2px solid var(--accent-hi);
  border-radius: 50%;
  background: #14141a;
  box-shadow: 0 0 0 4px rgba(217,26,34,.16);
}
.range:hover::-webkit-slider-thumb  { box-shadow: 0 0 0 7px rgba(217,26,34,.2), 0 2px 8px rgba(0,0,0,.6); }
.range:active::-webkit-slider-thumb { transform: scale(1.12); }

/* ============================================================ 11. alerts */

.alert {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--line-2);
  border-left-width: 3px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.035);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.alert strong { display: block; margin-bottom: 2px; font-weight: 650; }
.alert.ok      { border-left-color: var(--ok);     background: var(--ok-soft);     color: #b6f2dc; }
.alert.warn    { border-left-color: var(--warn);   background: var(--warn-soft);   color: #f7dda8; }
.alert.info    { border-left-color: var(--info);   background: var(--info-soft);   color: #b3e9ff; }
.alert.danger  { border-left-color: var(--accent); background: var(--accent-soft); color: #ffbabe; }

/* ============================================================ 12. toasts */

/* The panel has no toast at all today: every mutation is a POST→303 reload
   with no confirmation. This is the surface for that. */
.toasts {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  max-width: 380px;
  padding: 12px 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(19,19,24,.94);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), var(--glass-edge);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toastIn 320ms cubic-bezier(.2,1.4,.4,1);
}
.toast.out { animation: toastOut 200ms ease-in forwards; }
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok     svg { color: var(--ok); }
.toast.danger svg { color: var(--accent-hi); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(24px); } }

/* ========================================================== 13. skeleton */

.skel {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 37%, rgba(255,255,255,.04) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s linear infinite;
}
.skel.line { height: 11px; margin: 6px 0; }
.skel.line.w60 { width: 60%; }
.skel.line.w40 { width: 40%; }
@keyframes shimmer { to { background-position: -135% 0; } }

/* ========================================================= 14. accordion */

.acc { border-bottom: 1px solid var(--line); }
.acc > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 2px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  transition: color var(--t-fast);
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover { color: var(--accent-hi); }
.acc > summary .chev {
  flex: none;
  width: 17px; height: 17px;
  color: var(--accent-hi);
  transition: transform var(--t);
}
.acc[open] > summary .chev { transform: rotate(180deg); }
.acc-body { padding: 0 2px 18px; color: var(--muted); line-height: 1.7; max-width: 70ch; }

/* ========================================================== 15. telemetry */

/* Dark inset instrument panel: the one place in the design where contrast is
   deliberately maximal, because it reads as a readout rather than a card. */
.telemetry {
  background: var(--bg-sink);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 16px;
  font-family: var(--font-mono);
}
.telemetry-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 13px;
  font-size: var(--fs-2xs);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--dim);
}
.telemetry-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: var(--fs-xs);
}
.telemetry-row .k { color: var(--muted); }
.telemetry-row .v { color: var(--text); font-variant-numeric: tabular-nums; }
.meter { height: 4px; border-radius: var(--r-pill); background: rgba(255,255,255,.07); overflow: hidden; }
.meter > i {
  display: block; height: 100%;
  border-radius: inherit;
  background: var(--accent-grad);
  transform-origin: left;
  animation: railIn 900ms cubic-bezier(.22,1,.36,1) both;
}
.meter.ok   > i { background: linear-gradient(90deg, #1c9d76, var(--ok)); }
.meter.warn > i { background: linear-gradient(90deg, #b97a12, var(--warn)); }
.meter.info > i { background: linear-gradient(90deg, #1d7fa3, var(--info)); }

/* ============================================================ 16. charts */

/* Pure-SVG bar/area charts. No Chart.js: `script-src 'self'` blocks the CDN
   and self-hosting 200 KB for six charts is not a trade worth making. */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: rgba(255,255,255,.055); stroke-width: 1; }
.chart .axis text  { fill: var(--dim); font-size: 10px; font-family: var(--font-ui); }
/* No `fill` here: each chart instance owns a uniquely-named gradient and sets
   it as a presentation attribute. A CSS `fill` would outrank that attribute
   and point every chart at one shared id, which only the first chart on a
   page actually defines. */
.chart .bar {
  transform-origin: bottom;
  animation: barIn 620ms cubic-bezier(.22,1,.36,1) both;
  transition: opacity var(--t-fast);
}
.chart .bar:hover { opacity: .75; }
/* Area charts are hand-authored; give each one its own gradient id and set it
   as a `fill` presentation attribute on the path, the way the bar renderer
   does. A CSS rule here would pin every area chart on the page to one shared
   id that only the first chart defines. */
.chart .area { fill-opacity: 1; }
.chart .line { fill: none; stroke: var(--accent-hi); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
@keyframes barIn { from { transform: scaleY(0); } }

.chart-tip {
  position: absolute;
  z-index: 20;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  background: rgba(15,15,19,.96);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-xs);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.chart-tip.on { opacity: 1; }
.chart-wrap { position: relative; }

/* ============================================================ 17. ticker */

/* Seamless loop requires TWO identical .ticker-track children — the keyframe
   translates one full track width, so a single track leaves a visible gap on
   every wrap. Mark the duplicate aria-hidden so the content is announced once. */
.ticker {
  display: flex;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker-track {
  display: flex;
  gap: 34px;
  /* Trailing padding, not a gap on .ticker: the keyframe translates one full
     track width, and that width includes this padding — so the seam between
     the last item of one track and the first of the next gets the same 34px
     as every other gap, and the loop still lands exactly. A gap on .ticker
     would fall outside the translated distance and make the marquee drift. */
  padding: 11px 34px 11px 0;
  flex: none;
  min-width: 100%;
  animation: marquee var(--marquee-dur, 46s) linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track.rev { animation-direction: reverse; }
@keyframes marquee { to { transform: translateX(-100%); } }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}

/* ========================================================= 18. dialog */

dialog.v2-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: rgba(17,17,21,.97);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.v2-dialog::backdrop { background: rgba(4,4,6,.72); backdrop-filter: blur(4px); }
.dialog-head { padding: 18px 20px 0; }
.dialog-body { padding: 12px 20px 20px; color: var(--muted); line-height: 1.65; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}

/* ======================================================= 19. page header */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.05rem); }
.page-head .lead { margin-top: 5px; font-size: var(--fs); }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ========================================================== 20. sections */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head h2, .panel-head h3 { font-size: var(--fs-md); }
.panel-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

/* ============================================================ 21. grids */

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.82fr); gap: 20px; align-items: start; }
.split-side { display: grid; grid-template-columns: 340px minmax(0,1fr); gap: 20px; align-items: start; }

/* ================================================== 22. icon safety net */

/* An inline <svg> with a viewBox and no dimensions falls back to the replaced
   -element default of 300×150 and destroys whatever contains it. Components
   that expect an icon size theirs explicitly above; this catches every other
   context — a pill, a ticker item, a delta, a bare heading — so a new
   ic.icon() call can never blow up a layout. */
/* :where() so this contributes ZERO specificity — a bare `svg:not([width])`
   scores (0,2,1) and would outrank `.btn svg`, shrinking every sized icon in
   the system to 1em.
   `.chart` is excluded by name: a chart sets its own height in JS, and an
   earlier version of this rule silently collapsed every chart on the site to
   14px because CSS `height` had nothing else to lose to. */
svg:where(:not([width]):not([height]):not(.chart)) { width: 1em; height: 1em; }
.tile-delta svg, .ticker-item svg, .pill svg, .field .err svg,
.telemetry-row svg, .eyebrow svg { width: 13px; height: 13px; flex: none; }
h1 svg, h2 svg, h3 svg, h4 svg { width: 1em; height: 1em; vertical-align: -.1em; }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split, .split-side { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0,1fr); }
  .card { padding: 16px; }
  .card.pad-lg { padding: 20px; }
}

/* ============================================= 23. renewal reminder banner */

/* Injected by /static/renewal-reminder.js from /billing/renewals. The script
   is shared with V1, so these class names are its contract, not ours — they
   are restyled onto V2 tokens rather than renamed.
   Warn-tinted rather than accent: an upcoming charge is a heads-up, and if it
   used the brand red it would compete with every destructive control on the
   page for the same alarm. */
.renewal-reminder {
  border-bottom: 1px solid rgba(245,165,36,.28);
  background: linear-gradient(135deg, rgba(245,165,36,.10), transparent 58%), var(--bg-raise);
}
.renewal-reminder-inner {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
}
.renewal-card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.renewal-body { flex: 1 1 22rem; min-width: 0; }
.renewal-card-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.renewal-eyebrow {
  color: var(--warn);
  font: 700 var(--fs-2xs)/1.4 var(--font-ui);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.renewal-plan { font-weight: 650; font-size: var(--fs-sm); }
.renewal-line { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.renewal-count { color: var(--dim); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.renewal-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.renewal-pager { display: flex; align-items: center; gap: 6px; }
.renewal-step {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.renewal-step:hover:not(:disabled) { color: var(--text); border-color: var(--line-hot); }
.renewal-step:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 760px) {
  .renewal-reminder-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .renewal-actions { width: 100%; justify-content: space-between; }
}
