/* TOKENET Apple-Inspired Topbar, Segmented Controls, Glass Cards & Model Gallery */
/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
}
.topbar .topbar-inner {
  width: min(100% - 24px, 1760px);
  min-height: 52px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  background: #141519; color: #f4f4f6;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
html[data-theme="dark"] .brand-mark {
  background: #1e2026; color: #ececf1;
  border-color: rgba(255, 255, 255, 0.14);
}
.brand-mark svg { width: 15.5px; height: 15.5px; }
.brand-text { display: flex; align-items: baseline; gap: 8px; }
.brand-text b { font-size: 14.5px; font-weight: 660; letter-spacing: 0.03em; }

.top-tabs {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2.5px; border-radius: 999px;
  background: transparent; border: 1px solid transparent;
  min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.top-tabs::-webkit-scrollbar { display: none; }
.top-tab {
  display: inline-flex; align-items: center; gap: 5px;
  height: 29px; padding: 0 11px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-2);
  font-size: 12.8px; font-weight: 500; white-space: nowrap; flex: 0 0 auto;
  transition: background-color .18s cubic-bezier(.2, .8, .2, 1), color .16s, box-shadow .18s;
}
.top-tab:hover { color: var(--text); background: var(--surface-2); }
.top-tab[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.72); color: var(--text); font-weight: 590;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 1px 4px rgba(15, 23, 42, 0.08), 0 0 0 0.5px rgba(15, 23, 42, 0.07);
}
html[data-theme="dark"] .top-tab[aria-selected="true"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.08) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 8px -2px rgba(0, 0, 0, 0.36), 0 0 0 0.5px rgba(255, 255, 255, 0.10);
}
.top-tab .tab-badge {
  min-width: 17px; height: 17px; padding: 0 5px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--surface-3);
  color: var(--text-2); font-family: var(--font-num); font-size: 11px; font-weight: 600; font-style: normal;
}
.top-tab[aria-selected="true"] .tab-badge {
  background: var(--primary-50); color: var(--primary);
}

