/*
 * SKYOS Update Server — SkyCommand design system (ported from
 * skycommand/packages/design-system + ui/components/shell/shell.css)
 */

/* ---- Design tokens ----------------------------------------------------- */
:root {
  --bg: #070a0f;
  --surface: #0d1219;
  --surface-1: #111820;
  --card: #161d27;
  --elevated: #1e2733;
  --overlay: #252f3d;
  --popover: var(--overlay);
  --popover-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border);
  --border: #2a3544;
  --border-soft: #1a222c;
  --border-focus: rgba(214, 204, 153, 0.45);
  --brand: #d6cc99;
  --brand-dim: rgba(214, 204, 153, 0.16);
  --brand-muted: rgba(214, 204, 153, 0.09);
  --teal: var(--brand);
  --teal-dim: var(--brand-dim);
  --teal-muted: var(--brand-muted);
  --blue: #38bdf8;
  --text: #eef2f7;
  --text-2: #94a0ae;
  --text-3: #6b7583;
  --green: var(--brand);
  --green-tint: var(--brand-dim);
  --amber: #f5b942;
  --red: #ef4444;
  --grey: #6b7583;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-glow-teal: 0 0 24px rgba(214, 204, 153, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --surface-glass: color-mix(in srgb, var(--surface) 78%, transparent);
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- Typography -------------------------------------------------------- */
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { opacity: 0.85; }

code, .mono, pre {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---- Animations -------------------------------------------------------- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.fade-in { animation: fadeIn 0.4s ease-out both; }
.fade-in > * {
  opacity: 0;
  animation: fade-in-up 0.45s ease-out both;
}
.fade-in > :nth-child(1) { animation-delay: 0.04s; }
.fade-in > :nth-child(2) { animation-delay: 0.1s; }
.fade-in > :nth-child(3) { animation-delay: 0.16s; }
.fade-in > :nth-child(4) { animation-delay: 0.22s; }
.fade-in > :nth-child(5) { animation-delay: 0.28s; }
.fade-in > :nth-child(6) { animation-delay: 0.34s; }

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .fade-in > * {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ---- Background -------------------------------------------------------- */
.grid-bg {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -20%, rgba(214, 204, 153, 0.04), transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 10%, rgba(56, 189, 248, 0.03), transparent 50%);
}

/* ---- Scroll ------------------------------------------------------------ */
.scroll { overflow-y: auto; }
.scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ---- App shell --------------------------------------------------------- */
.app {
  --sidebar-width: 252px;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
}

.content { flex: 1; min-height: 0; }
.content.scroll { overflow-y: auto; }

/* ---- Sidebar brand + nav ----------------------------------------------- */
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 16px 12px 8px 14px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  text-decoration: none;
  color: inherit;
}
.brand .mark {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand .mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand .name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand .name span { font-weight: 400; color: var(--text-3); }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 10px;
}
.nav-section { margin-bottom: 20px; }
.nav-section:last-child { margin-bottom: 4px; }
.nav-section .sec-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: color-mix(in srgb, var(--text) 88%, var(--text-3));
  padding: 0 12px 8px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.nav-item svg { width: 18px; height: 18px; transition: color 0.15s; }
.nav-item:hover {
  background: var(--elevated);
  color: var(--text);
  text-decoration: none;
}
.nav-item:active {
  background: var(--overlay);
}
.nav-item.active {
  background: var(--elevated);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active .nav-item-label,
.nav-item.active .nav-item-icon { color: var(--brand); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--teal);
}

.api-status {
  margin: 8px;
  padding: 10px 12px;
  flex-shrink: 0;
  background: var(--elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.api-status .row { display: flex; align-items: center; gap: 8px; }
.api-status .blip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(214, 204, 153, 0.45);
  animation: pulse 2.4s infinite;
}
.api-status .label { font-size: 12px; color: var(--text-2); }
.api-status p { font-size: 10.5px; color: var(--text-3); margin-top: 5px; }

/* ---- Header ------------------------------------------------------------ */
.header {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: relative;
  z-index: 50;
  background: transparent;
  border-bottom: 1px solid var(--border-soft);
}
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 0;
  pointer-events: none;
}
.header > * { position: relative; z-index: 1; }
.header-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.spacer { flex: 1; }

