/* Platform-owner console. Loaded after bardeon-admin.css and admin-ui.css.
   Hero cards and chart panels match the band engagement dashboard. */

.platform-page.section.ui-page { max-width: 1440px; }
.platform-page h1 { margin: 0 0 4px; font-size: clamp(1.4rem, 2.4vw, 1.9rem); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.launch-status { margin: 0 0 14px; }
.launch-hold-card { margin-bottom: 14px; }
.launch-hold-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.launch-hold-form .maint-item { margin: 0; }
.platform-head { align-items: flex-end; margin-bottom: 14px; }
.platform-head .ui-lead { margin-bottom: 0; }
.platform-badge { color: var(--gold); }
.inline-form { display: inline; margin: 0; }
.inline-form button.linkish { padding: 0; min-height: 0; }
.platform-crumb { margin: 0 0 8px; }
.platform-login-note { color: var(--muted); font-size: var(--t-small); margin: -4px 0 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Hero cards (same look as engagement.css) */
.hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.platform-hero { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.hero-card { position: relative; overflow: hidden; border-radius: 12px; padding: 14px 14px 12px;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--bg-raise);
  border: 1px solid var(--line); border-top: 2px solid var(--accent); }
.hero-card h2 { margin: 0; font-size: .75rem; font-weight: normal; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hero-value { margin: 6px 0 2px; font-size: 2rem; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.hero-change { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
.hero-change.muted { color: var(--faint); font-size: .78rem; }
.server-card { border-top-color: var(--gold); }
.server-stats { margin: 8px 0 0; display: grid; gap: 6px; }
.server-stats div { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.server-stats dt { color: var(--muted); font-size: .8rem; }
.server-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.server-stats small { display: block; font-weight: normal; color: var(--faint); font-size: .72rem; }

/* Band table */
.platform-search { flex: 1 1 260px; max-width: 420px; }
.platform-search input { width: 100%; min-height: 40px; margin: 0; box-sizing: border-box; }
.ui-table-wrap { overflow-x: auto; }
.platform-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.platform-table th, .platform-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.platform-table th { position: sticky; top: 0; background: var(--bg-raise); white-space: nowrap; font-weight: 600; color: var(--muted); font-size: .78rem; }
.platform-table th button { all: unset; cursor: pointer; }
.platform-table th button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.platform-table th[aria-sort="ascending"] button::after { content: " ▲"; color: var(--gold); }
.platform-table th[aria-sort="descending"] button::after { content: " ▼"; color: var(--gold); }
.platform-table .num { text-align: right; white-space: nowrap; }
.platform-table td { white-space: nowrap; }
.platform-table td.band-cell { white-space: normal; min-width: 150px; }
.platform-table small { color: var(--faint); font-size: .74rem; }
.platform-table .band-cell a { color: var(--text); text-decoration: none; }
.platform-table .band-cell a:hover strong { color: var(--gold); text-decoration: underline; }
.platform-table .band-cell small { display: block; }
.platform-table tbody tr:hover { background: color-mix(in srgb, var(--bg-sunk) 55%, transparent); }
.platform-footnote { margin: 10px 0 0; max-width: 90ch; }
.ui-pill.status-active { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-wash); }
.ui-pill.status-paused, .ui-pill.status-inactive { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-wash); }
.ui-pill.status-deleted { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-wash); }
.audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .88rem; }
.audit-list time { color: var(--faint); font-variant-numeric: tabular-nums; margin-right: 6px; }
.audit-list small { color: var(--muted); }

/* Charts */
.platform-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.chart-panel { padding: 14px 16px; border-radius: 12px; background: var(--bg-raise); border: 1px solid var(--line); }
.chart-panel h2 { margin: 0; font-size: 1.02rem; }
.chart-panel .ui-card-head { margin-bottom: 8px; }
svg.bars { display: block; width: 100%; height: 140px; }
svg.bars rect { fill: var(--accent); opacity: .85; }
svg.bars rect:hover { fill: var(--gold); opacity: 1; }
svg.bars .axis { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-scale { display: flex; justify-content: space-between; margin: 4px 0 0; color: var(--faint); font-size: .74rem; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--bg-sunk); margin: 8px 0 12px; }
.seg.db, .key.db { background: var(--slate); }
.seg.up, .key.up { background: var(--gold); }
.seg.mu, .key.mu { background: var(--accent); }
.storage-list { margin: 0; display: grid; gap: 8px; }
.storage-list div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.storage-list dt { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.storage-list dd { margin: 0; text-align: right; font-weight: 700; }
.storage-list small { display: block; color: var(--faint); font-weight: normal; font-size: .74rem; }
.key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.platform-page > .hint { margin: 10px 0 14px; }

/* Danger zone and dialogs */
.danger-zone { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.danger-zone h2 { color: var(--bad); }
.platform-page button:disabled { opacity: .5; cursor: not-allowed; }
dialog.platform-dialog { width: min(480px, calc(100vw - 32px)); box-sizing: border-box; padding: 20px; border-radius: 14px;
  border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); background: var(--bg-raise); color: var(--text); }
dialog.platform-dialog::backdrop { background: rgba(8, 7, 5, .72); backdrop-filter: blur(2px); }
dialog.platform-dialog h2 { margin: 0 0 8px; font-size: 1.2rem; }
dialog.platform-dialog p { color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
dialog.platform-dialog .ui-field { margin-bottom: 12px; }
dialog.platform-dialog input { width: 100%; box-sizing: border-box; min-height: 42px; margin: 0; }
dialog.platform-dialog code { color: var(--gold); font-family: var(--font-mono); }
dialog.platform-dialog .ui-actions button { width: auto; margin: 0; }

@media (max-width: 760px) {
  .hero, .platform-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .server-card { grid-column: 1 / -1; }
  .hero-value { font-size: 1.55rem; }
  .platform-charts { grid-template-columns: 1fr; }
  /* The band table turns into cards on phones */
  .platform-table thead { display: none; }
  .platform-table, .platform-table tbody, .platform-table tr, .platform-table td { display: block; width: 100%; box-sizing: border-box; }
  .platform-table tr { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-sunk);
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .platform-table td { border: 0; padding: 2px 0; text-align: left !important; white-space: normal; }
  .platform-table td::before { content: attr(data-label); display: block; color: var(--faint); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
  .platform-table td.band-cell { grid-column: 1 / -1; font-size: 1rem; }
  .platform-table td.band-cell::before { display: none; }
  .platform-table td[colspan] { grid-column: 1 / -1; }
  .platform-search { max-width: none; }
}

/* The console needs the full width for the band table (band admin pages cap at 760px). */
@media (min-width: 900px) {
  body.platform:not(.login):not(.unknown-host) > main.platform-page {
    width: calc(100% - 288px);
    max-width: 1600px;
    margin: 24px 24px 72px 264px;
  }
}

/* Launch partner toggle on each band row */
.launch-partner-cell { min-width: 15rem; }
.launch-partner-form { display: flex; align-items: center; gap: 0.4rem; flex-wrap: nowrap; }
.launch-partner-form .lp-toggle { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; margin: 0; }
.launch-partner-form .lp-toggle input { width: auto; margin: 0; }
.launch-partner-form input[type='date'] { width: 8.6rem; min-width: 0; padding: 0.2rem 0.35rem; font-size: 0.8rem; height: auto; }
.launch-partner-form .ui-button.small, .launch-partner-form button { padding: 0.2rem 0.6rem; font-size: 0.8rem; min-height: 0; line-height: 1.4; }
.launch-partner-cell small { display: block; margin-top: 0.2rem; }
.maint-cell { min-width: 12rem; white-space: normal; }
.maint-menu { position: relative; }
.maint-menu summary { cursor: pointer; font-weight: 600; }
.maint-form { display: grid; gap: 0.35rem; margin-top: 0.5rem; min-width: 16rem; }
.maint-item { display: flex; gap: 0.4rem; align-items: center; }
.maint-item input { width: auto; margin: 0; }