.topbar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.clock { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; }
@media (max-width: 1560px) {
  .clock { display: none; }
}
@media (max-width: 1360px) {
  .brand-text span { display: none; }
  .cmdk-pill span { display: none; }
  .top-tab { padding: 0 8px; font-size: 12.5px; }
  .view-switch-opt span { display: none; }
}
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 29px; padding: 0 9px;
  border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); font-size: 12.2px; font-weight: 500;
}
.live-pill i { position: relative; width: 6.5px; height: 6.5px; border-radius: 50%; background: var(--text-3); }
.live-pill[data-state="online"] { color: var(--text-2); border-color: transparent; background: transparent; }
.live-pill[data-state="online"] i { background: var(--success); }
.live-pill[data-state="online"] i::after {
  content: ""; position: absolute; inset: -3.5px; border-radius: 50%;
  border: 1.5px solid var(--success); opacity: 0; animation: ping 2.4s ease-out infinite;
}
.live-pill[data-state="connecting"] i { background: var(--warn); animation: blink 1s ease-in-out infinite; }
.live-pill[data-state="error"] { color: var(--danger); border-color: var(--danger-100); background: var(--danger-50); }
.live-pill[data-state="error"] i { background: var(--danger); }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- Layout & Tab Panes ---------- */
main { padding: 26px 0 48px; }
.pane-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin: 0 2px 20px;
}
.pane-head h1 { font-size: clamp(22px, 2.2vw, 26px); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }
.pane-head p { margin-top: 4px; color: var(--text-2); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background-color .18s, border-color .18s, box-shadow .18s, transform .18s, color .18s;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: transparent; background: var(--text); color: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.btn-primary:hover { opacity: 0.90; background: var(--text); border-color: transparent; }
.btn-lg { height: 46px; padding: 0 22px; border-radius: 12px; font-size: 15px; }
.btn-danger-soft, .btn.is-armed { color: var(--danger); border-color: var(--danger-100); background: var(--danger-50); }

/* ---------- Tones ---------- */
.tone-blue { color: var(--primary); background: var(--primary-50); }
.tone-violet { color: #8430ce; background: rgba(132, 48, 206, 0.09); }
.tone-green { color: var(--success); background: var(--success-50); }
.tone-amber { color: var(--warn); background: var(--warn-50); }
.tone-gray { color: var(--text-3); background: var(--surface-3); }
html[data-theme="dark"] .tone-violet { color: #a78bfa; background: rgba(139, 92, 246, 0.16); }
html[data-theme="dark"] .tone-amber { color: #fbbf24; background: rgba(245, 158, 11, 0.16); }

/* ---------- Cards (macOS / visionOS Frosted Glass) ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 0; }
.card-head h2, .section-head h2 { font-size: 17px; font-weight: 640; letter-spacing: -0.015em; }
.card-head p, .section-head p { margin-top: 3px; color: var(--text-3); font-size: 13px; }
.count-pill { flex: 0 0 auto; height: 25px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 540; }

/* ---------- Service map ---------- */
.map-card { margin-bottom: 20px; overflow: hidden; }
.map-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 3px;
  margin-top: 4px; color: var(--text-3); font-size: 13.5px; line-height: 1.55;
}
.map-summary b { color: var(--text); font-weight: 600; margin: 0 2px; }
.map-summary .sep { color: var(--line-2); font-style: normal; user-select: none; }
.map-summary .sub-meta { color: var(--text-3); font-size: 12.5px; }
.flow-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 13px; }
.flow-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.flow-status[data-active="true"] { background: var(--primary-50); color: var(--primary); }
.flow-status[data-active="true"] i { background: var(--primary); animation: blink 1s ease-in-out infinite; }

.map-stage {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1fr) 236px minmax(0, 1fr);
  column-gap: clamp(48px, 7vw, 112px); align-items: center;
  min-height: 292px; padding: 24px 26px 28px;
}
.map-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.link { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.link-empty { stroke-dasharray: 3 5; }
.link-active { stroke: var(--primary); stroke-width: 2; stroke-dasharray: 6 8; animation: dash 0.9s linear infinite; }
.link-p2p { stroke: var(--success); stroke-width: 2.2; stroke-dasharray: 7 7; animation: dash 0.65s linear infinite; }
.link-dot { fill: var(--primary); }
.link-dot-p2p { fill: var(--success); }
@keyframes dash { to { stroke-dashoffset: -14; } }
.map-col, .map-hub { position: relative; z-index: 1; min-width: 0; }
.map-arrow { display: none; }
.col-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.col-title b { min-width: 22px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.entity-list { display: grid; gap: 10px; }
.entity {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .25s, box-shadow .25s;
}
.entity.is-active { border-color: var(--primary-100); box-shadow: 0 0 0 4px var(--primary-50); }
.entity-node.is-active { border-color: var(--warn-100); box-shadow: 0 0 0 4px var(--warn-50); }
.entity-icon { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; }
.entity-main { flex: 1; min-width: 0; }
.entity-main strong { display: block; overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.entity-main small { display: flex; align-items: center; gap: 4px; margin-top: 1px; overflow: hidden; color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.entity-meta { display: block; margin-top: 2px; overflow: hidden; color: var(--text-2); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.entity-meta.is-soft { margin-top: 0; color: var(--text-3); }
button.entity { width: 100%; font: inherit; text-align: left; color: inherit; }
.entity-add { cursor: pointer; transition: border-color .2s, background-color .2s; }
.entity-add:hover { border-color: var(--primary-100); background: var(--primary-50); }
.entity-add:hover .entity-icon { color: var(--primary); border-color: var(--primary-100); }
.entity-add:hover strong { color: var(--primary); }
.entity-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.entity-kind { color: var(--text-3); font-size: 12px; }
.entity-empty { border-style: dashed; background: var(--surface-2); box-shadow: none; }
.entity-empty .entity-icon { color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-2); }
.entity-empty strong { color: var(--text-2); font-weight: 500; }
.entity-more { padding: 6px 4px 0; color: var(--text-3); font-size: 12.5px; text-align: center; }

.map-hub { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hub-core {
  position: relative; width: 124px; height: 124px; border-radius: 50%;
  display: grid; place-items: center; color: #ececf1;
  background: radial-gradient(circle at 32% 26%, #2b303c 0%, #191b22 58%, #101116 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 36px -14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.hub-core > svg { width: 42px; height: 42px; }
.hub-ring { position: absolute; inset: -14px; border-radius: 50%; border: 1.5px dashed var(--line-2); animation: spin 40s linear infinite; }
.hub-pulse { position: absolute; inset: 0; border-radius: 50%; }
.map-stage.is-active .hub-ring { border-color: var(--primary); animation-duration: 8s; }
.map-stage.is-active .hub-pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--primary-100); } 100% { box-shadow: 0 0 0 28px transparent; } }
.map-hub h3 { margin-top: 26px; font-size: 16px; font-weight: 650; }
.map-hub > p { margin-top: 2px; color: var(--text-3); font-size: 13px; }
.hub-stats { display: flex; gap: 8px; margin-top: 14px; }
.hub-stats span { display: inline-flex; align-items: baseline; gap: 5px; height: 28px; padding: 0 10px; align-items: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.hub-stats b { color: var(--text); font-family: var(--font-num); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.layers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--surface-2); }
.layer { display: flex; align-items: flex-start; gap: 14px; padding: 18px 24px 20px; }
.layer + .layer { border-left: 1px solid var(--line); }
.layer-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--primary); }
.layer-tag { display: block; color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.layer h4 { font-size: 14.5px; font-weight: 600; }
.layer p { margin-top: 2px; color: var(--text-2); font-size: 13px; line-height: 1.6; }

/* ---------- Access ---------- */
.access { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; scroll-margin-top: 84px; }
.access-card { display: flex; flex-direction: column; min-width: 0; }
.access-card.is-flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--primary-100); border-color: var(--primary-100); } 100% { box-shadow: var(--shadow-sm); } }
.access-body { flex: 1; display: grid; align-content: start; gap: 16px; padding: 16px 22px 22px; }
.field-cap { display: block; margin-bottom: 6px; color: var(--text-3); font-size: 12.5px; }
.copy-field { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px 5px 5px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.copy-field code { flex: 1; min-width: 0; overflow-x: auto; color: var(--text); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; scrollbar-width: none; }
.copy-field code::-webkit-scrollbar { display: none; }
.copy-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500; transition: color .18s, border-color .18s, background-color .18s; }
.copy-btn:hover { border-color: var(--primary-100); color: var(--primary); }
.copy-btn.is-done { border-color: var(--success-100); background: var(--success-50); color: var(--success); }
.facts { display: grid; gap: 9px; list-style: none; }
.facts li { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); font-size: 13.5px; line-height: 1.65; }
.facts li .icon { margin-top: 3px; color: var(--success); }
.inline-code { padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text); font-family: var(--font-mono); font-size: 12.5px; overflow-wrap: anywhere; }
.access-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding: 12px 22px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: var(--surface-2); color: var(--text-3); font-size: 12.5px; }
.access-foot .link-btn { color: var(--primary); font-weight: 600; }
.access-foot .link-btn:hover { color: var(--primary-600); }
.access-foot .link-btn.is-done { color: var(--success); }
.steps { display: grid; gap: 14px; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; }
.steps li::before { counter-increment: step; content: counter(step); width: 22px; height: 22px; margin-top: 1px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-size: 12px; font-weight: 700; }
.steps strong { display: block; font-size: 14px; font-weight: 600; }
.steps p { margin-top: 1px; color: var(--text-3); font-size: 13px; }
.steps .copy-field { margin-top: 8px; }
.os-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.os-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-3); }
.os-seg button { height: 26px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; transition: background-color .18s, color .18s; }
.os-seg button[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(15, 17, 21, 0.08); }
.env-probe {
  display: flex; flex-direction: column; gap: 10px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface-2); font-size: 12.5px;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.env-probe[data-tone="online"] {
  border-color: var(--success-100);
  background: linear-gradient(135deg, rgba(16, 163, 127, 0.08) 0%, rgba(16, 163, 127, 0.02) 56%, var(--surface-2) 100%);
}
.env-probe[data-tone="ready"] {
  border-color: var(--primary-100);
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.08) 0%, rgba(26, 115, 232, 0.02) 56%, var(--surface-2) 100%);
}
html[data-theme="dark"] .env-probe[data-tone="online"] {
  border-color: rgba(52, 211, 153, 0.24);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.11) 0%, rgba(16, 185, 129, 0.03) 48%, rgba(23, 24, 29, 0.82) 100%);
  box-shadow: inset 0 1px 0 rgba(52, 211, 153, 0.08);
}
html[data-theme="dark"] .env-probe[data-tone="ready"] {
  border-color: rgba(138, 180, 248, 0.24);
  background: linear-gradient(135deg, rgba(138, 180, 248, 0.11) 0%, rgba(138, 180, 248, 0.03) 48%, rgba(23, 24, 29, 0.82) 100%);
  box-shadow: inset 0 1px 0 rgba(138, 180, 248, 0.08);
}
.env-probe-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.env-probe-lead { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.env-probe-ico {
  width: 21px; height: 21px; border-radius: 6px; flex: 0 0 auto;
  display: inline-grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text-3);
}
.env-probe-ico .icon { display: none; stroke-width: 2.2; }
.env-ico-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.env-probe[data-probing="true"] .env-ico-dot { background: var(--primary); animation: blink .9s ease-in-out infinite; }
.env-probe[data-tone="online"] .env-probe-ico {
  background: rgba(16, 163, 127, 0.12); border-color: rgba(16, 163, 127, 0.22); color: var(--success);
}
html[data-theme="dark"] .env-probe[data-tone="online"] .env-probe-ico {
  background: rgba(16, 185, 129, 0.16); border-color: rgba(52, 211, 153, 0.28); color: #34d399;
}
.env-probe[data-tone="online"] .env-ico-dot { display: none; }
.env-probe[data-tone="online"] .env-ico-check { display: block; }
.env-probe[data-tone="ready"] .env-probe-ico {
  background: var(--primary-50); border-color: var(--primary-100); color: var(--primary);
}
.env-probe[data-tone="ready"] .env-ico-dot { display: none; }
.env-probe[data-tone="ready"] .env-ico-bolt { display: block; }
.env-probe-title {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.45;
}
.env-probe[data-tone="online"] .env-probe-title { color: #0b5e4a; }
html[data-theme="dark"] .env-probe[data-tone="online"] .env-probe-title { color: #ecfdf5; }
.env-probe[data-tone="ready"] .env-probe-title { color: var(--primary); }
.env-node-tag {
  padding: 1px 6px; border-radius: 5px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  background: var(--success-50); border: 1px solid var(--success-100); color: #0b7a5f;
}
html[data-theme="dark"] .env-node-tag {
  background: rgba(16, 185, 129, 0.15); border-color: rgba(52, 211, 153, 0.25); color: #6ee7b7;
}
.env-reprobe-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  height: 25px; padding: 0 9px; border-radius: 7px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.72);
  color: var(--text-2); font-size: 11.8px; font-weight: 520;
  transition: background-color .16s, border-color .16s, color .16s;
}
.env-reprobe-btn:hover { background: var(--surface); border-color: var(--primary-100); color: var(--text); }
html[data-theme="dark"] .env-reprobe-btn {
  background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.10); color: #9da1ac;
}
html[data-theme="dark"] .env-reprobe-btn:hover {
  background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.18); color: #ececf1;
}
.env-probe[data-probing="true"] .env-reprobe-btn .icon { animation: spin .85s linear infinite; }
.env-probe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.env-chip {
  display: inline-flex; align-items: center; gap: 5.5px; max-width: 100%; min-width: 0;
  height: 25px; padding: 0 9px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.86); border: 1px solid rgba(15, 17, 21, 0.08);
  box-shadow: 0 1px 2px rgba(15, 17, 21, 0.02);
  color: var(--text-2); font-size: 11.8px; line-height: 1;
}
html[data-theme="dark"] .env-chip {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: #c4c7cf;
}
.env-chip-k { font-style: normal; color: var(--text-3); font-weight: 450; flex: 0 0 auto; }
.env-chip-v {
  font-weight: 550; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html[data-theme="dark"] .env-chip-k { color: #636773; }
html[data-theme="dark"] .env-chip-v { color: #ececf1; }
.env-chip-v.is-mono { font-family: var(--font-mono); font-size: 11.2px; }
button.env-chip { cursor: pointer; transition: border-color .16s, background-color .16s, color .16s; }
button.env-chip:hover { border-color: var(--primary-100); background: var(--primary-50); color: var(--primary); }
button.env-chip.is-accent {
  border-color: var(--primary-100); background: var(--primary-50); color: var(--primary); font-weight: 560;
}
html[data-theme="dark"] button.env-chip.is-accent {
  border-color: rgba(138, 180, 248, 0.30); background: rgba(138, 180, 248, 0.13); color: #aecbfa;
}
.self-tag { display: inline-flex; align-items: center; height: 18px; margin-left: 6px; padding: 0 6px; border-radius: 5px; background: var(--primary-50); color: var(--primary); font-size: 11px; font-weight: 600; vertical-align: middle; }

/* ---------- Models (Hugging Face Hub Style) ---------- */
.section { margin-bottom: 20px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 32px 2px 14px; }
.avatar {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center;
  font-size: 16px; font-weight: 700;
  color: hsl(var(--h, 221) 65% 42%); background: hsl(var(--h, 221) 90% 96%); border: 1px solid hsl(var(--h, 221) 70% 90%);
}
html[data-theme="dark"] .avatar {
  color: hsl(var(--h, 221) 85% 74%); background: hsl(var(--h, 221) 52% 18%); border-color: hsl(var(--h, 221) 48% 28%);
}
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.tag-green { background: var(--success-50); color: var(--success); }
.tag-blue { background: var(--primary-50); color: var(--primary); }

.hf-pane-head { margin-bottom: 14px; }
.hf-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Apple Minimalist Filter & Search Toolbar */
.hf-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
}
.hf-toolbar-main {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1 1 520px; min-width: 0;
}
.hf-search {
  position: relative; display: flex; align-items: center; gap: 8px;
  flex: 1 1 220px; max-width: 300px; min-width: 180px; height: 32px; padding: 0 8px 0 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--text-3);
  transition: border-color .18s, background-color .18s, box-shadow .18s;
}
.hf-search:focus-within {
  border-color: var(--primary-100); background: var(--surface-solid);
  box-shadow: 0 0 0 3px var(--primary-50); color: var(--primary);
}
.hf-search input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  color: var(--text); font-size: 12.8px; outline: none;
}
.hf-search input::placeholder { color: var(--text-3); }
.hf-search input::-webkit-search-cancel-button { display: none; }
.hf-search-clear {
  width: 18px; height: 18px; border: 0; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
}
.hf-search-clear:hover { color: var(--text); }