/* ---- Layout primitives ------------------------------------------------- */
.ds-screen { padding: 16px 24px 24px; }
.ds-stack { display: flex; flex-direction: column; }
.ds-gap-12 { gap: 12px; }
.ds-gap-18 { gap: 18px; }

.breadcrumb {
  font-size: 13px;
  color: var(--text-2);
  margin: -6px 0 0;
}
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Cards ------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card.hoverable {
  transition: border-color 0.18s, box-shadow 0.18s;
}
.card.hoverable:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm), var(--shadow-glow-teal);
  text-decoration: none;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
  font-size: 14px;
}
.card-head .sub {
  color: var(--text-3);
  font-weight: 400;
  font-size: 12px;
}
.card-body { padding: 16px; }

/* ---- Summary stats ----------------------------------------------------- */
.summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  min-width: 140px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.stat:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}
.stat-icon-teal {
  background: var(--brand-muted);
  color: var(--brand);
}
.stat-icon-blue {
  background: rgba(56, 189, 248, 0.1);
  color: var(--blue);
}
.stat-icon-amber {
  background: rgba(245, 185, 66, 0.1);
  color: var(--amber);
}
.stat .num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .num.t-teal { color: var(--teal); }
.stat .num.t-green { color: var(--green); }
.stat .num.t-amber { color: var(--amber); }
.stat .num.t-red { color: var(--red); }
.stat .lbl {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-top: 3px;
}

/* ---- Tables ------------------------------------------------------------ */
table.grid-table {
  display: table;
  width: 100%;
  border-collapse: collapse;
}
table.grid-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  font-weight: 500;
  padding: 10px 14px;
  background: var(--elevated);
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  user-select: none;
}
table.grid-table th.sorted-asc::after { content: " ▲"; font-size: 9px; }
table.grid-table th.sorted-desc::after { content: " ▼"; font-size: 9px; }
table.grid-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  transition: background 0.15s ease;
}
table.grid-table tr:hover td { background: var(--teal-muted); }
table.grid-table a { text-decoration: none; }
table.grid-table a:hover { text-decoration: underline; }
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-soft);
  background: var(--elevated);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.btn:hover {
  border-color: var(--border);
  background: var(--overlay);
  text-decoration: none;
}
.btn.primary {
  background: var(--teal);
  color: #14120e;
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover {
  background: color-mix(in srgb, var(--teal) 90%, white);
  box-shadow: var(--shadow-sm), var(--shadow-glow-teal);
  transform: translateY(-1px);
}
.btn:active {
  transform: scale(0.97);
  transition-duration: 0.06s;
}
.btn.primary:active {
  transform: scale(0.97);
  box-shadow: none;
}
.btn.sm { padding: 5px 10px; font-size: 12px; }

.btn.danger {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}

.btn.danger:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

.hidden { display: none !important; }

.ds-text-error { color: var(--red); }

.card-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-head-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 10, 15, 0.72);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(520px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Wide enough for a 64-char hex API key on one line (mono 12px + padding). */
.modal.modal-api-key {
  width: min(640px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-head h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-body {
  padding: 16px 18px 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Pills ------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.green { background: var(--green-tint); color: var(--green); }
.pill.teal { background: var(--teal-dim); color: var(--teal); }
.pill.amber { background: rgba(240, 173, 78, 0.15); color: var(--amber); }
.pill.red { background: rgba(220, 53, 69, 0.15); color: var(--red); }
.dot-green { background: var(--green); }
.dot-teal { background: var(--teal); }

/* ---- Notes + empty states ---------------------------------------------- */
.note {
  font-size: 11px;
  color: var(--text-3);
  padding: 8px 12px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.note-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
}

.latest-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  background: linear-gradient(135deg, var(--card) 0%, color-mix(in srgb, var(--card) 94%, var(--brand)) 100%);
  box-shadow: var(--shadow-xs);
}
.latest-banner-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand);
}
.latest-banner-file {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.latest-banner-meta {
  font-size: 12px;
  color: var(--text-3);
}
.latest-banner .btn { margin-left: auto; }

.ds-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 16px;
  text-align: center;
}
.ds-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
}
.ds-empty-icon-success {
  background: var(--green-tint);
  color: var(--green);
}
.ds-empty-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

