:root {
  --brand: #e8642c;
  --brand-light: #f0854e;
  --brand-50: #fff3ec;
  --brand-100: #ffe2d1;

  --green: #22c55e;
  --green-bg: #dcfce7;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --yellow: #eab308;
  --yellow-bg: #fef3c7;
  --blue: #3b82f6;

  --ink-900: #0b0b0d;
  --ink-800: #1d1d1f;
  --ink-700: #3a3a3c;
  --ink-600: #6e6e73;
  --ink-500: #8e8e93;
  --ink-400: #aeaeb2;
  --ink-300: #d1d1d6;
  --ink-200: #e5e5ea;
  --ink-100: #f2f2f7;
  --ink-50:  #fafafa;

  --panel: rgba(255,255,255,0.72);
  --panel-strong: rgba(255,255,255,0.92);
  --sidebar: rgba(246,246,248,0.78);

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-win: 0 40px 80px rgba(0,0,0,0.28), 0 12px 24px rgba(0,0,0,0.14), 0 0 0 0.5px rgba(0,0,0,0.15);
  --shadow-popover: 0 24px 48px rgba(0,0,0,0.28), 0 4px 12px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 13px;
  color: var(--ink-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* ========== macOS Desktop ========== */
.desktop {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, #ffb88a 0%, transparent 45%),
    radial-gradient(ellipse at 80% 80%, #6a7dff 0%, transparent 50%),
    radial-gradient(ellipse at 70% 20%, #f07ad1 0%, transparent 45%),
    linear-gradient(160deg, #2c2a5c 0%, #1a1733 100%);
  overflow: hidden;
}
.desktop::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.25) 100%);
  pointer-events: none;
}

/* ========== Menu Bar ========== */
.menubar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 28px;
  background: rgba(20, 20, 25, 0.45);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  color: white;
  font-size: 13px;
  z-index: 100;
}
.menubar-left { display: flex; align-items: center; gap: 2px; }
.menubar-right { display: flex; align-items: center; gap: 14px; }
.menubar-left .apple-logo {
  width: 13px; height: 15px;
  display: inline-flex; align-items: center;
  padding: 0 8px 0 4px;
}
.menubar-left .app-name {
  font-weight: 600;
  padding: 0 8px;
  height: 20px;
  line-height: 20px;
  border-radius: 4px;
  cursor: default;
}
.menubar-left .menu-item {
  cursor: default;
  color: rgba(255,255,255,0.92);
  padding: 0 8px;
  height: 20px;
  line-height: 20px;
  border-radius: 4px;
  transition: background 0.1s;
}
.menubar-left .app-name:hover,
.menubar-left .menu-item:hover { background: rgba(255,255,255,0.15); }
.menubar-right .mb-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  cursor: pointer; border-radius: 4px;
  transition: background 0.15s;
  position: relative;
  color: white;
}
.menubar-right .mb-icon:hover { background: rgba(255,255,255,0.15); }
.menubar-right .mb-icon.active { background: rgba(255,255,255,0.2); }
.menubar-right .mb-ofox {
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; font-weight: 700; font-size: 11px;
  letter-spacing: -0.5px;
  width: auto; padding: 0 8px 0 6px; height: 18px;
  border-radius: 4px;
  gap: 4px;
}
.menubar-right .mb-ofox .mb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 1.5px rgba(52, 211, 153, 0.3);
}
.menubar-right .mb-ofox.low-balance {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.5), 0 0 10px rgba(245, 158, 11, 0.35);
  animation: pulse-warn 2s ease-in-out infinite;
}
.menubar-right .mb-ofox.low-balance .mb-dot { background: #fbbf24; box-shadow: 0 0 0 1.5px rgba(251, 191, 36, 0.5); }
@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.5), 0 0 8px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.8), 0 0 16px rgba(245, 158, 11, 0.6); }
}
.pop-low-banner {
  margin: 10px 16px 0;
  padding: 9px 11px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 0.5px solid #f59e0b;
  border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
  font-size: 11px;
}
.pop-low-banner .pop-low-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: #f59e0b; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.pop-low-banner .pop-low-body { flex: 1; min-width: 0; }
.pop-low-banner .pop-low-title { font-weight: 600; color: #92400e; font-size: 12px; }
.pop-low-banner .pop-low-desc  { font-size: 10px; color: #b45309; margin-top: 1px; }
.menubar-right .mb-clock { color: rgba(255,255,255,0.95); font-variant-numeric: tabular-nums; }

/* ========== Menu Bar Popover ========== */
.popover {
  position: absolute; top: 34px; right: 8px;
  width: 340px;
  background: var(--panel-strong);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  z-index: 200;
  opacity: 0; transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  /* Clip children to rounded shape while letting the arrow poke out */
  transform-origin: top right;
}
.popover > * { overflow: hidden; }
.popover > *:first-child { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }
.popover > *:last-child  { border-bottom-left-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.popover::before {
  content: "";
  position: absolute;
  top: -5px; right: 22px;
  width: 10px; height: 5px;
  background: inherit;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  filter: drop-shadow(0 -0.5px 0 rgba(0,0,0,0.08));
  -webkit-backdrop-filter: inherit;
}
.popover.open {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}
.pop-header {
  padding: 14px 16px 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 0.5px solid var(--ink-200);
}
.pop-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 15px;
}
.pop-header .pop-user { flex: 1; min-width: 0; }
.pop-header .pop-name { font-weight: 600; font-size: 13px; }
.pop-header .pop-email { font-size: 11px; color: var(--ink-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-header .pop-status { font-size: 10px; color: var(--green); font-weight: 600; }
.pop-balance-block {
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--ink-200);
}
.pop-balance-label { font-size: 11px; color: var(--ink-600); text-transform: uppercase; letter-spacing: 0.5px; }
.pop-balance-value {
  font-size: 26px; font-weight: 700; color: var(--ink-900);
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}
.pop-balance-delta { font-size: 11px; color: var(--ink-600); }
.pop-balance-delta .red { color: var(--red); font-weight: 500; }
.pop-balance-actions { display: flex; gap: 6px; margin-top: 10px; }
.pop-today {
  display: flex;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--ink-200);
  gap: 8px;
}
.pop-today-cell { flex: 1; text-align: center; }
.pop-today-label { font-size: 10px; color: var(--ink-600); text-transform: uppercase; letter-spacing: 0.5px; }
.pop-today-value { font-size: 15px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pop-tools { padding: 6px 0; border-bottom: 0.5px solid var(--ink-200); }
.pop-tools-label {
  padding: 6px 16px 4px;
  font-size: 10px; color: var(--ink-600);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pop-tool-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.12s;
}
.pop-tool-row:hover { background: var(--ink-100); }
.pop-tool-icon {
  width: 22px; height: 22px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 10px;
  flex-shrink: 0;
}
.pop-tool-info { flex: 1; min-width: 0; }
.pop-tool-name { font-size: 12px; font-weight: 500; }
.pop-tool-meta { font-size: 10px; color: var(--ink-600); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-tool-status {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.pop-tool-status.off { background: var(--ink-300); }
.pop-tool-status.err { background: var(--red); }

.pop-actions { padding: 6px 0; }
.pop-action {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s;
}
.pop-action:hover { background: var(--ink-100); }
.pop-action .kbd { margin-left: auto; color: var(--ink-500); font-size: 11px; }

/* ========== App Window ========== */
.app-window {
  position: absolute;
  top: 70px; left: 50%; transform: translateX(-50%);
  width: 760px; height: 600px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-win);
  overflow: hidden;
  display: flex; flex-direction: column;
  z-index: 10;
}
.app-window.compact {
  width: 760px; height: 600px;
  top: 80px;
}
/* During the install wizard, blend the title bar into the content — keep traffic lights floating */
.app-window.compact .titlebar {
  background: transparent;
  border-bottom: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
}
.app-window.compact .titlebar-title { display: none; }
.app-window.compact .install-wrap { padding-top: 0; }
.app-window.hidden { display: none; }

/* Traffic lights + title bar */
.titlebar {
  height: 38px;
  display: flex; align-items: center; padding: 0 14px;
  background: rgba(246, 246, 248, 0.85);
  border-bottom: 0.5px solid var(--ink-300);
  position: relative;
  flex-shrink: 0;
}
.traffic-lights { display: flex; gap: 8px; }
.tl {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
  position: relative;
  cursor: default;
}
.tl.close    { background: #ff5f57; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.2); }
.tl.min      { background: #febc2e; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.2); }
.tl.max      { background: #28c840; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.2); }
.tl::before {
  position: absolute; inset: 0;
  font-size: 9px; font-weight: 800;
  text-align: center; line-height: 12px;
  color: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}
.titlebar:hover .tl::before { opacity: 1; }
.titlebar:hover .tl.close::before { content: "×"; font-size: 11px; }
.titlebar:hover .tl.min::before   { content: "−"; }
.titlebar:hover .tl.max::before   { content: "⤢"; font-size: 8px; }
.titlebar-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 600; color: var(--ink-800);
  pointer-events: none;
}

/* ========== Install Wizard ========== */
.install-wrap {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(ellipse at top left, var(--brand-50) 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #eff4ff 0%, transparent 55%),
    #ffffff;
}
.install-progress {
  display: flex; align-items: center; justify-content: center;
  padding: 18px 0 6px; gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}
.ip-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-500);
  white-space: nowrap;
}
.ip-step .ip-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink-200); color: var(--ink-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
}
.ip-step.active { color: var(--ink-800); }
.ip-step.active .ip-dot { background: var(--brand); color: white; }
.ip-step.done .ip-dot { background: var(--green); color: white; }
.ip-sep { width: 28px; height: 1px; background: var(--ink-300); }
.ip-step.done + .ip-sep { background: var(--green); }

.install-body {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  padding: 32px 40px 24px;
  overflow-y: auto;
  min-height: 0;
}
.install-hero-icon {
  width: 76px; height: 76px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 40px;
  letter-spacing: -2px;
  margin: 0 auto 18px;
  box-shadow: 0 16px 30px rgba(232, 100, 44, 0.28);
}
.install-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.3px;
  text-align: center; color: var(--ink-900);
}
.install-subtitle {
  font-size: 13px; color: var(--ink-600);
  margin-top: 8px; text-align: center; max-width: 460px; line-height: 1.55;
}
.install-features {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px 28px;
  margin: 22px auto 0; max-width: 520px;
  text-align: left;
}
.install-cta {
  margin-top: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.btn.btn-xl {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  min-width: 240px;
  border-radius: 8px;
}
.install-cta-alt {
  font-size: 12px;
  color: var(--ink-600);
  display: flex; align-items: center; gap: 8px;
}
.install-cta-alt a { color: var(--brand); text-decoration: none; }
.install-cta-alt a:hover { text-decoration: underline; }
.install-cta-sep { color: var(--ink-300); }
.install-cta-legal {
  font-size: 11px; color: var(--ink-500);
  margin-top: 4px;
}
.install-cta-legal a { color: var(--ink-600); text-decoration: underline; text-underline-offset: 2px; }
.install-actions {
  margin-top: 22px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap;
  min-height: 42px;
}
.install-actions-hint {
  text-align: center;
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 14px;
}
.install-feature {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--ink-700);
}
.install-feature .check {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
  margin-top: 1px;
  font-weight: 700;
}
.install-footer {
  padding: 12px 20px;
  background: rgba(246,246,248,0.85);
  border-top: 0.5px solid var(--ink-200);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.install-footer-left { font-size: 11px; color: var(--ink-500); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.install-footer-right { display: flex; gap: 8px; flex-shrink: 0; }

/* Scan screen */
.scan-radar {
  width: 140px; height: 140px;
  position: relative;
  margin-bottom: 18px;
}
.radar-ring {
  position: absolute; inset: 0;
  border: 2px solid var(--brand-100);
  border-radius: 50%;
  animation: radar-pulse 2s ease-out infinite;
}
.radar-ring.d1 { animation-delay: 0.7s; }
.radar-ring.d2 { animation-delay: 1.4s; }
@keyframes radar-pulse {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(1.1); opacity: 0; }
}
.radar-core {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(232, 100, 44, 0.35);
}
.scan-tools {
  margin: 24px auto 0;
  width: 520px; max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.scan-tool {
  position: relative;
  padding: 12px 10px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  opacity: 0.25;
  filter: grayscale(1) contrast(0.8);
  transform: scale(0.94);
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s;
}
.scan-tool.found {
  opacity: 1;
  filter: grayscale(0) contrast(1);
  transform: scale(1);
  border-color: rgba(34,197,94,0.4);
  box-shadow: 0 2px 8px rgba(34,197,94,0.15);
  animation: scan-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.scan-tool-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.scan-tool-name { font-size: 12px; font-weight: 600; color: var(--ink-800); }
.scan-tool-ver { font-size: 10px; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.scan-tool .scan-check {
  position: absolute;
  top: -5px; right: -5px;
  width: 18px; height: 18px;
  background: var(--green); color: white;
  border-radius: 50%;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(34,197,94,0.4);
  opacity: 0; transform: scale(0.4);
  transition: opacity 0.2s 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}
.scan-tool.found .scan-check { opacity: 1; transform: scale(1); }
/* Once we enter the ready (select) phase, the ✓ badge is redundant with the toggle */
.scan-tool.ready .scan-check,
.scan-tool.binding .scan-check { opacity: 0; transform: scale(0.4); }
/* Ready (select) phase: card uses neutral border; selected cards show subtle brand accent */
.scan-tool.ready {
  border-color: var(--ink-200);
  box-shadow: none;
  animation: none;
}
.scan-tool.ready:not(.off) {
  border-color: rgba(232,100,44,0.45);
  box-shadow: 0 0 0 3px rgba(232,100,44,0.1);
}
@keyframes scan-pop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Inline toggle + bind status inside scan-tool (Setup phase) */
.scan-tool .scan-tool-toggle {
  margin-top: 4px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
}
.scan-tool.ready .scan-tool-toggle { opacity: 1; transform: scale(1); }
.scan-tool.binding .scan-tool-toggle { display: none; }

.scan-tool.off {
  border-color: var(--ink-200);
  box-shadow: none;
  opacity: 0.55;
}
.scan-tool.off .scan-check { opacity: 0.3; }

.scan-tool.ready:hover:not(.off):not(.binding) {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232,100,44,0.12);
}

.scan-tool-bind-status {
  margin-top: 4px;
  font-size: 10px;
  color: var(--brand);
  font-weight: 600;
  min-height: 14px;
  display: none;
}
.scan-tool.binding .scan-tool-bind-status { display: block; }
.scan-tool.bind-doing {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232,100,44,0.15);
  animation: bind-pulse 1s ease-in-out infinite;
}
@keyframes bind-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(232,100,44,0.15); }
  50% { box-shadow: 0 0 0 4px rgba(232,100,44,0.25); }
}
.scan-tool.bind-done {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
  animation: scan-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.scan-tool.bind-done .scan-tool-bind-status { color: var(--green); }
.scan-tool.binding.off {
  opacity: 0.35;
  filter: grayscale(0.6);
}
.scan-tool.binding.off .scan-tool-bind-status { display: none; }
.log-line { opacity: 0; animation: log-in 0.3s forwards; }
.log-line.ok { color: var(--green); }
.log-line.brand { color: var(--brand); }
@keyframes log-in { to { opacity: 1; } }

/* Tool list cards (detected) */
.tool-grid {
  width: 560px; max-width: 100%;
  display: flex; flex-direction: column; gap: 7px;
  margin-top: 18px;
}
.tool-card {
  display: flex; align-items: center; gap: 12px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,100,44,0.1); }
.tool-card.undetected { opacity: 0.55; }
.tool-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tool-meta { font-size: 11px; color: var(--ink-600); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-badge {
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px;
  background: var(--ink-100); color: var(--ink-600);
}
.tool-badge.new { background: var(--green-bg); color: var(--green); }
.tool-badge.warn { background: var(--yellow-bg); color: #92400e; }
.tool-badge.detected { background: var(--brand-50); color: var(--brand); }

/* Toggle */
.toggle {
  position: relative;
  width: 36px; height: 22px;
  background: var(--ink-300);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: left 0.2s;
}
.toggle.on { background: var(--green); }
.toggle.on::after { left: 16px; }
.toggle.brand.on { background: var(--brand); }

/* Buttons */
.btn {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  border: 0.5px solid transparent;
  transition: all 0.12s;
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.btn:disabled { cursor: not-allowed; opacity: 0.5; }
.btn-primary {
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  color: white;
  box-shadow: 0 1px 2px rgba(232,100,44,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:active { filter: brightness(0.95); }
.btn-secondary {
  background: white;
  color: var(--ink-800);
  border-color: var(--ink-300);
}
.btn-secondary:hover:not(:disabled) { background: var(--ink-50); }
.btn-ghost {
  background: transparent; color: var(--ink-700);
}
.btn-ghost:hover:not(:disabled) { background: var(--ink-100); }
.btn-danger {
  background: white; color: var(--red);
  border-color: var(--ink-300);
}
.btn-danger:hover:not(:disabled) { background: var(--red-bg); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-block { width: 100%; }
.btn-white {
  background: rgba(255,255,255,0.22);
  color: white;
  backdrop-filter: blur(10px);
  border: 0.5px solid rgba(255,255,255,0.3);
}
.btn-white:hover:not(:disabled) { background: rgba(255,255,255,0.3); }

/* OAuth */
.oauth-window {
  width: 420px; max-width: 100%;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08), 0 0 0 1px var(--ink-200);
  padding: 22px;
  margin-top: 18px;
  text-align: center;
}
.oauth-logo {
  width: 52px; height: 52px; border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; font-weight: 800; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 20px rgba(232,100,44,0.3);
}
.oauth-title { font-size: 15px; font-weight: 700; }
.oauth-sub { font-size: 11px; color: var(--ink-600); margin-top: 3px; }
.oauth-perms {
  margin-top: 14px;
  text-align: left;
  background: var(--ink-50);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.oauth-perms-title { font-size: 10px; font-weight: 600; color: var(--ink-700); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.oauth-perm {
  font-size: 12px; color: var(--ink-700);
  padding: 2px 0;
  display: flex; align-items: center; gap: 6px;
}
.oauth-perm::before {
  content: "✓"; color: var(--green); font-weight: 700;
}
.oauth-buttons {
  display: flex; gap: 8px; margin-top: 14px;
}

/* Configuring progress */
.config-list {
  width: 440px; max-width: 100%;
  display: flex; flex-direction: column; gap: 6px;
  margin: 18px auto 0;
}
.config-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.config-icon {
  width: 22px; height: 22px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 10px;
  flex-shrink: 0;
}
.config-name { flex: 1; font-weight: 500; }
.config-status { font-size: 11px; color: var(--ink-500); display: flex; align-items: center; gap: 6px; }
.config-row.done .config-status { color: var(--green); font-weight: 600; }
.config-row.doing .config-status { color: var(--brand); font-weight: 600; }
.config-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--ink-300);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.config-check {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Main App Window ========== */
.main-wrap { flex: 1; display: flex; min-height: 0; }
.sidebar-nav {
  width: 180px;
  background: var(--sidebar);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border-right: 0.5px solid var(--ink-200);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 12px 14px;
  display: flex; align-items: center; gap: 9px;
  border-bottom: 0.5px solid var(--ink-200);
}
.sb-logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sb-title { font-weight: 600; font-size: 12px; }
.sb-sub { font-size: 10px; color: var(--ink-500); }

.sidebar-section {
  padding: 10px 14px 4px;
  font-size: 10px; font-weight: 600; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  margin: 1px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-800);
  cursor: pointer;
  transition: background 0.1s;
}
.sidebar-item:hover { background: rgba(0,0,0,0.05); }
.sidebar-item.active {
  background: var(--brand);
  color: white;
  font-weight: 500;
}
.sidebar-item .si-icon {
  width: 14px; text-align: center; flex-shrink: 0;
  font-size: 13px;
}
.sidebar-item .si-badge {
  margin-left: auto;
  font-size: 10px;
  background: rgba(0,0,0,0.06);
  color: var(--ink-700);
  padding: 0 5px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
}
.sidebar-item.active .si-badge {
  background: rgba(255,255,255,0.25);
  color: white;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 10px;
  border-top: 0.5px solid var(--ink-200);
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
}
.sidebar-user:hover { background: rgba(0,0,0,0.04); }
.sidebar-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #6b7bff, #a855f7);
  color: white; font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.su-name { font-size: 12px; font-weight: 600; }
.su-bal { font-size: 10px; color: var(--ink-500); }

/* Content area */
.content {
  flex: 1; min-width: 0;
  overflow-y: auto;
  background: #fafafa;
}
.content-header {
  padding: 14px 24px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 0.5px solid var(--ink-200);
  background: var(--panel);
  position: sticky; top: 0;
  backdrop-filter: blur(20px);
  z-index: 5;
  gap: 10px;
}
.content-title { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
.content-sub { font-size: 12px; color: var(--ink-600); margin-top: 1px; }
.content-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.content-body { padding: 16px 24px 24px; }

/* ===== Single-view main window ===== */
.single-view {
  flex: 1;
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 18px 22px;
  gap: 14px;
  background: #fafafa;
}

/* Account summary card */
.sv-account {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
}
.sv-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #6b7bff, #a855f7);
  color: white; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sv-account-info { min-width: 0; }
.sv-account-name { font-weight: 600; font-size: 14px; }
.sv-account-email { font-size: 11px; color: var(--ink-600); margin-top: 1px; }
.sv-balance { flex: 1; text-align: right; min-width: 0; padding: 0 8px; }
.sv-balance-label { font-size: 10px; color: var(--ink-600); text-transform: uppercase; letter-spacing: 0.4px; }
.sv-balance-value { font-size: 20px; font-weight: 700; color: var(--ink-900); margin-top: 1px; letter-spacing: -0.3px; }
.sv-balance-sub { font-size: 11px; color: var(--ink-500); margin-top: 1px; }

/* Today strip */
.sv-today {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 12px 0;
  display: flex; align-items: center;
}
.sv-today-cell { flex: 1; text-align: center; }
.sv-today-label { font-size: 10px; color: var(--ink-600); text-transform: uppercase; letter-spacing: 0.4px; }
.sv-today-value { font-size: 17px; font-weight: 600; margin-top: 2px; letter-spacing: -0.2px; }
.sv-today-sep { width: 0.5px; height: 26px; background: var(--ink-200); }

/* Tool list section */
.sv-section { display: flex; flex-direction: column; gap: 6px; }
.sv-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px;
  margin-bottom: 2px;
}
.sv-section-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.sv-section-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 10px; font-weight: 600; color: var(--ink-600);
  background: var(--ink-100);
  border-radius: 9px;
}
.sv-section-actions { display: flex; gap: 4px; }

.sv-tools {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.sv-tool {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--ink-200);
  transition: background 0.1s;
}
.sv-tool:last-child { border-bottom: none; }
.sv-tool:hover { background: var(--ink-50); }
.sv-tool-icon {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.sv-tool-main { flex: 1; min-width: 0; }
.sv-tool-name { font-weight: 600; font-size: 13px; }
.sv-tool-meta {
  font-size: 11px; color: var(--ink-600);
  margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
}
.sv-tool-meta .sep { color: var(--ink-300); }
.sv-tool-cost {
  font-size: 13px; font-weight: 600; color: var(--ink-800);
  min-width: 60px; text-align: right;
}
.sv-tool-actions { flex-shrink: 0; }

.sv-footer {
  margin-top: auto;
  padding-top: 4px;
  display: flex; align-items: center; gap: 14px;
}
.sv-link {
  font-size: 12px; color: var(--brand);
  text-decoration: none;
}
.sv-link:hover { text-decoration: underline; }

/* ===== Dashboard (legacy, unused) ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.stat-card.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; border: none;
}
.stat-card.primary::after {
  content: ""; position: absolute; right: -20px; bottom: -20px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.stat-label { font-size: 11px; color: var(--ink-600); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500; }
.stat-card.primary .stat-label { color: rgba(255,255,255,0.85); }
.stat-value {
  font-size: 24px; font-weight: 700; margin-top: 3px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
}
.stat-value.sm { font-size: 18px; }
.stat-sub { font-size: 11px; color: var(--ink-600); margin-top: 2px; }
.stat-card.primary .stat-sub { color: rgba(255,255,255,0.85); }
.stat-delta {
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 2px;
  margin-top: 4px;
}
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-card.primary .stat-delta { color: rgba(255,255,255,0.95); }
.stat-card-actions {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 4px;
  z-index: 2;
}

/* Chart */
.chart-card {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}
.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}
.chart-title { font-weight: 600; font-size: 13px; }
.chart-legend { display: flex; gap: 12px; font-size: 11px; color: var(--ink-600); flex-wrap: wrap; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.chart-tabs {
  display: inline-flex; background: var(--ink-100); border-radius: 6px; padding: 2px;
}
.chart-tab {
  padding: 3px 9px;
  font-size: 11px; font-weight: 500;
  color: var(--ink-600);
  border-radius: 4px;
  cursor: pointer;
}
.chart-tab.active {
  background: white;
  color: var(--ink-900);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.chart {
  height: 180px;
  display: flex; align-items: flex-end;
  gap: 4px;
  padding: 0 6px;
  position: relative;
}
.chart-grid {
  position: absolute; inset: 0 6px 18px 6px;
  display: flex; flex-direction: column; justify-content: space-between;
  pointer-events: none;
}
.chart-grid-line {
  height: 0; border-top: 1px dashed var(--ink-200);
  position: relative;
}
.chart-grid-line::before {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 4px);
  top: -5px;
  font-size: 9px;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart {
  padding-left: 34px;
}
.chart-grid {
  inset: 0 6px 18px 34px;
}
.bar-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 2px;
  position: relative;
  z-index: 1;
}
.bar-stack {
  width: 100%;
  display: flex; flex-direction: column; justify-content: flex-end;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  position: relative;
}
.bar-seg {
  width: 100%;
  transition: opacity 0.1s;
}
.bar-col:hover .bar-seg { opacity: 0.85; }
.bar-label {
  font-size: 9px; color: var(--ink-500);
  font-variant-numeric: tabular-nums;
}

/* Tool list (main) */
.tools-list { display: flex; flex-direction: column; gap: 8px; }
.tool-row {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color 0.15s;
}
.tool-row:hover { border-color: var(--ink-300); }
.tool-row-icon {
  width: 40px; height: 40px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.tool-row-main { flex: 1; min-width: 0; }
.tool-row-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-row-meta { font-size: 11px; color: var(--ink-600); margin-top: 3px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tool-row-meta .sep { color: var(--ink-300); }
.tool-row-stat { text-align: right; min-width: 110px; }
.tool-row-stat-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tool-row-stat-sub { font-size: 10px; color: var(--ink-500); margin-top: 1px; }
.tool-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.status-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  margin-right: 4px;
  flex-shrink: 0;
}
.status-dot.off { background: var(--ink-300); }
.status-dot.err { background: var(--red); }
.status-dot.warn { background: var(--yellow); }

/* Sections */
.sec { margin-bottom: 20px; }
.sec-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 8px;
  gap: 10px;
}
.sec-title { font-weight: 600; font-size: 13px; }
.sec-sub { font-size: 11px; color: var(--ink-600); margin-top: 1px; }

/* Settings */
.settings-group {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 14px;
}
.settings-group-title {
  padding: 9px 14px;
  font-size: 11px; font-weight: 600; color: var(--ink-600);
  text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--ink-50);
  border-bottom: 0.5px solid var(--ink-200);
}
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--ink-200);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-main { flex: 1; min-width: 0; }
.settings-row-title { font-size: 13px; font-weight: 500; }
.settings-row-sub { font-size: 11px; color: var(--ink-600); margin-top: 2px; line-height: 1.5; }

.input {
  padding: 5px 9px;
  font-size: 12px;
  border: 1px solid var(--ink-300);
  border-radius: 5px;
  background: white;
  font-family: inherit;
  width: 100%;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,100,44,0.15); }
.input.mono { font-family: "SF Mono", Menlo, monospace; font-size: 11px; }

.select {
  padding: 4px 24px 4px 9px;
  font-size: 12px;
  border: 1px solid var(--ink-300);
  border-radius: 5px;
  background: white url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%236e6e73' stroke-width='1.5' d='M1 1l4 4 4-4'/></svg>") no-repeat right 8px center;
  -webkit-appearance: none;
  font-family: inherit;
  cursor: pointer;
}

/* Dock */
.dock {
  position: absolute;
  bottom: 6px;
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3), inset 0 0.5px 0 rgba(255,255,255,0.3);
  z-index: 50;
}
.dock-item {
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 28px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.4, 0.64, 1);
  position: relative;
  flex-shrink: 0;
  transform-origin: center bottom;
}
.dock-item:hover { transform: translateY(-10px) scale(1.25); }
.dock-item:has(+ .dock-item:hover),
.dock-item:hover + .dock-item,
.dock-item:hover + .dock-sep + .dock-item { transform: translateY(-4px) scale(1.1); }
.dock-item:has(+ .dock-item + .dock-item:hover),
.dock-item:has(+ .dock-item + .dock-sep + .dock-item:hover),
.dock-item:hover + .dock-item + .dock-item,
.dock-item:hover + .dock-item + .dock-sep + .dock-item,
.dock-item:hover + .dock-sep + .dock-item + .dock-item { transform: translateY(-1px) scale(1.04); }
.dock-item::before {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 3px 8px;
  background: rgba(30, 30, 35, 0.92);
  color: white;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.dock-item:hover::before { opacity: 1; }
.dock-item.running::after {
  content: "";
  position: absolute; bottom: -4px;
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255,255,255,0.9);
}
.dock-finder  { background: linear-gradient(180deg, #7bafff, #0066ff); }
.dock-safari  { background: linear-gradient(180deg, #f8f8f8, #e8e8e8); color: #1e88e5; font-size: 32px; }
.dock-terminal{ background: linear-gradient(180deg, #2c2c2c, #0f0f0f); font-size: 22px; }
.dock-vscode  { background: linear-gradient(180deg, #2b82d2, #0062a8); font-size: 26px; }
.dock-cursor  { background: linear-gradient(180deg, #222, #000); font-size: 26px; }
.dock-ofox    { background: linear-gradient(135deg, var(--brand), var(--brand-light)); font-size: 26px; letter-spacing: -1px; }
.dock-sep     { width: 1px; height: 42px; background: rgba(255,255,255,0.25); margin: 0 4px; align-self: center; }
.dock-trash   { background: linear-gradient(180deg, #d0d0d0, #999); }

/* Prototype control panel */
.proto-panel {
  position: fixed; top: 36px; left: 14px;
  width: 220px;
  background: rgba(15, 15, 20, 0.82);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: 12px;
  padding: 10px;
  color: white;
  font-size: 11px;
  z-index: 300;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  border: 0.5px solid rgba(255,255,255,0.1);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}
.proto-panel.collapsed {
  width: 40px;
  padding: 6px;
  height: 40px;
  overflow: hidden;
}
.proto-panel.collapsed > *:not(.proto-toggle) { display: none; }
.proto-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 7px;
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  position: absolute; top: 6px; right: 6px;
}
.proto-toggle:hover { background: rgba(255,255,255,0.2); }
.proto-panel.collapsed .proto-toggle { position: static; }
.proto-title {
  font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  opacity: 0.7; padding: 4px 6px 8px;
}
.proto-section {
  padding: 6px 0;
  border-top: 0.5px solid rgba(255,255,255,0.08);
}
.proto-section:first-of-type { border-top: none; }
.proto-section-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  opacity: 0.5; letter-spacing: 0.5px;
  padding: 0 6px 4px;
}
.proto-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  transition: background 0.12s;
}
.proto-btn:hover { background: rgba(255,255,255,0.08); }
.proto-btn.active { background: var(--brand); color: white; font-weight: 600; }
.proto-btn .idx {
  width: 16px; height: 16px; border-radius: 4px;
  background: rgba(255,255,255,0.1);
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
.proto-btn.active .idx { background: rgba(255,255,255,0.25); }

/* Helpers */
.text-sm { font-size: 11px; }
.muted { color: var(--ink-500); }
.mono { font-family: "SF Mono", Menlo, monospace; }
.tabular { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.mb-2 { margin-bottom: 6px; } .mb-3 { margin-bottom: 10px; } .mb-4 { margin-bottom: 14px; }
.mt-3 { margin-top: 10px; }
.hr { height: 0.5px; background: var(--ink-200); margin: 10px 0; }

/* Pills / chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  font-size: 10px; font-weight: 600;
  border-radius: 999px;
  background: var(--ink-100);
  color: var(--ink-700);
  white-space: nowrap;
}
.chip.brand { background: var(--brand-50); color: var(--brand); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.yellow { background: var(--yellow-bg); color: #92400e; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: #dbeafe; color: var(--blue); }

/* Form */
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 11px; font-weight: 600; color: var(--ink-700); }

/* Sheet (modal) */
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center; justify-content: center;
  z-index: 60;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  width: 460px; max-width: 90%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 90%;
}
.sheet-head {
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--ink-200);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sheet-title { font-weight: 600; font-size: 14px; }
.sheet-body { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.sheet-foot { padding: 12px 16px; border-top: 0.5px solid var(--ink-200); display: flex; justify-content: flex-end; gap: 8px; background: var(--ink-50); flex-shrink: 0; }

/* Code block */
pre.code {
  background: #1d1d1f;
  color: #eae8e4;
  padding: 10px 12px;
  border-radius: 6px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.6;
  overflow-x: auto;
}
pre.code .k { color: #ffb86c; }
pre.code .s { color: #8be9fd; }
pre.code .c { color: #6272a4; }

/* Usage table */
.usage-table {
  background: white;
  border: 0.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.usage-row {
  display: grid;
  grid-template-columns: 80px 150px 1fr 70px 70px 80px 70px;
  gap: 10px;
  padding: 9px 14px;
  font-size: 11px;
  border-bottom: 0.5px solid var(--ink-200);
  align-items: center;
}
.usage-row.usage-head {
  font-weight: 600; color: var(--ink-600);
  text-transform: uppercase; letter-spacing: 0.4px;
  font-size: 10px;
  background: var(--ink-50);
  padding: 10px 14px;
}
.usage-row:last-child { border-bottom: none; }
.usage-tool {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
}
.usage-tool .ut-icon {
  width: 14px; height: 14px; border-radius: 4px; color: white;
  font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.usage-tool .ut-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-right { text-align: right; }

/* Toast */
.toast {
  position: absolute; top: 34px; right: 14px;
  background: rgba(30,30,35,0.92);
  backdrop-filter: blur(20px);
  color: white;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  display: flex; align-items: flex-start; gap: 10px;
  width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 250;
  opacity: 0; transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-icon {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: white; font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast-title { font-weight: 600; }
.toast-body { opacity: 0.8; margin-top: 2px; font-size: 11px; }

/* Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 6px; border: 1px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.32); }
.content, .sidebar-nav, .install-body, .sheet-body { scrollbar-gutter: stable; }

@media (max-width: 1100px) {
  .app-window { width: 92vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