.hf-task-pills {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.hf-pill-divider {
  width: 1px; height: 16px; margin: 0 4px; background: var(--line-2);
}
.hf-filter-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 29px; padding: 0 12px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); font-size: 12.4px; font-weight: 520; white-space: nowrap;
  transition: border-color .16s, background-color .16s, color .16s;
}
.hf-filter-pill:hover {
  color: var(--text); background: var(--surface-2);
}
.hf-filter-pill.is-active {
  border-color: var(--line); background: var(--surface-solid); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}
html[data-theme="dark"] .hf-filter-pill.is-active {
  border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.13); color: #f5f5f7;
}

.hf-toolbar-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto;
}
.hf-scale-seg {
  display: inline-flex; padding: 2px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.hf-scale-seg button {
  height: 26px; padding: 0 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2);
  font-family: var(--font-num); font-size: 11.8px; font-weight: 540; white-space: nowrap;
  transition: background-color .16s, color .16s, box-shadow .16s;
}
.hf-scale-seg button:hover { color: var(--text); }
.hf-scale-seg button[aria-pressed="true"] {
  background: var(--surface-solid); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .hf-scale-seg button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.14); color: #f5f5f7;
}
.hf-sort-wrap {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); font-size: 12px;
}
.hf-sort-wrap select {
  border: 0; background: transparent; color: var(--text);
  font-size: 12.2px; font-weight: 540; outline: none; cursor: pointer;
}