/* ---- Metadata grid ----------------------------------------------------- */
.ds-metagrid {
  display: grid;
  gap: 6px 16px;
  font-size: 12px;
  margin: 0 0 16px;
}
.ds-metagrid-min160 {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.ds-metagrid-rg10 { row-gap: 10px; }
.ds-metagrid-label { color: var(--text-3); margin-bottom: 2px; }
.ds-metagrid-value { margin: 0; font-weight: 500; color: var(--text); }

/* ---- Code blocks ------------------------------------------------------- */
.code-block {
  position: relative;
  background: var(--elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.code-block pre {
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.5;
  color: var(--text);
}
.code-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
}
.copy-btn.copied {
  color: var(--green) !important;
  border-color: var(--border-focus) !important;
}

.acct-api-key-code {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  color: inherit;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  line-height: 1.5;
  word-break: break-all;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Full key in the reveal modal — keep on one line when the wide modal fits. */
.modal-api-key .acct-api-key-code {
  white-space: nowrap;
  overflow-x: auto;
  word-break: normal;
  overflow-wrap: normal;
}

.release-notes {
  white-space: pre-wrap;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.api-intro {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.api-intro p {
  color: var(--text);
  margin: 0 0 12px;
}
.api-intro strong {
  color: var(--brand);
  font-weight: 600;
}
.api-intro-hosts {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}
.api-intro-hosts dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 2px;
}
.api-intro-hosts dd {
  margin: 0;
  color: var(--text);
}
.api-intro-hosts code,
.api-intro code {
  color: var(--brand);
  font-size: 12px;
}
.api-intro-detail {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0 0 12px;
}
.api-intro-detail strong {
  color: var(--text);
  font-weight: 600;
}
.api-intro-detail code {
  color: var(--brand);
}
.api-intro-example {
  margin: 0;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-x: auto;
}
.api-endpoint-note {
  font-size: 12px;
  color: var(--text-2);
  margin: 0 0 8px;
}
.api-endpoint-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

/* ---- Platform browse select -------------------------------------------- */
.platform-select-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  max-width: 32rem;
}

.platform-select-row .ds-select-wrap {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.platform-select-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
}

/* ---- Browse image groups (bin + archive expand) ------------------------ */
.image-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--overlay);
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.image-group-toggle:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.image-group-toggle-icon {
  display: inline-block;
  width: 0.75rem;
  text-align: center;
  font-weight: 700;
  transform: translateY(-1px);
}

.image-group-parent.is-expanded .image-group-toggle-icon {
  transform: none;
}

.image-group-version {
  vertical-align: middle;
}

.image-group-child td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
}

.image-group-child-indent {
  border-left: 2px solid var(--border);
}

.image-group-child-label {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--overlay);
  color: var(--text-2);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Hidden native select — custom menu drives UX (SkyCommand Select pattern) */
.ds-select-native-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Design-system Select (from skycommand/packages/design-system) ---- */
.ds-select-wrap {
  position: relative;
  width: 100%;
}

.ds-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--overlay);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.ds-select-trigger:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--border) 70%, var(--text-3));
}

.ds-select-trigger[aria-expanded="true"] {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(214, 204, 153, 0.12);
  background: color-mix(in srgb, var(--overlay) 92%, var(--text));
}

.ds-select-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ds-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-select-label-placeholder {
  color: var(--text-3);
}

.ds-select-chevron {
  flex-shrink: 0;
  color: var(--text-3);
  transition: transform 0.15s;
}

.ds-select-chevron-open {
  transform: rotate(180deg);
}

.ds-select-menu {
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--popover-shadow);
  max-height: min(280px, calc(100vh - 16px));
  overflow-y: auto;
}