/* Apple Frosted Glass Model Cards (Clean 3-Layer Hierarchy) */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.hf-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: 18px 20px 15px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--shadow-sm); cursor: pointer;
  transition: border-color .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s cubic-bezier(.2, .8, .2, 1), transform .22s cubic-bezier(.2, .8, .2, 1), background-color .22s;
}
.hf-card:hover {
  border-color: var(--line-2);
  background: var(--surface-elevated);
  box-shadow: var(--glass-highlight), var(--shadow);
  transform: translateY(-2px);
}

/* Layer 1: Squircle Brand Icon + Crisp Model Title + Quiet Status */
.hf-card-head {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.hf-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px;
  display: inline-grid; place-items: center;
  font-family: var(--font-num); font-size: 14px; font-weight: 680;
  color: var(--c1, var(--primary));
  background: color-mix(in srgb, var(--c1, var(--primary)) 8%, var(--surface-solid));
  border: 1px solid color-mix(in srgb, var(--c1, var(--primary)) 16%, var(--line));
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.85), 0 1px 2px rgba(15, 17, 21, 0.04);
}
.hf-avatar.is-mono {
  color: var(--text);
  background: var(--surface-solid);
  border-color: var(--line);
}
html[data-theme="dark"] .hf-avatar {
  color: color-mix(in srgb, var(--c1, #60a5fa) 76%, #ffffff);
  background: color-mix(in srgb, var(--c1, #60a5fa) 13%, rgba(255, 255, 255, 0.065));
  border-color: color-mix(in srgb, var(--c1, #60a5fa) 22%, rgba(255, 255, 255, 0.10));
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.09);
}
html[data-theme="dark"] .hf-avatar.is-mono {
  color: #f1f3f8;
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.12);
}
.hf-avatar svg,
.hf-avatar .lobe-logo { width: 22px; height: 22px; display: block; }
.hf-avatar-lg {
  width: 42px; height: 42px; border-radius: 12px; font-size: 16px;
}
.hf-avatar-lg svg,
.hf-avatar-lg .lobe-logo { width: 24px; height: 24px; }
.hf-title-block {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.hf-repo-line {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.hf-name {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); font-size: 15.5px; font-weight: 640;
  letter-spacing: -0.02em; line-height: 1.25;
}
.hf-org {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-3); font-size: 12px; font-weight: 450;
}
.hf-size-pill {
  flex: 0 0 auto; height: 19px; padding: 0 6.5px;
  display: inline-flex; align-items: center; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-2); font-family: var(--font-num); font-size: 11px; font-weight: 600;
}
.hf-icon-btn {
  flex: 0 0 auto; width: 22px; height: 22px; border: 0; border-radius: 6px;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--text-3); opacity: 0;
  transition: opacity .15s, background-color .15s, color .15s;
}
.hf-card:hover .hf-icon-btn,
.hf-detail-repo .hf-icon-btn { opacity: 0.75; }
.hf-icon-btn:hover { opacity: 1 !important; background: var(--surface-2); color: var(--text); }
.hf-icon-btn.is-done { opacity: 1 !important; color: var(--success); background: var(--success-50); }

.hf-live-badge {
  flex: 0 0 auto; margin-left: auto; height: 22px; padding: 0 8.5px;
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  font-family: var(--font-num); font-size: 11.2px; font-weight: 540; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2);
}
.hf-live-badge i { width: 5.5px; height: 5.5px; border-radius: 50%; background: var(--success); }
.hf-live-badge.is-ready { color: var(--text-2); }
.hf-live-badge.is-warm { color: var(--text); }
.hf-live-badge.is-warm i { background: var(--success); }
.hf-live-badge.is-streaming {
  color: var(--primary); background: var(--primary-50); border-color: var(--primary-100);
}
.hf-live-badge.is-streaming i { background: var(--primary); animation: blink .9s ease-in-out infinite; }

/* Layer 2: Single-Line Minimalist Spec Strip */
.hf-meta-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px;
  color: var(--text-2); font-size: 12.4px; line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.hf-meta-line > span { display: inline-flex; align-items: center; gap: 3.5px; white-space: nowrap; }
.hf-meta-speed { color: var(--success); font-weight: 560; }
.hf-dot-sep { color: var(--text-3); opacity: 0.45; font-style: normal; user-select: none; }

.hf-raw-id {
  display: inline-flex; align-items: center; max-width: 100%; height: 20px; padding: 0 7px;
  border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-2); font-family: var(--font-mono); font-size: 11.2px;
}
.hf-cap-chip {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8.5px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); font-size: 11.2px; font-weight: 520; white-space: nowrap;
}
.hf-node-title-row .dot,
.hf-foot-hint .dot {
  width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--success);
}
.hf-node-title-row .dot.busy,
.hf-foot-hint .dot.busy { background: var(--warn); }

/* Layer 3: Clean Node Hint + Apple Capsule Actions */
.hf-card-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hf-foot-hint {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; overflow: hidden;
  color: var(--text-3); font-size: 12px;
}
.hf-foot-hint > span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hf-foot-actions { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.hf-btn-ghost {
  display: inline-flex; align-items: center; gap: 4px;
  height: 27px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); font-size: 12px; font-weight: 540; white-space: nowrap;
  transition: border-color .16s, background-color .16s, color .16s;
}
.hf-btn-ghost:hover {
  border-color: var(--line-2); background: var(--surface-3); color: var(--text);
}
.hf-btn-try {
  display: inline-flex; align-items: center; gap: 4px;
  height: 27px; padding: 0 13px; border-radius: 999px;
  border: 0; background: var(--primary-50);
  color: var(--primary); font-size: 12.2px; font-weight: 600; white-space: nowrap;
  transition: background-color .18s, color .18s, transform .16s;
}
.hf-btn-try:hover {
  background: var(--text); color: var(--bg);
}
.hf-btn-try:active { transform: scale(0.96); }

.model-empty {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 22px; border: 1px dashed var(--line-2); border-radius: 14px;
  background: var(--surface-2); color: var(--text-2);
}
.model-empty .entity-icon { color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-2); }