.ds-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.ds-select-option:hover:not(:disabled) {
  background: var(--elevated);
}

.ds-select-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ds-select-option.on {
  background: var(--brand-muted);
  color: var(--text);
}

.ds-select-check {
  flex-shrink: 0;
  color: var(--brand);
}

/* ---- Platform grid (legacy) -------------------------------------------- */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.platform-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
}
.platform-name {
  font-weight: 600;
  font-size: 14px;
  text-transform: capitalize;
}
.platform-arrow { color: var(--text-3); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 768px) {
  .app { --sidebar-width: 56px; }
  .brand-label,
  .sec-label,
  .nav-item-label,
  .api-status .label,
  .api-status p { display: none; }
  .nav-item { justify-content: center; padding: 10px 8px; }
  .nav-item.active::before { display: none; }
  .sidebar-head { padding: 10px 6px 8px; justify-content: center; }
  .brand { justify-content: center; }
  .api-status { margin: 8px 6px; padding: 10px 8px; }
  .api-status .row { justify-content: center; }
  .summary { flex-direction: column; }
  .stat { min-width: 0; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ---- Login page (HQ-style) -------------------------------------------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -20%, rgba(214, 204, 153, 0.06), transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 10%, rgba(56, 189, 248, 0.04), transparent 50%);
}

.login-panel {
  width: 100%;
  max-width: 420px;
  padding: 36px 36px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-md, 0 8px 28px rgba(0, 0, 0, 0.32));
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-company-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.login-company-name .ai {
  font-weight: 400;
  color: var(--text-2);
}

.login-divider {
  height: 1px;
  margin: 0 0 28px;
  background: var(--border-soft);
}

.login-welcome {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}

.login-subtitle {
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}

.login-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
}

.login-msg {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.login-msg-info { color: var(--text-2); }
.login-msg-error { color: var(--amber, #f5b942); }

.login-footer {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
}

.ds-input {
  width: 100%;
  margin-top: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  background: var(--overlay);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.ds-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-muted);
}

.ds-input::placeholder {
  color: var(--text-3);
}

/* -- Changelog ------------------------------------------------------------ */
.changelog-card { margin-top: 1rem; }
.changelog-card .changelog-summary {
  margin-left: 12px;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-2);
}
.changelog { margin-top: 0; }
.changelog h4 {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--overlay);
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.changelog-empty .empty {
  padding: 0.5rem 0;
  color: var(--text-2);
  font-size: 13px;
}

.cl-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.cl-icon { margin-right: 6px; }
.cl-list { list-style: none; padding: 0; margin: 0; }
.cl-list li {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-list li:last-child { border-bottom: none; }

.cl-scope {
  display: inline-block;
  padding: 1px 8px;
  background: var(--brand-muted);
  color: var(--brand);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.cl-desc { flex: 1; }
.cl-hash {
  font-size: 0.75rem;
  color: var(--text-3);
  background: var(--overlay);
  padding: 1px 6px;
  border-radius: 3px;
}
.cl-pr {
  font-size: 0.78rem;
  color: var(--brand);
  font-weight: 500;
}

.cl-breaking { border-left: 3px solid #dc2626; }
.cl-breaking h4 { background: rgba(220, 38, 38, 0.12); color: #fca5a5; }
.cl-security { border-left: 3px solid #d97706; }
.cl-security h4 { background: rgba(217, 119, 6, 0.12); color: #fcd34d; }
.cl-feature { border-left: 3px solid #059669; }
.cl-feature h4 { background: rgba(5, 150, 105, 0.12); color: #6ee7b7; }
.cl-fix { border-left: 3px solid #2563eb; }
.cl-fix h4 { background: rgba(37, 99, 235, 0.12); color: #93c5fd; }
.cl-performance { border-left: 3px solid #7c3aed; }
.cl-performance h4 { background: rgba(124, 58, 237, 0.12); color: #c4b5fd; }
.cl-deprecation { border-left: 3px solid #6b7280; }
.cl-deprecation h4 { background: rgba(107, 114, 128, 0.12); color: #d1d5db; }