/* HF Model Card Detail Drawer / Modal */
.hf-detail-modal {
  width: min(100%, 780px); max-height: min(86dvh, 760px);
}
.hf-detail-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.hf-detail-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.hf-detail-id {
  display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 320px;
}
.hf-detail-repo {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0;
}
.hf-detail-repo strong {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--text);
}
.hf-detail-sub {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px;
  color: var(--text-3); font-size: 12px;
}
.hf-detail-actions {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
}
.hf-detail-body {
  flex: 1; overflow-y: auto; padding: 16px 18px 20px;
  display: flex; flex-direction: column; gap: 18px;
  background: var(--surface);
}
.hf-detail-sec { display: flex; flex-direction: column; gap: 10px; }
.hf-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.hf-sec-head h4 {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 650; color: var(--text);
}
.hf-sec-head > span { font-size: 12px; color: var(--text-3); }
.hf-spec-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.hf-spec-cell {
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.hf-spec-cell span { display: block; font-size: 11.5px; color: var(--text-3); }
.hf-spec-cell strong {
  display: block; margin-top: 3px; font-family: var(--font-num);
  font-size: 13.2px; font-weight: 640; color: var(--text);
}
.hf-cap-list { display: flex; flex-wrap: wrap; gap: 6px; }
.hf-node-list { display: grid; gap: 8px; }
.hf-node-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.hf-node-main { min-width: 0; flex: 1 1 260px; }
.hf-node-title-row {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13.2px;
}
.hf-node-sub { color: var(--text-3); font-size: 12px; }
.hf-node-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px;
  color: var(--text-3); font-size: 11.8px;
}
.hf-engine-tag {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-2); font-weight: 540;
}
.hf-engine-tag .lobe-logo-mono { color: var(--text-2); }
.hf-node-badges { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.hf-code-toolbar { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hf-code-pre {
  margin: 0; padding: 13px 15px; border-radius: 11px; overflow-x: auto;
  border: 1px solid var(--code-border); background: var(--code-bg); color: var(--code-fg);
  font-family: var(--font-mono); font-size: 12.2px; line-height: 1.62;
}

@media (max-width: 820px) {
  .hf-spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .model-grid { grid-template-columns: 1fr; }
  .hf-toolbar-right { width: 100%; justify-content: space-between; }
}

/* ---------- Duo ---------- */
.duo { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* Traces */
.trace-list { max-height: 640px; margin-top: 14px; overflow-y: auto; border-top: 1px solid var(--line); }
.trace { padding: 18px 22px; }
.trace + .trace { border-top: 1px solid var(--line); }
.trace.is-streaming { background: linear-gradient(90deg, var(--primary-50), transparent 60%); box-shadow: inset 3px 0 var(--primary); }
.trace-top { display: flex; align-items: center; gap: 8px; }
.trace-top time { margin-left: auto; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.trace-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 12px; }
.route-step { min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.route-step span { display: block; color: var(--text-3); font-size: 12px; }
.route-step strong { display: block; overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.route-step strong.trace-model-name { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.route-step strong.trace-model-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-model-logo { display: inline-grid; place-items: center; width: 15px; height: 15px; flex: 0 0 auto; color: var(--text); }
.route-step small { display: block; overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.route-arrow { color: var(--line-2); }
.trace.is-streaming .route-arrow { color: var(--primary); }
.trace-progress { height: 3px; margin-top: 14px; overflow: hidden; border-radius: 3px; background: var(--primary-50); }
.trace-progress span { display: block; width: 32%; height: 100%; border-radius: 3px; background: var(--primary); animation: indeterminate 1.4s ease-in-out infinite; }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }
.trace-live { margin-top: 10px; overflow: hidden; color: var(--text-2); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--primary); animation: blink 0.9s steps(2) infinite; }
.trace-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.trace-metrics div { padding: 2px 0; }
.trace-metrics dt { color: var(--text-3); font-size: 12px; }
.trace-metrics dd { font-family: var(--font-num); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trace-metrics dd small { margin-left: 3px; color: var(--text-3); font-family: var(--font); font-size: 12px; font-weight: 400; }
.trace-note { margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); font-size: 13px; }
.trace-note.is-error { background: var(--danger-50); color: var(--danger); }
.trace-detail { margin-top: 12px; }
.trace-detail summary { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; cursor: pointer; list-style: none; user-select: none; }
.trace-detail summary::-webkit-details-marker { display: none; }
.trace-detail summary:hover { color: var(--primary); }
.trace-detail summary .icon { transition: transform .2s; }
.trace-detail[open] summary .icon { transform: rotate(90deg); }
.dialog { display: grid; gap: 8px; margin-top: 10px; }
.bubble { max-width: 92%; padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
.bubble > b { display: block; margin-bottom: 2px; color: var(--text-3); font-size: 12px; font-weight: 500; }
.bubble-q { justify-self: end; background: var(--primary-50); border-top-right-radius: 4px; }
.bubble-a { justify-self: start; background: var(--surface-3); border-top-left-radius: 4px; }
.trace-empty { padding: 48px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.trace-empty .empty-icon { width: 56px; height: 56px; margin-bottom: 14px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-50); color: var(--primary); }
.trace-empty .empty-icon .icon { width: 26px; height: 26px; }
.trace-empty h3 { font-size: 15.5px; font-weight: 600; }
.trace-empty p { max-width: 340px; margin-top: 4px; color: var(--text-3); font-size: 13.5px; }
.trace-empty .btn { margin-top: 16px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { color: var(--success); background: var(--success-50); }
.pill-warn { color: var(--warn); background: var(--warn-50); }
.pill-blue { color: var(--primary); background: var(--primary-50); }
.pill-red { color: var(--danger); background: var(--danger-50); }
.pill-gray { color: var(--text-2); background: var(--surface-3); }
.pill-warn i, .pill-blue i { animation: blink 1.1s ease-in-out infinite; }

/* Ledger */
.balance-badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--success-50); color: var(--success); font-size: 12.5px; font-weight: 500; }
.seg { display: inline-flex; margin: 16px 22px 6px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg button { height: 32px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 500; transition: background-color .2s, color .2s; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 17, 21, 0.08); }
.ledger-head, .ledger-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 64px minmax(0, 1.15fr); align-items: center; gap: 14px; padding: 0 22px; }
.ledger-head { height: 38px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }
.ledger-head span:not(:first-child), .ledger-row > div:not(:first-child) { text-align: right; }
.ledger-row { min-height: 62px; border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.who strong { display: block; overflow: hidden; font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; overflow: hidden; color: var(--text-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ledger-calls { font-family: var(--font-num); font-size: 14px; font-variant-numeric: tabular-nums; }
.ledger-amount strong { font-family: var(--font-num); font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 5px; margin-top: 6px; overflow: hidden; border-radius: 5px; background: var(--surface-3); }
.bar span { display: block; height: 100%; border-radius: 5px; background: var(--primary); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.ledger-provider .bar span { background: var(--success); }
.ledger-empty { padding: 40px 22px; color: var(--text-3); font-size: 13.5px; text-align: center; }
.ledger-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.ledger-total b { color: var(--text); font-family: var(--font-num); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Footer */
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 32px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; color: var(--text-3); font-size: 13px; }
.link-btn:hover { color: var(--text-2); }
.link-btn.is-armed { color: var(--danger); font-weight: 600; }

/* Enter animation */
.is-entering { animation: enter .42s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }


/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
  .duo { grid-template-columns: 1fr; }
  .access { grid-template-columns: 1fr; }
  .clock { display: none; }
}
@media (max-width: 900px) {
  .wrap { width: min(100% - 32px, 1320px); }
  .topbar-inner { flex-wrap: wrap; padding: 10px 0; row-gap: 8px; }
  .top-tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .top-tabs::-webkit-scrollbar { display: none; }
  .top-tab { flex: 1 0 auto; justify-content: center; }
  .map-stage { grid-template-columns: 1fr; row-gap: 4px; padding: 22px 18px; }
  .map-links { display: none; }
  .map-arrow { display: grid; place-items: center; height: 40px; color: var(--line-2); }
  .map-hub { padding: 6px 0; }
  .hub-core { width: 96px; height: 96px; }
  .hub-core > svg { width: 34px; height: 34px; }
  .hub-ring { inset: -10px; }
  .map-hub h3 { margin-top: 20px; }
  .layers { grid-template-columns: 1fr; }
  .layer + .layer { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  main { padding-top: 20px; }
  .brand-text span { display: none; }
  .top-tab { padding: 0 10px; font-size: 13px; }
  .card-head { flex-direction: column; gap: 10px; padding: 18px 16px 0; }
  .access-body { padding: 14px 16px 18px; }
  .access-foot { flex-direction: column; align-items: flex-start; gap: 4px; padding-inline: 16px; }
  .copy-btn span { display: none; }
  .trace { padding: 16px; }
  .trace-route { grid-template-columns: 1fr; }
  .route-arrow { justify-self: center; transform: rotate(90deg); }
  .trace-metrics, .pg-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg { margin-inline: 16px; }
  .ledger-head, .ledger-row { padding: 0 16px; grid-template-columns: minmax(0, 1.4fr) 48px minmax(0, 1fr); gap: 10px; }
  .ledger-total { padding-inline: 16px; }
  .drawer-head, .drawer-body { padding-inline: 18px; }
  .drawer-foot { padding-inline: 18px; }
  .drawer-foot .btn { flex: 1; }
  .site-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
}
/* ---------- Theme Toggle & Chat Stage Switcher (Top-right) ---------- */
.theme-btn {
  width: 31px; height: 31px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); display: inline-grid; place-items: center;
  box-shadow: none;
  transition: border-color .18s, background-color .18s, color .18s, transform .16s;
}
.theme-btn:hover { border-color: var(--line); color: var(--text); background: var(--surface-2); }
.theme-btn:active { transform: scale(0.94); }

.view-switch {
  display: inline-flex; align-items: center; gap: 2px;
  height: 30px; padding: 2.5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .2s, background-color .2s;
}
.view-switch:hover { border-color: var(--line-2); }
.view-switch-opt {
  display: inline-flex; align-items: center; gap: 4.5px;
  height: 23px; padding: 0 9px; border-radius: 999px;
  color: var(--text-3); font-size: 12px; font-weight: 520;
  transition: background-color .22s cubic-bezier(.2, .8, .2, 1), color .2s, box-shadow .22s;
  white-space: nowrap; user-select: none;
}
body[data-home="globe"] .view-switch-opt[data-mode="globe"],
body[data-home="focus"] .view-switch-opt[data-mode="focus"] {
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-weight: 590;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 1px 4px rgba(15, 23, 42, 0.10);
}
html[data-theme="dark"] body[data-home="globe"] .view-switch-opt[data-mode="globe"],
html[data-theme="dark"] body[data-home="focus"] .view-switch-opt[data-mode="focus"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.10) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 1px 4px rgba(0, 0, 0, 0.30);
}
body[data-home="globe"] .view-switch-opt[data-mode="globe"] .icon,
body[data-home="focus"] .view-switch-opt[data-mode="focus"] .icon { color: var(--text); }

/* Mode & Global Tab Visibility */
body[data-tab="chat"] {
  background:
    radial-gradient(900px 480px at 50% 140px, rgba(255, 255, 255, 0.022), transparent 76%),
    var(--chat-bg);
}
body:not([data-tab="chat"]) #homeSwitchBtn { display: none !important; }
body[data-tab="chat"] #main,
body[data-tab="chat"] .site-foot { display: none !important; }
body:not([data-tab="chat"]) #chatWorkspace { display: none !important; }

.tab-pane { display: none; }
body[data-tab="models"] .tab-pane[data-pane="models"],
body[data-tab="access"] .tab-pane[data-pane="access"],
body[data-tab="nas"] .tab-pane[data-pane="nas"],
body[data-tab="hybrid"] .tab-pane[data-pane="hybrid"],
body[data-tab="stats"] .tab-pane[data-pane="stats"] {
  display: block;
  animation: enter .26s cubic-bezier(.2, .8, .2, 1) both;
}

/* ---------- Enterprise Hybrid, NAS & Cost Analytics (Apple Glass Bento) ---------- */
.hy-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.hy-kpi {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--shadow-sm);
}
.hy-kpi-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.hy-kpi-val { margin-top: 5px; font-family: var(--font-num); font-size: 22px; font-weight: 680; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.hy-kpi-sub { margin-top: 3px; font-size: 11.5px; color: var(--text-3); }
.hy-form { display: grid; gap: 10px; padding: 18px 22px; }
.hy-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.hy-field label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.hy-field input, .hy-field select, .hy-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 13px;
}
.hy-field textarea { resize: vertical; }
.hy-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.hy-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hy-table th, .hy-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.hy-table th { color: var(--text-3); font-weight: 500; font-size: 12px; background: var(--surface-2); }
.nas-steps { display: grid; gap: 6px; margin-top: 10px; max-height: 220px; overflow-y: auto; }
.nas-step { padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; }
.nas-answer { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; white-space: pre-wrap; max-height: 300px; overflow-y: auto; }
.badge-mini { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; background: var(--surface-3); color: var(--text-2); margin-left: 4px; }
.badge-mini.is-ok { background: var(--success-50); color: var(--success); }
.badge-mini.is-warn { background: var(--warn-50); color: var(--warn); }
.badge-mini.is-err { background: var(--danger-50); color: var(--danger); }


/* Topbar Sidebar Toggle & Cmd+K Quick Trigger */
.topbar-left { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sidebar-toggle-btn {
  width: 31px; height: 31px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); display: inline-grid; place-items: center;
  box-shadow: none;
  transition: border-color .18s, background-color .18s, color .18s;
}
.sidebar-toggle-btn:hover { border-color: var(--line); color: var(--text); background: var(--surface-2); }
body:not([data-tab="chat"]) .sidebar-toggle-btn { display: none !important; }

.cmdk-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 8px 0 10px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); font-size: 12.4px; font-weight: 500;
  box-shadow: none;
  transition: border-color .18s, color .18s, background-color .18s;
}
.cmdk-pill:hover { border-color: var(--line); color: var(--text); background: var(--surface-2); }
.cmdk-pill kbd {
  padding: 1px 5px; border-radius: 5px;
  background: var(--surface-2); border: 0;
  color: var(--text-3); font-family: var(--font-mono); font-size: 10.8px; font-weight: 540;
}
@media (max-width: 960px) {
  .cmdk-pill span { display: none; }
}
