:root {
  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --accent: #5b5ef4;
  --accent2: #8b5cf6;
  --banner-h: 34px;
  --nav-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ── Dev banner ── */
#dev-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--banner-h);
  z-index: 9999;
  background: linear-gradient(90deg, #c0392b 0%, #e74c3c 50%, #c0392b 100%);
  background-size: 200% 100%;
  animation: banner-shimmer 4s linear infinite;
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

@keyframes banner-shimmer {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

#dev-branch {
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11px;
  background: rgba(255,255,255,.18);
  padding: 2px 8px;
  border-radius: 20px;
}

#dev-sep { opacity: .45; }

#dev-time {
  opacity: .9;
  font-variant-numeric: tabular-nums;
}

/* ── Bottom nav ── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1.5px solid rgba(0,0,0,.09);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 12px;
  z-index: 10000;
}

/* Nav tab buttons */
.nav-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: #b0b0c8;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 12px;
  transition: color .15s, background .15s;
  flex: none;
  min-width: 64px;
}
.nav-btn svg { transition: color .15s; }
.nav-btn:hover { color: #7878aa; background: rgba(0,0,0,.04); }
.nav-btn.active { color: var(--accent); }
.nav-btn.active svg { color: var(--accent); }

/* ── Add app button (inside apps list) ── */
.add-app-wrap {
  padding: 8px 14px 16px;
}
.add-app-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  border-radius: 16px; border: none;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff; font-family: var(--font); font-size: 15.5px; font-weight: 700;
  cursor: pointer; letter-spacing: .01em;
  box-shadow: 0 4px 16px rgba(91,94,244,.35);
  transition: opacity .15s, transform .1s;
}
.add-app-btn:active { opacity: .85; transform: scale(.98); }

/* ── Pages ── */
#page-apps, #page-add {
  position: fixed;
  top: var(--banner-h); left: 0; right: 0; bottom: var(--nav-h);
  background: #f4f5f9;
  overflow-y: auto;
}
#page-add  { z-index: 200; }
#page-apps { z-index: 100; }
#page-add[hidden]  { display: none; }
#page-apps[hidden] { display: none; }

/* ── Apps list page ── */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 20px 18px;
  background: #fff;
  border-bottom: 1.5px solid rgba(0,0,0,.07);
  gap: 4px;
  flex: none;
}
.page-header h1 {
  font-size: 22px; font-weight: 700; font-family: var(--font);
  color: #0d0d14; letter-spacing: -.03em; line-height: 1.1;
}
.page-header .header-sub {
  font-size: 12px; font-family: var(--font);
  color: #a0a0b0; font-weight: 400;
}

#apps-list-wrap {
  padding: 16px 14px calc(env(safe-area-inset-bottom) + 8px);
}

#apps-list { display: flex; flex-direction: column; gap: 10px; }

/* ── Job detail page ── */
#page-job {
  display: flex; flex-direction: column;
  min-height: 100%;
  padding-top: var(--banner-h);
}
.job-detail-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.07);
  padding: 12px 16px 16px;
}
.job-back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 2px; border: none; background: none; padding: 4px 0;
  font-family: var(--font); font-size: 15px; color: var(--accent);
  cursor: pointer; margin-bottom: 14px;
}
.job-detail-app {
  display: flex; align-items: center; gap: 14px;
}
.job-detail-icon {
  width: 56px; height: 56px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; overflow: hidden;
}
.job-detail-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.job-detail-name { font-family: var(--font); font-size: 18px; font-weight: 700; color: #111; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-detail-pkg  { font-family: 'SF Mono','Fira Mono',monospace; font-size: 11px; color: #a0a0b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-detail-meta { font-family: var(--font); font-size: 11px; color: #b0b0c0; margin-top: 3px; }

.job-section-wrap { padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 6px; }
.job-section-label {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: #a0a0b0;
  padding: 10px 4px 6px;
}
.job-rows-group {
  background: #fff; border-radius: 16px;
  border: 1.5px solid rgba(0,0,0,.07);
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
  overflow: hidden;
}
.job-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.05);
  text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.job-row:last-child { border-bottom: none; }
.job-row:active { background: rgba(0,0,0,.04); }
.job-row-ico   { font-size: 20px; flex: none; width: 28px; text-align: center; }
.job-row-text  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.job-row-title { font-family: var(--font); font-size: 15px; font-weight: 500; color: #111; }
.job-row-sub   { font-family: var(--font); font-size: 12px; color: #a0a0b0; }
.job-row-arrow { font-size: 18px; color: #c0c0c0; flex: none; }
.job-row-action {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--accent); flex: none;
}
.job-row.disabled { opacity: .4; pointer-events: none; }
.job-detail-date { font-family: var(--font); font-size: 12px; color: #c0c0c0; text-align: center; margin-top: 12px; }

/* ── Subview page (audit / files — one level deeper than job detail) ── */
#page-subview { display: flex; flex-direction: column; min-height: 100%; padding-top: var(--banner-h); }
.subview-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.07);
  padding: 12px 16px 14px;
  flex: none;
}
.subview-title {
  font-family: var(--font); font-size: 17px; font-weight: 700; color: #111;
  padding-top: 2px;
}
.subview-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 32px;
  -webkit-overflow-scrolling: touch;
}
/* Score cards inside subview need no outer margin */
.subview-content .report-scores { margin-bottom: 20px; }
.subview-content .finding-row   { background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05); border: 1px solid rgba(0,0,0,.06); }

/* ── Apps search bar ── */
.apps-search-bar {
  display: flex; gap: 8px; margin: 0 0 14px;
}
.apps-search-bar input[type="search"] {
  flex: 1; min-width: 0;
  height: 36px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 14px; outline: none;
  transition: border-color .15s;
}
.apps-search-bar input[type="search"]:focus { border-color: var(--accent); }
.apps-search-bar select {
  height: 36px; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13px; cursor: pointer; outline: none;
}
.apps-search-bar select:focus { border-color: var(--accent); }

/* ── App card ── */
.app-card {
  background: #fff;
  border: 1.5px solid rgba(0,0,0,.07);
  border-radius: 18px;
  padding: 14px 14px 14px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.055);
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.app-card:active { transform: scale(.98); box-shadow: 0 1px 4px rgba(0,0,0,.07); }

/* Icon */
.app-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  display: flex; align-items: center; justify-content: center;
  flex: none; font-size: 22px; overflow: hidden;
}

/* Info column (takes remaining space) */
.app-card-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.app-card-name {
  font-family: var(--font); font-size: 15px; font-weight: 700; color: #111;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.25;
}
.app-card-pkg {
  font-family: 'SF Mono','Fira Mono',monospace; font-size: 11px;
  color: #a0a0b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Meta row: version · build · date */
.app-card-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-top: 5px;
}
.app-meta-ver   { font-family: var(--font); font-size: 11px; font-weight: 600; color: #555; }
.app-meta-build { font-family: var(--font); font-size: 11px; color: #888; }
.app-meta-date  { font-family: var(--font); font-size: 11px; color: #b0b0c0; }
.app-meta-dot   { font-size: 10px; color: #ccc; line-height: 1; }

/* Delete button (self-aligned to top) */
.app-card-del-btn {
  align-self: flex-start;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: transparent;
  color: #c0392b; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center;
  opacity: .35; flex: none;
  transition: background .12s, opacity .12s;
  -webkit-tap-highlight-color: transparent;
}
.app-card-del-btn:hover  { background: rgba(248,113,113,.15); opacity: 1; }
.app-card-del-btn:active { background: rgba(248,113,113,.28); opacity: 1; }

/* Empty state */
.apps-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; gap: 12px; color: #c0c0d0; font-family: var(--font); text-align: center;
}
.apps-empty-icon { font-size: 48px; opacity: .35; }
.apps-empty-text { font-size: 15px; font-weight: 500; color: #b0b0c0; }
.apps-empty-sub  { font-size: 13px; color: #c8c8d8; }

/* ── Confirmation dialog ── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.confirm-card {
  position: fixed; z-index: 9001;
  left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 20px;
  padding: 28px 20px 20px;
  width: min(320px, calc(100vw - 32px));
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; font-family: var(--font);
}
.confirm-icon  { font-size: 38px; margin-bottom: 2px; }
.confirm-title { font-size: 17px; font-weight: 700; color: #111; }
.confirm-msg   { font-size: 13px; color: #888; line-height: 1.5; max-width: 260px; }
.confirm-btns  { display: flex; gap: 10px; width: 100%; margin-top: 14px; }
.confirm-cancel-btn {
  flex: 1; padding: 13px; border-radius: 14px;
  border: 1.5px solid rgba(0,0,0,.1); background: #f4f5f9;
  color: #333; font-family: var(--font); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.confirm-cancel-btn:active { background: #e8e9f0; }
.confirm-ok-btn {
  flex: 1; padding: 13px; border-radius: 14px;
  border: none; background: #c0392b; color: #fff;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.confirm-ok-btn:active { background: #a93226; }

/* #page-add-header uses shared .page-header class now */

/* ── Tabs ── */
#add-tabs {
  display: flex;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.06);
  scrollbar-width: none;
  padding: 0 8px;
  gap: 2px;
}
#add-tabs::-webkit-scrollbar { display: none; }

.add-tab {
  flex: 0 0 72px;
  width: 72px;
  padding: 10px 4px 12px;
  border: none;
  background: none;
  font-family: var(--font);
  color: #a0a0b0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.tab-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f0f0f5;
  color: #a0a0b0;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s, color .25s, transform .2s;
}

.add-tab.active .tab-num {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(91,94,244,.35);
}

.tab-label {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .01em;
}

.add-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tab panes ── */
#add-tab-body { flex: 1; overflow-y: auto; }

.add-pane { padding: 20px 16px; }
.add-pane[hidden] { display: none; }

#pane-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 60px;
  gap: 20px;
}

/* ── Upload states ── */
#upload-idle, #upload-loading, #upload-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

/* Button */
#pick-apk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 30px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(91,94,244,.4);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
  width: 100%;
  box-sizing: border-box;
}
#pick-apk-btn:active {
  transform: scale(.95);
  box-shadow: 0 2px 10px rgba(91,94,244,.25);
  transition-duration: .08s;
}

/* Spinner */
.upload-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid #e8e8f0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.upload-status-text {
  font-size: 14px;
  font-family: var(--font);
  color: #888;
  font-weight: 500;
}

/* Done state */
.upload-done-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34c759, #30d158);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(52,199,89,.4);
  animation: pop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.upload-filename {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  color: #111;
  text-align: center;
  max-width: 260px;
  word-break: break-all;
  letter-spacing: -.01em;
}

.upload-filesize {
  font-size: 13px;
  font-family: var(--font);
  color: #a0a0b0;
  margin-top: -10px;
}

.next-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(91,94,244,.4);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1);
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
}
.next-btn:active {
  transform: scale(.95);
  transition-duration: .08s;
}

.secondary-btn {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  border: 1.5px solid rgba(91,94,244,.25);
}
.secondary-btn:active { box-shadow: none; }

/* ── Toast ── */
#cryptor-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a1a2e;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 50px;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
}
#cryptor-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Audit ── */
#pane-audit {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 16px;
}

#audit-idle {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

.audit-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 24px 8px 8px;
}

.audit-intro-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(91,94,244,.12), rgba(139,92,246,.12));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 4px;
}

.audit-intro-title {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font);
  color: var(--fg);
  margin: 0;
  letter-spacing: -.02em;
}

.audit-intro-desc {
  font-size: 14px;
  font-family: var(--font);
  color: #888;
  line-height: 1.55;
  margin: 0;
  max-width: 280px;
}


#audit-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 24px;
}

#audit-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  margin-top: 6px;
}

.audit-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-family: var(--font);
  color: #888;
  font-weight: 500;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s, transform .3s;
}
.audit-step.visible { opacity: 1; transform: none; }
.audit-step.done { color: #34c759; }
.audit-step.done .step-dot { background: #34c759; }
.audit-step.active { color: #111; }
.audit-step.active .step-dot { background: var(--accent); animation: pulse-dot 1s ease infinite; }

.step-dot {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  background: #d0d0e0;
  background: #ddd;
  flex-shrink: 0;
  transition: background .3s;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: .7; }
}

/* Report */
#audit-report {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.score-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.score-label {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  color: #a0a0b0;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.score-val {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font);
  color: #111;
  letter-spacing: -.03em;
  line-height: 1;
}

.score-bar {
  height: 4px;
  background: #f0f0f5;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
}

.score-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

.audit-findings-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finding-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  font-family: var(--font);
  color: #333;
  line-height: 1.4;
}

.finding-icon { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

.report-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
  padding-bottom: 8px;
}

/* ── Protect pane ── */
#pane-protect {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 16px 32px;
}

.protect-section {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.protect-section-title {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  color: #a0a0b0;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 16px 8px;
}

.protect-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-top: 1px solid rgba(0,0,0,.05);
}

.protect-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.protect-option-name {
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  color: #111;
  letter-spacing: -.01em;
}

.protect-option-desc {
  font-size: 12px;
  font-family: var(--font);
  color: #a0a0b0;
  font-weight: 400;
  line-height: 1.3;
}

/* Text-input variant of protect-option (e.g. AI Trap URL) */
.protect-option-text {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.protect-text-input {
  height: 38px; border-radius: 9px; border: 1.5px solid rgba(0,0,0,.1);
  padding: 0 12px; font-size: .85rem; font-family: var(--font);
  background: var(--surface); outline: none; width: 100%;
  box-sizing: border-box; transition: border-color .15s; color: var(--text);
}
.protect-text-input:focus { border-color: var(--accent); }
.protect-text-input::placeholder { color: #b0b0c0; }
.dl-canary-block {
  background: var(--surface); border: 1.5px solid rgba(91,94,244,.25);
  border-radius: 12px; padding: 14px 16px; margin: 0 0 10px;
  text-align: left;
}
.dl-canary-label { font-size: .82rem; font-weight: 600; margin-bottom: 4px; color: var(--accent); }
.dl-canary-desc  { font-size: .78rem; color: var(--text); opacity: .7; margin-bottom: 8px; }
.dl-canary-urls  { display: flex; flex-direction: column; gap: 4px; }
.dl-canary-url   {
  font-size: .75rem; font-family: monospace; color: var(--accent);
  word-break: break-all; text-decoration: none;
}
.dl-canary-url:hover { text-decoration: underline; }

/* Canary event detail (in triage panel) */
.ev-canary-detail {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px; margin-bottom: 8px;
  background: rgba(255,80,0,.06); border-radius: 6px;
  border-left: 3px solid var(--accent);
}
.ev-canary-row { display: flex; gap: 8px; align-items: baseline; font-size: .78rem; }
.ev-canary-k   { color: var(--text); opacity: .6; white-space: nowrap; }
.ev-canary-v   { color: var(--text); }
.ev-canary-mono { font-family: monospace; font-size: .74rem; word-break: break-all; }
.ev-canary-ua   { font-size: .72rem; opacity: .8; word-break: break-all; }
.ev-canary-url-val { color: var(--accent); }
.ev-canary-rdns { font-size: .7rem; opacity: .6; }

/* Toggle switch */
.toggle {
  flex-shrink: 0;
  position: relative;
  width: 46px;
  height: 26px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: #dde0e8;
  border-radius: 13px;
  transition: background .22s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.protect-actions {
  padding-top: 4px;
  display: flex;
  justify-content: center;
}

/* ── Protect loading / done states ── */
#protect-loading,
#protect-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 0 24px;
  width: 100%;
}
#protect-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  margin-top: 6px;
}

/* ── Compare pane ── */
#pane-compare {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 32px;
}

.cmp-cols-header {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.cmp-col-label {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cmp-label-before { color: #a0a0b0; }
.cmp-label-after  { color: var(--accent); }

/* Score rows */
.cmp-score-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cmp-score-card {
  flex: 1;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.cmp-before { opacity: .72; }
.cmp-after  { border: 1.5px solid rgba(91,94,244,.2); }

.cmp-score-title {
  font-size: 10px;
  font-family: var(--font);
  font-weight: 700;
  color: #a0a0b0;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.cmp-score-val {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font);
  color: #111;
  letter-spacing: -.03em;
  line-height: 1;
}
.cmp-after .cmp-score-val { color: var(--accent); }

.cmp-bar {
  height: 4px;
  background: #f0f0f5;
  border-radius: 4px;
  overflow: hidden;
}
.cmp-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.cmp-fill-before { background: #c0c0d0; }
.cmp-fill-after  { background: linear-gradient(90deg, var(--accent), var(--accent2)); }

/* Arrow + delta between cards */
.cmp-arrow-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.cmp-arrow { color: #c0c0d0; }

.cmp-delta {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  color: #34c759;
  letter-spacing: -.01em;
  min-height: 14px;
}

/* Findings diff */
.cmp-findings-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cmp-findings-title {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  color: #a0a0b0;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 2px;
}

.cmp-finding-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmp-icon-before,
.cmp-icon-after  { font-size: 14px; flex-shrink: 0; }
.cmp-row-arrow   { flex-shrink: 0; }

.cmp-finding-text {
  font-size: 13px;
  font-family: var(--font);
  color: #333;
  line-height: 1.3;
  flex: 1;
}

/* ── File diff (compare pane) ── */
.cmp-files-section {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diff-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.diff-pill {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f0f0f5;
  color: #666;
}
.diff-pill.add { background: rgba(52,199,89,.12); color: #22a84a; }
.diff-pill.chg { background: rgba(251,191,36,.15); color: #b07c00; }
.diff-pill.rem { background: rgba(248,113,113,.12); color: #c0392b; }

.cmp-files-group-title {
  font-size: 12px;
  font-family: var(--font);
  font-weight: 700;
  color: #555;
  margin-top: 4px;
}

.diff-file-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.diff-file-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f8f8fc;
  min-width: 0;
}
.diff-file-row.add { background: rgba(52,199,89,.07); }
.diff-file-row.rem { background: rgba(248,113,113,.07); }
.diff-file-row.chg { background: rgba(251,191,36,.06); }

.diff-badge {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--font);
}
.diff-badge.add { background: rgba(52,199,89,.18); color: #22a84a; }
.diff-badge.rem { background: rgba(248,113,113,.18); color: #c0392b; }
.diff-badge.chg { background: rgba(251,191,36,.18); color: #b07c00; }

.diff-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 11.5px;
  color: #333;
}

.diff-size {
  flex-shrink: 0;
  font-size: 11px;
  font-family: var(--font);
  color: #a0a0b0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.diff-hash {
  flex-shrink: 0;
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Mono', monospace;
  color: #b0b0c0;
  white-space: nowrap;
}

/* ── Compare tab file explorer ── */
#cmp-explorer-box { margin-top: .75rem; }
.cmp-expl-box { border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: .5rem; }
.cmp-expl-tabs { display: flex; border-bottom: 1px solid rgba(0,0,0,.07); }
.cmp-expl-tab { flex: 1; padding: .42rem .2rem; background: none; border: none; border-bottom: 2px solid transparent; font-size: .75rem; font-weight: 500; font-family: var(--font); color: #a0a0b0; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .3rem; transition: color .12s; }
.cmp-expl-tab.active { color: #111; border-bottom-color: var(--accent); font-weight: 600; }
.cmp-expl-ct { font-size: .63rem; background: #f0f0f5; color: #a0a0b0; border-radius: 20px; padding: 1px 5px; font-variant-numeric: tabular-nums; }
.cmp-expl-tab.active .cmp-expl-ct { background: rgba(91,94,244,.1); color: var(--accent); }
.cmp-expl-list { max-height: 240px; overflow-y: auto; padding: .3rem .2rem; }
.cmp-expl-row { display: flex; align-items: center; gap: .4rem; padding: .24rem .45rem; border-radius: 6px; cursor: pointer; min-width: 0; }
.cmp-expl-row:hover { background: rgba(0,0,0,.04); }
.cmp-expl-row.ce-sel { background: rgba(91,94,244,.08); }
.cmp-expl-row.ce-sel .cmp-expl-name { color: var(--accent); }
.cmp-expl-badge { font-size: .61rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; flex: none; }
.cmp-expl-badge.add { background: rgba(52,199,89,.15); color: #22a84a; }
.cmp-expl-badge.chg { background: rgba(251,191,36,.15); color: #b07c00; }
.cmp-expl-name { font-family: 'SF Mono','Fira Mono',monospace; font-size: .72rem; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cmp-expl-dir { color: #b0b0c0; font-size: .68rem; }
.cmp-expl-sz { font-family: 'SF Mono','Fira Mono',monospace; font-size: .64rem; color: #c0c0d0; flex: none; white-space: nowrap; }
.cmp-expl-content { border-top: 1px solid rgba(0,0,0,.07); }
.cmp-expl-ch { display: flex; align-items: center; gap: .5rem; padding: .35rem .75rem; border-bottom: 1px solid rgba(0,0,0,.07); background: #f4f5f9; }
.cmp-expl-ch-path { flex: 1; font-family: 'SF Mono','Fira Mono',monospace; font-size: .71rem; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-expl-area { max-height: 260px; overflow: auto; background: #fff; }
.cmp-expl-pre { margin: 0; padding: .6rem 1rem; font-family: 'SF Mono','Fira Mono',monospace; font-size: .71rem; line-height: 1.55; color: #222; white-space: pre; tab-size: 4; }
.cmp-expl-empty { display: flex; align-items: center; justify-content: center; padding: 1.5rem; color: #c0c0d0; font-size: .8rem; font-family: var(--font); }

/* ── Code explorer (ported from main, CSS vars resolved for dev2) ── */
.diff-stats { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; font-size: .78rem; }
.ds-item { padding: .18rem .5rem; border-radius: 20px; background: #f0f0f5; font-variant-numeric: tabular-nums; color: #a0a0b0; border: 1px solid rgba(0,0,0,.07); font-family: var(--font); }
.ds-item.add { background: rgba(52,199,89,.12); color: #22a84a; border-color: transparent; font-weight: 600; }
.ds-item.rem { background: rgba(248,113,113,.12); color: #c0392b; border-color: transparent; font-weight: 600; }
.ds-item.chg { background: rgba(251,191,36,.15); color: #b07c00; border-color: transparent; font-weight: 600; }

.ce-card { display: contents; } /* desktop: transparent — children participate in parent grid */
.code-explorer { display: grid; grid-template-columns: 220px 1fr; overflow: hidden; height: 390vw; max-height: 2040px; min-height: 1440px; background: #fff; border-radius: 16px; border: 1.5px solid rgba(0,0,0,.11); box-shadow: 0 4px 20px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.07); }
.ce-sidebar { border-right: 2px solid rgba(0,0,0,.10); display: flex; flex-direction: column; overflow: hidden; min-width: 0; position: relative; }
/* Sidebar header: distinct window-title-bar look */
.ce-tabs { display: flex; border-bottom: 2px solid rgba(0,0,0,.10); flex: none; background: #eef0f6; }
.ce-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: .35rem; padding: .6rem .4rem; font-size: .78rem; font-weight: 500; font-family: var(--font); background: none; border: none; border-bottom: 3px solid transparent; color: #8888aa; cursor: pointer; transition: color .12s, background .12s; }
.ce-tab:hover { background: rgba(0,0,0,.04); color: #555; }
.ce-tab.active { color: #111; border-bottom-color: var(--accent); font-weight: 700; background: #fff; }
.ce-tab-ct { font-size: .67rem; background: #d8dae8; color: #7878a0; border-radius: 20px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.ce-tab.active .ce-tab-ct { background: rgba(91,94,244,.15); color: var(--accent); }
.ce-search { flex: 1; min-width: 60px; max-width: 160px; box-sizing: border-box; padding: .3rem .55rem; border: none; border-left: 1px solid rgba(0,0,0,.10); background: transparent; font-family: var(--font); font-size: .75rem; color: #222; outline: none; }
.ce-search::placeholder { color: #b0b0c8; }
.ce-search:focus { background: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.ce-search-results { display: flex; flex-direction: column; gap: 0; }
.ce-sr-hdr { padding: .55rem .5rem .25rem; font-size: .68rem; font-weight: 700; color: #8888aa; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: .3rem; }
.ce-sr-ct { font-size: .67rem; background: #d8dae8; color: #7878a0; border-radius: 20px; padding: 1px 6px; font-variant-numeric: tabular-nums; font-weight: 400; text-transform: none; letter-spacing: 0; }
.ce-search-empty { padding: .8rem .6rem; text-align: center; font-size: .75rem; color: #b0b0c0; }
.ce-search-loading { padding: .8rem .6rem; font-size: .75rem; color: #b0b0c0; }
.ce-content-match { padding: .28rem .4rem; border-radius: 5px; cursor: pointer; }
.ce-content-match:hover { background: #eef0f6; }
.ce-cm-path { display: flex; align-items: baseline; gap: .15rem; min-width: 0; }
.ce-cm-file { font-family: 'SF Mono','Fira Mono',monospace; font-size: .72rem; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ce-cm-line { font-family: 'SF Mono','Fira Mono',monospace; font-size: .68rem; color: var(--accent); flex: none; }
.ce-cm-snippet { margin: 0; font-family: 'SF Mono','Fira Mono',monospace; font-size: .68rem; color: #888; white-space: pre; overflow: hidden; text-overflow: ellipsis; padding: 0; background: none; border: none; max-width: 100%; }
mark.fuzzy-hl { background: none; color: var(--accent); font-weight: 700; padding: 0; }
.ce-tree-wrap { flex: 1; overflow: auto; padding: .35rem .2rem; }
.tree { display: flex; flex-direction: column; gap: 1px; }
.tree .tree { margin-left: 1rem; padding-left: .35rem; border-left: 1px solid rgba(0,0,0,.09); }
.tree-dir > summary { display: flex; align-items: center; gap: .3rem; cursor: pointer; padding: .22rem .3rem; border-radius: 5px; user-select: none; list-style: none; font-size: .8rem; color: #111; }
.tree-dir > summary::-webkit-details-marker { display: none; }
.tree-dir > summary:hover { background: #eef0f6; }
.tree-dir-ic::before { content: '▸'; font-size: .65rem; color: #a0a0b0; display: inline-block; transition: transform .12s; width: .75rem; }
.tree-dir[open] > summary .tree-dir-ic::before { transform: rotate(90deg); }
.tree-dir-name { font-family: 'SF Mono','Fira Mono',monospace; font-size: .79rem; }
.tree-file { display: flex; align-items: center; gap: .35rem; padding: .21rem .3rem; border-radius: 5px; cursor: pointer; min-width: 0; }
.tree-file:hover { background: #eef0f6; }
.tree-file-ic::before { content: '·'; color: #c0c0d0; font-size: .8rem; display: inline-block; width: .75rem; text-align: center; flex: none; }
.tree-file .f-name { flex: 1; font-family: 'SF Mono','Fira Mono',monospace; font-size: .78rem; color: #111; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tree-file .f-size { color: #c0c0d0; font-size: .68rem; font-variant-numeric: tabular-nums; flex: none; white-space: nowrap; }
.f-badge { font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 20px; flex: none; }
.f-badge.add { background: rgba(52,199,89,.15); color: #22a84a; }
.f-badge.chg { background: rgba(251,191,36,.15); color: #b07c00; }
.ce-selected { background: rgba(91,94,244,.10) !important; }
.ce-selected .f-name { color: var(--accent); }
.ce-content { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
/* File viewer header: moved to .ce-header-wrap block below */
.ce-side-badge { font-size: .65rem; font-weight: 700; font-family: var(--font); padding: 3px 9px; border-radius: 20px; flex: none; background: #d8dae8; color: #7878a0; border: none; }
.ce-side-badge.after  { background: rgba(52,199,89,.18); color: #1a9040; }
.ce-side-badge.before { background: rgba(91,94,244,.15); color: var(--accent); }
.ce-file-path { flex: 1; font-family: 'SF Mono','Fira Mono',monospace; font-size: .72rem; color: #666; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ce-empty { display: flex; align-items: center; justify-content: center; flex: 1; color: #c0c0d0; font-size: .82rem; font-family: var(--font); }
.ce-content-area { flex: 1; overflow: auto; background: #fff; }
.ce-pre { margin: 0; padding: .75rem 1rem; font-family: 'SF Mono','Fira Mono',monospace; font-size: .73rem; line-height: 1.6; color: #222; white-space: pre; tab-size: 4; min-height: 100%; }

@media (max-width: 480px) {
  /* Two independent resizable cards stacked vertically */
  .code-explorer {
    display: flex; flex-direction: column; gap: 14px;
    height: auto; max-height: none; min-height: 0;
    overflow: visible; box-shadow: none; border-radius: 0; border: none; background: transparent;
  }
  .ce-card {
    display: flex; flex-direction: column;
    border-radius: 14px; overflow: hidden;
    border: 1.5px solid rgba(0,0,0,.13);
    box-shadow: 0 4px 18px rgba(0,0,0,.11), 0 1px 3px rgba(0,0,0,.07); background: #fff;
  }
  .ce-sidebar { height: 200px; flex: none; border-right: none; border-bottom: 2px solid rgba(0,0,0,.10); }
  .ce-content  { height: 180px; flex: none; }
  .ce-split-handle { display: none; }
  .ce-outer-handle { display: none; }
  .ce-panel-handle { display: flex; }
}

.ce-wrap-btn { flex: none; font-size: 11px; font-family: var(--font); font-weight: 600; padding: 3px 10px; border-radius: 20px; border: 1.5px solid rgba(91,94,244,.25); background: rgba(91,94,244,.08); color: var(--accent); cursor: pointer; transition: background .15s; }
.ce-wrap-btn.off { background: #f0f0f5; color: #a0a0b0; border-color: transparent; }
.ce-content-area.wrap .ce-pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Diff side badge */
.ce-side-badge.diff { background: rgba(251,191,36,.22); color: #8a5e00; border: none; }
.ce-side-badge.rem  { background: rgba(248,113,113,.22); color: #c0392b; border: none; }

/* ── File viewer header — two-row wrapper ── */
.ce-header-wrap { flex: none; border-bottom: 2px solid rgba(0,0,0,.10); }
/* first row unchanged */
.ce-content-header { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; background: #eef0f6; flex: none; min-width: 0; }
/* second row: hash comparison */
.ce-hash-row {
  display: flex; align-items: center; gap: 4px;
  padding: .22rem .75rem .3rem;
  background: #f6f7fc;
  font-family: 'SF Mono','Fira Mono',monospace; font-size: .7rem;
  border-top: 1px solid rgba(0,0,0,.07);
}
.ce-hash-label { color: #b0b0c0; font-size: .68rem; }
.ce-hash        { background: rgba(0,0,0,.07); border-radius: 4px; padding: 1px 5px; color: #555; }
.ce-hash.before { color: #c0392b; background: rgba(248,113,113,.12); }
.ce-hash.after  { color: #1a9040; background: rgba(52,199,89,.12); }
.ce-hash-arrow  { color: #c0c0c0; font-size: .75rem; }
.ce-hash-size   { color: #a0a0b0; margin-left: 6px; }

/* Diff line view */
.ce-diff { padding: 0 !important; }
.diff-line { display: block; padding: .1rem 1rem; white-space: pre; font-family: 'SF Mono','Fira Mono',monospace; font-size: .73rem; line-height: 1.6; }
.diff-line.diff-add { background: rgba(52,199,89,.10); color: #1a7a35; }
.diff-line.diff-del { background: rgba(248,113,113,.10); color: #c0392b; }
.diff-line.diff-eq  { color: #b0b0c0; }

/* Image viewer */
.ce-image-wrap { padding: .75rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; background: var(--img-bg, #f5f5f7); border-radius: 8px; margin: .5rem; }
.ce-image-view { max-width: 100%; max-height: 420px; object-fit: contain; border-radius: 4px; display: block; box-shadow: 0 2px 8px rgba(0,0,0,.10); }
.ce-img-size { font-family: 'SF Mono','Fira Mono',monospace; font-size: .68rem; color: #a0a0b0; }
.ce-img-label { font-size: .7rem; font-weight: 700; text-align: center; padding: 2px 8px; border-radius: 4px; }
.ce-img-label.add { color: #1a9040; background: rgba(52,199,89,.12); }
.ce-img-label.rem { color: #c0392b; background: rgba(248,113,113,.12); }
.ce-img-diff-wrap { display: flex; gap: 10px; padding: .5rem; overflow-x: auto; }
.ce-img-diff-side { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .35rem; }

/* Stats row */
.ds-item.rem     { color: #c0392b; }
.ds-item.neutral { color: #888; }

/* Diff file list (Разница tab) — sectioned */
.diff-tree-list { padding: .3rem .2rem; }

/* Section headers (details/summary) */
.diff-section-hdr {
  display: flex; align-items: center; gap: .4rem;
  padding: .32rem .5rem; border-radius: 6px;
  font-family: var(--font); font-size: .78rem; font-weight: 600; color: #555;
  cursor: pointer; user-select: none; list-style: none;
}
.diff-section-hdr::-webkit-details-marker { display: none; }
.diff-section-hdr:hover { background: rgba(0,0,0,.04); }
.diff-section-ct { font-weight: 400; color: #a0a0b0; font-size: .73rem; margin-left: 2px; }

.diff-tree-row {
  display: flex; align-items: flex-start; gap: .45rem;
  padding: .3rem .5rem .3rem 1.4rem; border-radius: 6px; cursor: pointer;
}
.diff-tree-row:hover { background: rgba(0,0,0,.04); }
.diff-tree-row.rem   { background: rgba(248,113,113,.04); }
.diff-tree-row.rem:hover { background: rgba(248,113,113,.09); }
.diff-tree-row.ce-selected .diff-tree-name { color: var(--accent); }
.diff-tree-badge { font-size: .65rem; font-weight: 700; font-family: var(--font); padding: 1px 5px; border-radius: 4px; flex: none; margin-top: 2px; }
.diff-tree-badge.chg { background: rgba(251,191,36,.18); color: #b07c00; }
.diff-tree-badge.add { background: rgba(52,199,89,.18); color: #22a84a; }
.diff-tree-badge.rem { background: rgba(248,113,113,.18); color: #c0392b; }
.diff-tree-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.diff-tree-name { font-family: 'SF Mono','Fira Mono',monospace; font-size: .72rem; color: #444; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff-tree-hashes { display: flex; align-items: center; gap: 2px; }
.diff-hash { font-family: 'SF Mono','Fira Mono',monospace; font-size: .65rem; padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,.07); color: #888; }
.diff-hash.after  { color: #1a9040; background: rgba(52,199,89,.12); }
.diff-hash-arrow  { color: #c0c0c0; font-size: .7rem; }
.diff-tree-size { font-family: 'SF Mono','Fira Mono',monospace; font-size: .65rem; color: #b0b0c0; white-space: nowrap; flex: none; padding-top: 2px; }

/* Removed files badge in before-tree */
.f-badge.rem { background: rgba(248,113,113,.15); color: #c0392b; }

/* ── Mobile panel handle (one per card) ── */
.ce-panel-handle {
  height: 32px; cursor: ns-resize;
  align-items: center; justify-content: center;
  background: #d8d8e8; border-top: 2px solid #b8b8d0;
  user-select: none; touch-action: none; flex: none;
  transition: background .15s, border-color .15s;
}
@media (min-width: 481px) { .ce-panel-handle { display: none; } } /* hidden on desktop */
.ce-panel-handle:hover, .ce-panel-handle:active {
  background: rgba(91,94,244,.18); border-top-color: var(--accent);
}
.ce-panel-handle .ce-outer-handle-dots {
  width: 36px; height: 4px; border-radius: 2px;
  background: #8888aa; box-shadow: 0 -7px 0 #8888aa, 0 7px 0 #8888aa;
}
.ce-panel-handle:hover .ce-outer-handle-dots,
.ce-panel-handle:active .ce-outer-handle-dots {
  background: var(--accent); box-shadow: 0 -7px 0 var(--accent), 0 7px 0 var(--accent);
}

/* ── File explorer resize handles ── */
.ce-explorer-wrap { display: flex; flex-direction: column; }
.ce-split-handle {
  position: absolute; right: -4px; top: 0; bottom: 0; width: 8px;
  cursor: col-resize; z-index: 10; background: transparent; touch-action: none;
}
.ce-split-handle:hover, .ce-split-handle:active { background: rgba(91,94,244,.2); }
.ce-outer-handle {
  height: 32px; cursor: ns-resize;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
@media (max-width: 480px) { .ce-outer-handle { display: none; } } /* cascade fix: after base rule */
.ce-outer-handle {
  border-radius: 0 0 16px 16px;
  background: #d8d8e8; border-top: 2px solid #b8b8d0;
  user-select: none; touch-action: none; flex: none;
  transition: background .15s, border-color .15s;
}
.ce-outer-handle:hover, .ce-outer-handle:active {
  background: rgba(91,94,244,.18); border-top-color: var(--accent);
}
.ce-outer-handle-dots {
  width: 36px; height: 4px; border-radius: 2px;
  background: #8888aa;
  box-shadow: 0 -7px 0 #8888aa, 0 7px 0 #8888aa;
}
.ce-outer-handle:hover .ce-outer-handle-dots,
.ce-outer-handle:active .ce-outer-handle-dots {
  background: var(--accent);
  box-shadow: 0 -7px 0 var(--accent), 0 7px 0 var(--accent);
}
@media (max-width: 480px) {
  .ce-split-handle { right: auto; left: 0; bottom: -4px; top: auto; width: auto; height: 8px; cursor: row-resize; }
}

/* ── Certificate tab — sign mode ── */
.sign-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }

/* Whole wrap = the border container */
.sign-card-wrap {
  display: flex; flex-direction: column;
  border: 1.5px solid rgba(0,0,0,.08);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.sign-card-wrap:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,94,244,.10);
}

.sign-card-fields {
  background: rgba(91,94,244,.03);
  border-top: 1px solid rgba(91,94,244,.15);
  padding: 16px 14px 14px;
}

.sign-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border: none;
  padding: 14px 16px;
  cursor: pointer;
}
.sign-card input[type=radio] { display: none; }
.sign-card-body { flex: 1; min-width: 0; }
.sign-card-icon { font-size: 1.3rem; margin-bottom: 2px; }
.sign-card-title { font-size: .9rem; font-weight: 700; color: #111; font-family: var(--font); }
.sign-card-desc  { font-size: .78rem; color: #a0a0b0; font-family: var(--font); margin-top: 2px; }
.sign-card-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #ddd; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: transparent; transition: background .15s, border-color .15s;
}
.sign-card-wrap:has(input:checked) .sign-card-check {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
select.ks-field-input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a0a0b0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

/* Keystore upload zone */
.ks-upload-zone {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed rgba(91,94,244,.3); border-radius: 12px;
  background: rgba(91,94,244,.03); padding: 18px 16px;
  cursor: pointer; margin-top: 14px;
  transition: background .15s, border-color .15s;
}
.ks-upload-zone:hover { background: rgba(91,94,244,.07); border-color: var(--accent); }
.ks-upload-body { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ks-upload-hint { font-size: .72rem; color: #b0b0c0; font-family: var(--font); }
.ks-upload-body span:not(.ks-upload-hint) { font-size: .85rem; color: var(--accent); font-weight: 600; font-family: var(--font); }

.ks-fields-row {
  display: flex; gap: 10px; margin-top: 12px;
}
.ks-field { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.ks-field-label { font-size: .75rem; font-weight: 600; color: #555; font-family: var(--font); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ks-optional { font-size: .67rem; font-weight: 400; color: #b0b0c0; }
.ks-field-input {
  height: 40px; border-radius: 10px; border: 1.5px solid rgba(0,0,0,.1);
  padding: 0 12px; font-size: .88rem; font-family: var(--font);
  background: #fff; outline: none; width: 100%; box-sizing: border-box;
  transition: border-color .15s;
}
.ks-field-input:focus { border-color: var(--accent); }

.cert-watermark {
  position: absolute; bottom: 18px; right: 20px;
  font-size: .65rem; font-weight: 800; letter-spacing: .18em;
  color: rgba(91,94,244,.08); font-family: var(--font);
  text-transform: uppercase; pointer-events: none; user-select: none;
}

/* .cert-actions removed (old cert card deleted) */

/* ── Download tab ── */
.dl-card {
  background: #fff; border-radius: 20px;
  box-shadow: 0 4px 24px rgba(91,94,244,.10), 0 1px 4px rgba(0,0,0,.06);
  border: 1.5px solid rgba(91,94,244,.12);
  padding: 32px 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.dl-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(91,94,244,.07);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.dl-title { font-size: 1.05rem; font-weight: 700; color: #111; font-family: var(--font); }
.dl-sub   { font-size: .82rem; color: #a0a0b0; font-family: 'SF Mono','Fira Mono',monospace; }
.dl-meta-row {
  display: flex; align-items: center; gap: 0;
  background: rgba(91,94,244,.04); border-radius: 14px;
  padding: 14px 20px; margin-top: 8px; width: 100%; box-sizing: border-box;
}
.dl-meta-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dl-meta-val  { font-size: 1.35rem; font-weight: 800; color: #5b5ef4; font-family: var(--font); }
.dl-meta-lbl  { font-size: .68rem; color: #a0a0b0; font-family: var(--font); }
.dl-meta-sep  { width: 1px; height: 34px; background: rgba(0,0,0,.07); }

.dl-btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  gap: 8px; width: 100%; box-sizing: border-box; margin-top: 16px;
  text-decoration: none;
}
.dl-new-btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  width: 100%; box-sizing: border-box; margin-top: 8px;
}

/* "Перегенерировать всё" button */
.cert-regen-all-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; box-sizing: border-box;
  padding: 9px 14px; margin-top: 12px;
  border: 1.5px solid rgba(91,94,244,.25); border-radius: 10px;
  background: rgba(91,94,244,.05); color: var(--accent);
  font-size: .8rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.cert-regen-all-btn:active { background: rgba(91,94,244,.12); }

/* regen button inside password field */
.ks-regen-btn {
  position: absolute; right: 10px; bottom: 9px;
  background: none; border: none; padding: 2px; cursor: pointer;
  color: #a0a0b0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: color .15s, background .15s;
}
.ks-regen-btn:hover { color: var(--accent); background: rgba(91,94,244,.08); }

/* ── Signing progress & result ── */
.sign-progress-card {
  background: #fff; border-radius: 16px;
  border: 1.5px solid rgba(0,0,0,.07);
  padding: 18px 16px; display: flex; flex-direction: column; gap: 0;
}
.sign-progress-steps { display: flex; flex-direction: column; gap: 0; }
.sign-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; position: relative;
}
.sign-step + .sign-step::before {
  content: ''; position: absolute; left: 11px; top: -6px;
  width: 2px; height: 12px; background: #eee; border-radius: 1px;
}
.sign-step.done + .sign-step::before  { background: rgba(34,197,94,.3); }
.sign-step.active + .sign-step::before { background: rgba(91,94,244,.2); }

.sign-step-ic {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #f0f0f6; transition: background .2s;
}
.sign-step.active .sign-step-ic { background: rgba(91,94,244,.12); }
.sign-step.done   .sign-step-ic { background: rgba(34,197,94,.15); }

.sign-step-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(91,94,244,.2); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.sign-step-check {
  font-size: .75rem; font-weight: 800; color: #22c55e; line-height: 1;
}
.sign-step-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #d0d0e0;
}
.sign-step-label {
  font-size: .87rem; font-family: var(--font); color: #333;
  transition: color .2s;
}
.sign-step.active .sign-step-label { color: var(--accent); font-weight: 600; }
.sign-step.done   .sign-step-label { color: #22c55e; }
.sign-step.pending .sign-step-label { color: #b0b0c0; }

.sign-result-card {
  background: rgba(34,197,94,.07); border: 1.5px solid rgba(34,197,94,.2);
  border-radius: 16px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
}
.sign-result-icon {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg,#22c55e,#16a34a);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(34,197,94,.35);
  animation: pop .35s cubic-bezier(.34,1.56,.64,1);
}
.sign-result-title { font-size: .95rem; font-weight: 700; color: #111; font-family: var(--font); }
.sign-result-sub   { font-size: .78rem; color: #6b7280; font-family: var(--font); margin-top: 2px; }

/* ── Login overlay ── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(16,16,30,.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (prefers-color-scheme: dark) {
  .login-card { background: #1a1a2e; }
}
.login-brand {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg,var(--accent),var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.5px;
  font-family: var(--font);
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-size: .78rem;
  font-weight: 600;
  color: #6b7280;
  font-family: var(--font);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.login-field input {
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s;
  background: #f9fafb;
}
.login-field input:focus { border-color: var(--accent); background: #fff; }
.login-tabs {
  display: flex;
  gap: 0;
  border-radius: 10px;
  background: #f3f4f6;
  padding: 3px;
}
@media (prefers-color-scheme: dark) {
  .login-tabs { background: #111827; }
}
.login-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: #6b7280;
  font-family: var(--font);
  transition: background .15s, color .15s, box-shadow .15s;
}
.login-tab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
@media (prefers-color-scheme: dark) {
  .login-tab.active { background: #1e293b; }
}
#auth-login-form,
#auth-signup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-err {
  font-size: .82rem;
  color: #ef4444;
  text-align: center;
  min-height: 1.2em;
  font-family: var(--font);
}
#nav-logout { color: #ef4444; }

/* ── Changes subpage ── */
.chg-root { display: flex; flex-direction: column; gap: 12px; }
.chg-loading { text-align: center; padding: 3rem 1rem; color: #888; font-family: var(--font); font-size: .9rem; }

.chg-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.chg-stat { background: #fff; border-radius: 12px; padding: 10px 14px; flex: 1; min-width: 80px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid rgba(0,0,0,.06); }
.chg-stat-n { font-size: 1.4rem; font-weight: 700; font-family: var(--font); line-height: 1.1; }
.chg-stat-l { font-size: .67rem; color: #888; margin-top: 2px; font-family: var(--font); }
.chg-stat.add .chg-stat-n { color: #1a9040; }
.chg-stat.rem .chg-stat-n { color: #c0392b; }
.chg-stat.chg .chg-stat-n { color: #d97706; }

.chg-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 5px rgba(0,0,0,.07); border: 1px solid rgba(0,0,0,.06); }
.chg-card-hdr { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; border-bottom: 1px solid rgba(0,0,0,.06); }
.chg-card-ico { font-size: 1.1rem; }
.chg-card-title { font-family: var(--font); font-size: .88rem; font-weight: 700; color: #111; flex: 1; }
.chg-card-count { background: rgba(0,0,0,.07); color: #555; font-size: .72rem; font-weight: 600; border-radius: 10px; padding: 2px 8px; font-family: var(--font); }

.chg-subsect { font-family: var(--font); font-size: .72rem; font-weight: 600; color: #a0a0b0; text-transform: uppercase; letter-spacing: .04em; padding: 8px 14px 2px; }

.chg-row { display: flex; align-items: baseline; gap: 7px; padding: 5px 14px; font-family: 'SF Mono','Fira Mono',monospace; font-size: .72rem; }
.chg-row:hover { background: rgba(0,0,0,.025); }
.chg-badge { font-size: .7rem; font-weight: 700; min-width: 16px; text-align: center; border-radius: 4px; padding: 1px 4px; flex: none; }
.chg-badge.add { color: #1a9040; background: rgba(52,199,89,.12); }
.chg-badge.rem { color: #c0392b; background: rgba(248,113,113,.12); }
.chg-badge.chg { color: #d97706; background: rgba(217,119,6,.10); }
.chg-path { color: #333; flex: 1; min-width: 0; word-break: break-all; }
.chg-size { color: #aaa; flex: none; font-size: .67rem; }
.chg-hint { color: #aaa; flex: none; font-size: .67rem; }
.chg-hint.junk-val { color: #888; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chg-more { font-family: var(--font); font-size: .7rem; color: #b0b0c0; padding: 4px 14px 8px; }

.chg-delta { font-size: .67rem; flex: none; font-weight: 600; }
.chg-delta.pos { color: #d97706; }
.chg-delta.neg { color: #1a9040; }

.chg-info-row { font-family: var(--font); font-size: .77rem; color: #444; padding: 10px 14px 6px; line-height: 1.5; }
.chg-info-row code { font-family: 'SF Mono','Fira Mono',monospace; font-size: .72rem; background: rgba(0,0,0,.07); border-radius: 4px; padding: 1px 5px; color: #555; }

/* Rename table */
.chg-rename-hdr { display: flex; align-items: center; gap: 8px; padding: 4px 14px 2px; font-family: var(--font); font-size: .67rem; font-weight: 700; color: #aaa; text-transform: uppercase; }
.chg-rename-hdr span:first-child, .chg-rename-hdr span:last-child { flex: 1; }
.chg-rename-hdr span:nth-child(2) { flex: none; }
.chg-rename-row { display: flex; align-items: baseline; gap: 6px; padding: 4px 14px; font-family: 'SF Mono','Fira Mono',monospace; font-size: .69rem; }
.chg-rename-row:hover { background: rgba(0,0,0,.025); }
.chg-rename-row.missing { opacity: .5; }
.chg-rename-from { flex: 1; color: #c0392b; word-break: break-all; }
.chg-rename-arrow { color: #c0c0c0; flex: none; font-size: .75rem; }
.chg-rename-to   { flex: 1; color: #1a9040; word-break: break-all; }
.chg-rename-to.dim-placeholder { color: #b0b0c0; font-style: italic; }
.chg-member-cls { font-family: 'SF Mono','Fira Mono',monospace; font-size: .63rem; color: #b0b0c0; padding: 6px 14px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid rgba(0,0,0,.04); margin-top: 3px; }

/* Manifest lines */
.chg-manifest-line { font-family: 'SF Mono','Fira Mono',monospace; font-size: .68rem; padding: 2px 14px; word-break: break-all; line-height: 1.5; }
.chg-manifest-line.add { color: #1a9040; background: rgba(52,199,89,.06); }
.chg-manifest-line.rem { color: #c0392b; background: rgba(248,113,113,.06); }

/* Guard config */
.chg-guard-cfg { padding: 6px 14px 10px; }
.chg-kv-table { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.chg-kv-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.chg-kv-key { font-family: 'SF Mono','Fira Mono',monospace; font-size: .67rem; color: #888; min-width: 100px; flex: none; }
.chg-kv-val { font-family: 'SF Mono','Fira Mono',monospace; font-size: .67rem; color: #333; word-break: break-all; }

/* Hash table */
.chg-hash-row { display: flex; align-items: baseline; gap: 6px; padding: 4px 14px; font-family: 'SF Mono','Fira Mono',monospace; font-size: .67rem; }
.chg-hash-row:hover { background: rgba(0,0,0,.025); }
.chg-hash-row .flex1 { flex: 1; min-width: 0; word-break: break-all; }
.chg-hash.before { color: #c0392b; background: rgba(248,113,113,.10); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.chg-hash.after  { color: #1a9040; background: rgba(52,199,89,.10);   border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.chg-hash-arrow  { color: #c0c0c0; flex: none; }

/* Before / After comparison rows */
.chg-ba-table { display: flex; flex-direction: column; padding: 4px 0 8px; }
.chg-ba-row { display: flex; align-items: center; gap: 0; padding: 5px 14px; font-family: var(--font); font-size: .77rem; }
.chg-ba-row:hover { background: rgba(0,0,0,.025); }
.chg-ba-before { flex: 1; color: #c0392b; }
.chg-ba-before.dim { color: #aaa; }
.chg-ba-arrow { flex: none; color: #c0c0c0; padding: 0 10px; font-size: .85rem; }
.chg-ba-after  { flex: 1; color: #1a9040; font-weight: 500; }

/* Response policy table */
.chg-policy-wrap { padding: 6px 14px 10px; display: flex; flex-direction: column; gap: 3px; }
.chg-policy-row { display: flex; align-items: center; gap: 10px; }
.chg-policy-level { font-family: 'SF Mono','Fira Mono',monospace; font-size: .67rem; color: #888; width: 72px; flex: none; text-transform: uppercase; letter-spacing: .03em; }
.chg-policy-action { font-size: .73rem; font-weight: 700; padding: 2px 9px; border-radius: 6px; font-family: var(--font); }
.chg-policy-action.ALLOW    { color: #1a9040; background: rgba(52,199,89,.12); }
.chg-policy-action.MONITOR  { color: #2563eb; background: rgba(37,99,235,.10); }
.chg-policy-action.DEGRADE  { color: #d97706; background: rgba(217,119,6,.10); }
.chg-policy-action.TERMINATE{ color: #c0392b; background: rgba(192,57,43,.10); }
.chg-policy-desc { font-family: var(--font); font-size: .7rem; color: #aaa; }

/* ══════════════════════════════════════════
   COMPARE FEATURE
   ══════════════════════════════════════════ */

/* ── Compare checkbox on app card ── */
.app-card-icon-wrap {
  position: relative;
  flex: none;
  width: 48px; height: 48px;
}
.app-card-icon-wrap .app-card-icon {
  width: 100%; height: 100%;
}
.app-card-cmp-chk {
  position: absolute;
  top: -6px; right: -6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.92);
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  color: #b0b0c0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  opacity: .55;
  transition: opacity .12s, background .12s, color .12s, box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}
.app-card-cmp-chk:hover { opacity: 1; }
.app-card-cmp-chk.active {
  background: var(--accent);
  color: #fff;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(91,94,244,.35);
}
.app-card-cmp-chk .chk-path { opacity: 0; transition: opacity .12s; }
.app-card-cmp-chk.active .chk-path { opacity: 1; }

/* ── Selected card state ── */
.app-card.cmp-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91,94,244,.25), 0 2px 12px rgba(0,0,0,.055);
}

/* ── Compare bar (floating bottom) ── */
#compare-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + 10px);
  left: 50%; transform: translateX(-50%);
  z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  background: #1c1c2e;
  color: #fff;
  padding: 10px 14px 10px 18px;
  border-radius: 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,.28);
  font-family: var(--font); font-size: 13px;
  white-space: nowrap;
  animation: slide-up .18s ease-out;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#compare-bar-label { flex: 1; font-weight: 500; }
#compare-bar-btn {
  background: var(--accent);
  color: #fff; border: none;
  padding: 7px 16px; border-radius: 20px;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity .12s;
}
#compare-bar-btn:disabled { opacity: .4; cursor: default; }
#compare-bar-btn:not(:disabled):active { opacity: .8; }
.compare-bar-clear {
  background: rgba(255,255,255,.12); color: #fff; border: none;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.compare-bar-clear:active { background: rgba(255,255,255,.22); }

/* ── Compare page ── */
#page-compare { padding-top: var(--banner-h); }
#compare-content {
  padding: 12px 16px calc(var(--nav-h) + 20px);
  display: flex; flex-direction: column; gap: 10px;
}

/* Two-app header */
.cmp-apps-header {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1.5px solid rgba(0,0,0,.07);
  border-radius: 18px;
  padding: 14px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.cmp-app-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0;
}
.cmp-app-icon {
  width: 44px; height: 44px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex: none; overflow: hidden;
}
.cmp-app-name {
  font-family: var(--font); font-size: 13px; font-weight: 700; color: #111;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  width: 100%; max-width: 120px;
}
.cmp-app-pkg {
  font-family: 'SF Mono','Fira Mono',monospace; font-size: 9px; color: #aaa;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%;
}
.cmp-vs {
  flex: none; font-size: 11px; font-weight: 800; color: #c0c0cc;
  letter-spacing: .06em; padding: 0 4px;
}

/* Summary banner */
.cmp-summary {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 9px 14px; border-radius: 12px;
  background: rgba(0,0,0,.03);
  font-family: var(--font); font-size: 13px;
}
.cmp-sum-same { color: #1a9040; font-weight: 600; }
.cmp-sum-diff { color: #e07b00; font-weight: 600; }

/* Section label */
.cmp-section-label {
  font-family: var(--font); font-size: 11px; font-weight: 700;
  color: #a0a0b8; letter-spacing: .07em; text-transform: uppercase;
  padding: 4px 4px 2px;
}

/* Row group */
.cmp-group {
  background: #fff;
  border: 1.5px solid rgba(0,0,0,.07);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

/* Compare row */
.cmp-row {
  display: grid;
  grid-template-columns: 22px 1fr 1fr 18px 1fr;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.05);
  font-family: var(--font); font-size: 12.5px;
}
.cmp-row:last-child { border-bottom: none; }
.cmp-row-icon { font-size: 14px; text-align: center; }
.cmp-row-label { color: #555; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-row-val {
  font-weight: 500; color: #222;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: center;
}
.cmp-row-eq {
  font-size: 11px; font-weight: 700; text-align: center;
  color: #c0c0c0;
}
/* Different rows — highlight values */
.cmp-row.cmp-diff { background: rgba(224,123,0,.04); }
.cmp-row.cmp-diff .cmp-row-eq { color: #e07b00; }
.cmp-row.cmp-diff .cmp-row-val { color: #111; }

/* ── Compare page: tabs ── */
.cmp-tabs {
  display: flex;
  gap: 0;
  background: rgba(0,0,0,.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
}
.cmp-tab {
  flex: 1;
  padding: 8px 14px;
  border: none;
  background: none;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cmp-tab.active {
  background: #fff;
  color: #222;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
/* .cmp-pane visibility is managed via the hidden attribute */

/* ── File diff pane ── */
.cmp-files-pane {
  font-family: var(--font);
}

/* Stats bar */
.cfd-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cfd-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.cfd-stat.chg { background: rgba(224,123,0,.12); color: #c07000; }
.cfd-stat.add { background: rgba(0,160,70,.10); color: #0a7a35; }
.cfd-stat.rem { background: rgba(200,30,30,.09); color: #b01a1a; }
.cfd-stat.same { background: rgba(0,0,0,.05); color: #888; }

/* File list */
.cfd-file-wrap {
  background: #fff;
  border: 1.5px solid rgba(0,0,0,.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  margin-bottom: 8px;
}
.cfd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.05);
  transition: background .1s;
}
.cfd-row:last-child { border-bottom: none; }
.cfd-row:hover { background: rgba(91,94,244,.04); }
.cfd-row.cfd-open { background: rgba(91,94,244,.06); }
.cfd-badge {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cfd-badge.chg { background: rgba(224,123,0,.15); color: #b06a00; }
.cfd-badge.add { background: rgba(0,160,70,.13); color: #0a6e2e; }
.cfd-badge.rem { background: rgba(200,30,30,.12); color: #a01010; }
.cfd-badge.same { background: rgba(0,0,0,.06); color: #999; }
.cfd-name {
  flex: 1;
  font-size: 12.5px;
  color: #222;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cfd-dir {
  font-size: 11px;
  color: #aaa;
  flex: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}
.cfd-arr {
  flex: none;
  font-size: 12px;
  color: #bbb;
  transition: transform .15s;
}
.cfd-row.cfd-open .cfd-arr { transform: rotate(90deg); }
.cfd-text {
  font-family: 'SF Mono','Fira Mono','Cascadia Code',monospace;
  font-size: 11px;
  color: #999;
}

/* Diff area inside file row */
.cfd-diff-area {
  padding: 0 8px 10px;
  border-top: 1px solid rgba(0,0,0,.06);
}
.cfd-diff-loading {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: #aaa;
}
.cfd-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #b0b0c0;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 8px 4px 4px;
}
.cfd-same-details summary {
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  padding: 6px 4px;
}
.cfd-same-sum {
  padding: 4px;
  font-size: 12px;
  color: #888;
}

/* ── GitHub-style diff lines ── */
.gh-diff {
  border: 1.5px solid rgba(0,0,0,.08);
  border-radius: 10px;
  overflow: hidden;
  font-family: 'SF Mono','Fira Mono','Cascadia Code',monospace;
  font-size: 11px;
  background: #fafafa;
}
.gh-line {
  display: grid;
  grid-template-columns: 34px 34px 16px 1fr;
  min-height: 18px;
  line-height: 18px;
  white-space: pre;
}
.gh-line.gh-add { background: rgba(0,160,70,.10); }
.gh-line.gh-del { background: rgba(200,30,30,.08); }
.gh-line.gh-eq  { background: transparent; }
.gh-ln {
  text-align: right;
  padding: 0 5px;
  color: #bbb;
  font-size: 10px;
  border-right: 1px solid rgba(0,0,0,.07);
  user-select: none;
  background: rgba(0,0,0,.025);
}
.gh-line.gh-add .gh-ln { background: rgba(0,160,70,.08); }
.gh-line.gh-del .gh-ln { background: rgba(200,30,30,.07); }
.gh-sign {
  text-align: center;
  padding: 0 2px;
  font-weight: 700;
  user-select: none;
}
.gh-line.gh-add .gh-sign { color: #1a9040; }
.gh-line.gh-del .gh-sign { color: #c01818; }
.gh-line.gh-eq  .gh-sign { color: transparent; }
.gh-code {
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #222;
}
.gh-line.gh-add .gh-code { color: #0b5c2a; }
.gh-line.gh-del .gh-code { color: #8b0000; }
.gh-no-diff {
  padding: 8px 12px;
  font-size: 12px;
  color: #aaa;
  text-align: center;
}
.gh-expand-btn {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(91,94,244,.05);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  color: var(--accent);
  transition: background .1s;
}
.gh-expand-btn:hover { background: rgba(91,94,244,.1); }
.gh-gap {
  grid-column: 1 / -1;
  background: rgba(0,0,0,.03);
  border-top: 1px solid rgba(0,0,0,.06);
  border-bottom: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── API page layout ── */
#page-api {
  position: fixed;
  top: var(--banner-h); left: 0; right: 0; bottom: var(--nav-h);
  overflow-y: auto;
  background: #f4f5f9;
}
.api-scroll { padding-top: 16px; }
#page-api .api-section:last-child {
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
}

/* ── API docs page ── */
.api-section {
  padding: 0 16px;
  margin-bottom: 16px;
}
.api-section-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
  letter-spacing: .01em;
}
.api-prose {
  font-family: var(--font);
  font-size: 12.5px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ── API Keys management ── */
.api-keys-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.api-keys-title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #0d0d14;
  letter-spacing: -.01em;
}
.api-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  box-shadow: 0 2px 8px rgba(91,94,244,.28);
}
.api-create-btn:hover { opacity: .85; }
.api-create-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.api-create-form.hidden { display: none; }
.api-label-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid rgba(0,0,0,.12);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  color: #222;
  background: #fafafa;
  outline: none;
  transition: border-color .15s, background .15s;
}
.api-label-input:focus { border-color: var(--accent); background: #fff; }
.api-create-submit {
  padding: 8px 15px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.api-create-submit:hover { opacity: .85; }
.api-create-submit.loading { opacity: .6; cursor: default; }
.api-create-cancel {
  padding: 8px 12px;
  background: rgba(0,0,0,.06);
  color: #666;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.api-create-cancel:hover { background: rgba(0,0,0,.1); }
.api-new-key-reveal { margin-bottom: 12px; }
.api-new-key-reveal.hidden { display: none; }
.api-new-key-notice {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: #92600a;
  background: rgba(234,179,8,.1);
  border: 1px solid rgba(234,179,8,.22);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.api-new-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,.04);
  border-radius: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(0,0,0,.07);
}
.api-new-key-value {
  flex: 1;
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11.5px;
  color: #333;
  word-break: break-all;
}
.api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}
.api-keys-empty {
  font-family: var(--font);
  font-size: 13px;
  color: #bbb;
  text-align: center;
  padding: 14px 0;
}
.api-key-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fafafa;
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 12px;
  padding: 10px 12px;
}
.api-key-item-info { flex: 1; min-width: 0; }
.api-key-item-label {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: #1a1a28;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.api-key-item-prefix {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11px;
  color: var(--accent);
  margin-top: 2px;
  opacity: .8;
}
.api-key-item-date {
  font-family: var(--font);
  font-size: 11px;
  color: #bbb;
  margin-top: 1px;
}
.api-key-revoke-btn {
  padding: 5px 11px;
  background: rgba(220,38,38,.08);
  color: #dc2626;
  border: 1px solid rgba(220,38,38,.14);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  flex: none;
}
.api-key-revoke-btn:hover { background: rgba(220,38,38,.16); }
.api-key-copy {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(91,94,244,.18);
  background: rgba(91,94,244,.07);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex: none;
  transition: background .15s;
}
.api-key-copy:hover { background: rgba(91,94,244,.14); }
.api-key-copy.copied { background: rgba(5,150,105,.1); color: #059669; border-color: rgba(5,150,105,.25); }

/* Base URL row */
.api-base-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 0;
  border-top: 1px solid rgba(0,0,0,.07);
  margin-top: 12px;
}
.api-base-label {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: .06em;
  text-transform: uppercase;
  flex: none;
}
.api-base-url {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11.5px;
  color: #334;
  background: rgba(0,0,0,.05);
  padding: 4px 10px;
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Endpoint rows + method badges ── */
.api-endpoint-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
}
.api-method {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: .06em;
  flex: none;
}
.api-method.post { background: rgba(91,94,244,.12); color: #4c4fea; }
.api-method.get  { background: rgba(5,150,105,.12); color: #047857; }
.api-path {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 12.5px;
  color: #1a1a28;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Code blocks — always dark (GitHub style) ── */
.api-code-block {
  background: #0d1117;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}
.api-code-lang {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #7d8590;
  padding: 8px 14px 5px;
  background: #161b22;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: block;
}
.api-code-block pre {
  font-family: 'SF Mono','Fira Mono','Cascadia Code',monospace;
  font-size: 11.5px;
  color: #c9d1d9;
  line-height: 1.7;
  margin: 0;
  padding: 10px 14px 14px;
  white-space: pre;
  overflow-x: auto;
}
.api-inline {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11px;
  background: rgba(91,94,244,.1);
  padding: 1px 5px;
  border-radius: 4px;
  color: #4c4fea;
}

/* Response label — pill badge */
.api-response-label {
  display: inline-block;
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #059669;
  background: rgba(5,150,105,.1);
  border: 1px solid rgba(5,150,105,.2);
  border-radius: 20px;
  padding: 2px 10px;
  letter-spacing: .02em;
  margin: 8px 14px 6px;
}

/* ── Param table ── */
.api-param-table {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  font-family: var(--font);
}
.api-param-head {
  display: grid;
  grid-template-columns: 1fr .55fr 2fr;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(0,0,0,.04);
  font-size: 10px;
  font-weight: 700;
  color: #bbb;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.api-param-row {
  display: grid;
  grid-template-columns: 1fr .55fr 2fr;
  gap: 8px;
  padding: 9px 12px;
  font-size: 12px;
  border-top: 1px solid rgba(0,0,0,.05);
  align-items: baseline;
  color: #444;
}
.api-param-row:nth-child(even) { background: rgba(0,0,0,.018); }
.api-param-row code {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11px;
  color: #4c4fea;
  font-weight: 600;
}
.api-param-type {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 10.5px;
  color: #999;
}
.api-required {
  font-size: 9.5px;
  font-weight: 700;
  color: #dc2626;
  background: rgba(220,38,38,.09);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

/* ── Status badges ── */
.api-statuses {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border-top: 1px solid rgba(0,0,0,.06);
}
.api-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font);
  font-size: 12px;
  color: #555;
}
.api-status-badge {
  flex: none;
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  min-width: 68px;
  text-align: center;
  border: 1px solid transparent;
}
.api-status-badge.queued  { background: rgba(0,0,0,.07);    color: #999; border-color: rgba(0,0,0,.1); }
.api-status-badge.running { background: rgba(91,94,244,.12); color: var(--accent); border-color: rgba(91,94,244,.2); }
.api-status-badge.done    { background: rgba(5,150,105,.1);  color: #059669; border-color: rgba(5,150,105,.2); }
.api-status-badge.failed  { background: rgba(220,38,38,.1);  color: #dc2626; border-color: rgba(220,38,38,.18); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────
   API PAGE LAYOUT — SECTION LABELS, CARDS, FLOW
───────────────────────────────────────────── */

/* Section eyebrow with extending rule */
.api-group-label {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 22px 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.api-group-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0,0,0,.08);
}

/* ── Keys section card ── */
.api-keys-section {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.08);
  padding: 16px;
  margin: 0 16px;
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
}
.api-auth-note {
  font-family: var(--font);
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  padding: 10px 13px;
  background: rgba(91,94,244,.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  margin-top: 14px;
}
.api-auth-note code {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11px;
  background: rgba(91,94,244,.12);
  padding: 1px 5px;
  border-radius: 4px;
  color: #4c4fea;
}

/* ── 3-step workflow strip ── */
.api-flow {
  display: flex;
  align-items: center;
  margin: 0 16px 6px;
  padding: 14px 12px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
  overflow-x: auto;
  gap: 4px;
}
.api-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 88px;
  padding: 6px 8px;
  text-align: center;
}
.api-flow-method {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .07em;
  padding: 2px 8px;
  border-radius: 6px;
}
.api-flow-method.post { background: rgba(91,94,244,.12); color: #4c4fea; }
.api-flow-method.get  { background: rgba(5,150,105,.12); color: #047857; }
.api-flow-path {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 10.5px;
  color: #333;
  white-space: nowrap;
  font-weight: 600;
}
.api-flow-desc {
  font-family: var(--font);
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}
.api-flow-arrow {
  color: #cbd5e1;
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 2px;
  margin-top: -8px;
}

/* ── Endpoint blocks ── */
.api-endpoint-block {
  margin: 0 16px 10px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.055);
}
/* Top accent border by method */
.api-endpoint-block[data-method="post"] { border-top: 3px solid #5b5ef4; }
.api-endpoint-block[data-method="get"]  { border-top: 3px solid #059669; }
/* Header row tint */
.api-endpoint-block[data-method="post"] > .api-endpoint-row {
  background: rgba(91,94,244,.04);
  border-bottom: 1px solid rgba(91,94,244,.1);
}
.api-endpoint-block[data-method="get"] > .api-endpoint-row {
  background: rgba(5,150,105,.04);
  border-bottom: 1px solid rgba(5,150,105,.1);
}
.api-endpoint-summary {
  font-family: var(--font);
  font-size: 11.5px;
  color: #94a3b8;
  flex: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.api-endpoint-block .api-prose {
  padding: 10px 14px 6px;
  margin-bottom: 0;
}
.api-endpoint-block .api-code-block {
  border-radius: 0;
  margin: 0;
}
.api-endpoint-block .api-param-table {
  margin: 8px 14px 10px;
}

/* ── Options table group separators ── */
.api-param-group-row {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 10px 12px 5px;
  background: rgba(0,0,0,.025);
  border-top: 1px solid rgba(0,0,0,.06);
}
.api-param-group-row:first-child { border-top: none; }
.api-param-on {
  font-family: 'SF Mono','Fira Mono',monospace;
  font-size: 11px;
  color: #059669;
  font-weight: 700;
}

/* ── Numbered steps (Python CI/CD example) ── */
.api-steps {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.08);
  padding: 4px 16px;
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
  position: relative;
}
.api-steps::before {
  content: '';
  position: absolute;
  left: 31px;
  top: 42px;
  bottom: 42px;
  width: 2px;
  background: linear-gradient(to bottom, rgba(91,94,244,.25), rgba(91,94,244,.06));
  border-radius: 2px;
  pointer-events: none;
}
.api-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.api-step:last-child { border-bottom: none; }
.api-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b5ef4, #8b5cf6);
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(91,94,244,.35);
  position: relative;
  z-index: 1;
}
.api-step-body { flex: 1; min-width: 0; }
.api-step-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: #1a1a28;
  margin-bottom: 10px;
  letter-spacing: -.01em;
}
.api-step .api-code-block { border-radius: 12px; }

/* ─────────────────────────────────────────────
   DARK MODE (all API classes in one block)
───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #page-api { background: #0e0e14; }
  :root:not([data-theme="light"]) .api-group-label { color: #334155; }
  :root:not([data-theme="light"]) .api-group-label::after { background: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .api-keys-section { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
  :root:not([data-theme="light"]) .api-keys-title { color: #e2e8f0; }
  :root:not([data-theme="light"]) .api-key-item { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .api-key-item-label { color: #e2e8f0; }
  :root:not([data-theme="light"]) .api-key-item-prefix { color: #a5b4fc; }
  :root:not([data-theme="light"]) .api-label-input { background: #12121e; border-color: rgba(255,255,255,.12); color: #e2e8f0; }
  :root:not([data-theme="light"]) .api-label-input:focus { background: #1a1a2e; }
  :root:not([data-theme="light"]) .api-create-cancel { background: rgba(255,255,255,.07); color: #94a3b8; }
  :root:not([data-theme="light"]) .api-new-key-row { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.09); }
  :root:not([data-theme="light"]) .api-new-key-value { color: #c9d1d9; }
  :root:not([data-theme="light"]) .api-auth-note { background: rgba(91,94,244,.1); color: #94a3b8; }
  :root:not([data-theme="light"]) .api-auth-note code { background: rgba(91,94,244,.2); color: #a5b4fc; }
  :root:not([data-theme="light"]) .api-base-row { border-top-color: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .api-base-url { color: #c9d1d9; background: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .api-flow { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
  :root:not([data-theme="light"]) .api-flow-path { color: #c9d1d9; font-weight: 600; }
  :root:not([data-theme="light"]) .api-flow-arrow { color: #1e293b; }
  :root:not([data-theme="light"]) .api-flow-method.post { background: rgba(91,94,244,.22); color: #a5b4fc; }
  :root:not([data-theme="light"]) .api-flow-method.get  { background: rgba(5,150,105,.22); color: #34d399; }
  :root:not([data-theme="light"]) .api-flow-desc { color: #4a5568; }
  :root:not([data-theme="light"]) .api-endpoint-block { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
  :root:not([data-theme="light"]) .api-endpoint-block[data-method="post"] { border-top-color: #7c7ff5; }
  :root:not([data-theme="light"]) .api-endpoint-block[data-method="get"]  { border-top-color: #10b981; }
  :root:not([data-theme="light"]) .api-endpoint-block[data-method="post"] > .api-endpoint-row { background: rgba(91,94,244,.09); border-bottom-color: rgba(91,94,244,.18); }
  :root:not([data-theme="light"]) .api-endpoint-block[data-method="get"]  > .api-endpoint-row { background: rgba(5,150,105,.09); border-bottom-color: rgba(5,150,105,.18); }
  :root:not([data-theme="light"]) .api-method.post { background: rgba(91,94,244,.22); color: #a5b4fc; }
  :root:not([data-theme="light"]) .api-method.get  { background: rgba(5,150,105,.22); color: #34d399; }
  :root:not([data-theme="light"]) .api-path { color: #e2e8f0; }
  :root:not([data-theme="light"]) .api-endpoint-summary { color: #334155; }
  :root:not([data-theme="light"]) .api-prose { color: #94a3b8; }
  :root:not([data-theme="light"]) .api-inline { background: rgba(91,94,244,.2); color: #a5b4fc; }
  :root:not([data-theme="light"]) .api-response-label { background: rgba(5,150,105,.15); color: #34d399; border-color: rgba(5,150,105,.3); }
  :root:not([data-theme="light"]) .api-param-table { border-color: rgba(255,255,255,.08); }
  :root:not([data-theme="light"]) .api-param-head { background: rgba(255,255,255,.04); color: #334155; }
  :root:not([data-theme="light"]) .api-param-row { color: #94a3b8; border-top-color: rgba(255,255,255,.05); }
  :root:not([data-theme="light"]) .api-param-row:nth-child(even) { background: rgba(255,255,255,.025); }
  :root:not([data-theme="light"]) .api-param-row code { color: #a5b4fc; }
  :root:not([data-theme="light"]) .api-param-group-row { color: #334155; background: rgba(255,255,255,.03); border-top-color: rgba(255,255,255,.06); }
  :root:not([data-theme="light"]) .api-param-on { color: #34d399; }
  :root:not([data-theme="light"]) .api-statuses { border-top-color: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .api-status-row { color: #94a3b8; }
  :root:not([data-theme="light"]) .api-status-badge.queued  { background: rgba(255,255,255,.07); color: #64748b; border-color: rgba(255,255,255,.1); }
  :root:not([data-theme="light"]) .api-status-badge.running { background: rgba(91,94,244,.22); color: #a5b4fc; border-color: rgba(91,94,244,.32); }
  :root:not([data-theme="light"]) .api-status-badge.done    { background: rgba(5,150,105,.18); color: #34d399; border-color: rgba(5,150,105,.3); }
  :root:not([data-theme="light"]) .api-status-badge.failed  { background: rgba(220,38,38,.18); color: #f87171; border-color: rgba(220,38,38,.3); }
  :root:not([data-theme="light"]) .api-steps { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
  :root:not([data-theme="light"]) .api-step { border-bottom-color: rgba(255,255,255,.06); }
  :root:not([data-theme="light"]) .api-step-title { color: #e2e8f0; }
}
:root[data-theme="dark"] #page-api { background: #0e0e14; }
:root[data-theme="dark"] .api-group-label { color: #334155; }
:root[data-theme="dark"] .api-group-label::after { background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .api-keys-section { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
:root[data-theme="dark"] .api-keys-title { color: #e2e8f0; }
:root[data-theme="dark"] .api-key-item { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.07); }
:root[data-theme="dark"] .api-key-item-label { color: #e2e8f0; }
:root[data-theme="dark"] .api-key-item-prefix { color: #a5b4fc; }
:root[data-theme="dark"] .api-label-input { background: #12121e; border-color: rgba(255,255,255,.12); color: #e2e8f0; }
:root[data-theme="dark"] .api-label-input:focus { background: #1a1a2e; }
:root[data-theme="dark"] .api-create-cancel { background: rgba(255,255,255,.07); color: #94a3b8; }
:root[data-theme="dark"] .api-new-key-row { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.09); }
:root[data-theme="dark"] .api-new-key-value { color: #c9d1d9; }
:root[data-theme="dark"] .api-auth-note { background: rgba(91,94,244,.1); color: #94a3b8; }
:root[data-theme="dark"] .api-auth-note code { background: rgba(91,94,244,.2); color: #a5b4fc; }
:root[data-theme="dark"] .api-base-row { border-top-color: rgba(255,255,255,.07); }
:root[data-theme="dark"] .api-base-url { color: #c9d1d9; background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .api-flow { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
:root[data-theme="dark"] .api-flow-path { color: #c9d1d9; font-weight: 600; }
:root[data-theme="dark"] .api-flow-arrow { color: #1e293b; }
:root[data-theme="dark"] .api-flow-method.post { background: rgba(91,94,244,.22); color: #a5b4fc; }
:root[data-theme="dark"] .api-flow-method.get  { background: rgba(5,150,105,.22); color: #34d399; }
:root[data-theme="dark"] .api-flow-desc { color: #4a5568; }
:root[data-theme="dark"] .api-endpoint-block { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
:root[data-theme="dark"] .api-endpoint-block[data-method="post"] { border-top-color: #7c7ff5; }
:root[data-theme="dark"] .api-endpoint-block[data-method="get"]  { border-top-color: #10b981; }
:root[data-theme="dark"] .api-endpoint-block[data-method="post"] > .api-endpoint-row { background: rgba(91,94,244,.09); border-bottom-color: rgba(91,94,244,.18); }
:root[data-theme="dark"] .api-endpoint-block[data-method="get"]  > .api-endpoint-row { background: rgba(5,150,105,.09); border-bottom-color: rgba(5,150,105,.18); }
:root[data-theme="dark"] .api-method.post { background: rgba(91,94,244,.22); color: #a5b4fc; }
:root[data-theme="dark"] .api-method.get  { background: rgba(5,150,105,.22); color: #34d399; }
:root[data-theme="dark"] .api-path { color: #e2e8f0; }
:root[data-theme="dark"] .api-endpoint-summary { color: #334155; }
:root[data-theme="dark"] .api-prose { color: #94a3b8; }
:root[data-theme="dark"] .api-inline { background: rgba(91,94,244,.2); color: #a5b4fc; }
:root[data-theme="dark"] .api-response-label { background: rgba(5,150,105,.15); color: #34d399; border-color: rgba(5,150,105,.3); }
:root[data-theme="dark"] .api-param-table { border-color: rgba(255,255,255,.08); }
:root[data-theme="dark"] .api-param-head { background: rgba(255,255,255,.04); color: #334155; }
:root[data-theme="dark"] .api-param-row { color: #94a3b8; border-top-color: rgba(255,255,255,.05); }
:root[data-theme="dark"] .api-param-row:nth-child(even) { background: rgba(255,255,255,.025); }
:root[data-theme="dark"] .api-param-row code { color: #a5b4fc; }
:root[data-theme="dark"] .api-param-group-row { color: #334155; background: rgba(255,255,255,.03); border-top-color: rgba(255,255,255,.06); }
:root[data-theme="dark"] .api-param-on { color: #34d399; }
:root[data-theme="dark"] .api-statuses { border-top-color: rgba(255,255,255,.07); }
:root[data-theme="dark"] .api-status-row { color: #94a3b8; }
:root[data-theme="dark"] .api-status-badge.queued  { background: rgba(255,255,255,.07); color: #64748b; border-color: rgba(255,255,255,.1); }
:root[data-theme="dark"] .api-status-badge.running { background: rgba(91,94,244,.22); color: #a5b4fc; border-color: rgba(91,94,244,.32); }
:root[data-theme="dark"] .api-status-badge.done    { background: rgba(5,150,105,.18); color: #34d399; border-color: rgba(5,150,105,.3); }
:root[data-theme="dark"] .api-status-badge.failed  { background: rgba(220,38,38,.18); color: #f87171; border-color: rgba(220,38,38,.3); }
:root[data-theme="dark"] .api-steps { background: #1a1a2a; border-color: rgba(255,255,255,.08); box-shadow: 0 2px 14px rgba(0,0,0,.35); }
:root[data-theme="dark"] .api-step { border-bottom-color: rgba(255,255,255,.06); }
:root[data-theme="dark"] .api-step-title { color: #e2e8f0; }


/* ── Settings page ── */
#page-settings {
  position: fixed;
  top: var(--banner-h); left: 0; right: 0; bottom: var(--nav-h);
  background: #f0f0f5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  --stg-bg:       #f0f0f5;
  --stg-card:     #ffffff;
  --stg-text:     #0d0d14;
  --stg-muted:    #6e6e7a;
  --stg-border:   rgba(0,0,0,.08);
  --stg-seg:      #e4e4ea;
  --stg-shadow:   0 2px 12px rgba(0,0,0,.07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #page-settings {
    background: #111115;
    --stg-bg:     #111115;
    --stg-card:   #1e1e24;
    --stg-text:   #f0f0f8;
    --stg-muted:  #8e8e9a;
    --stg-border: rgba(255,255,255,.07);
    --stg-seg:    #2a2a32;
    --stg-shadow: 0 2px 12px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] #page-settings {
  background: #111115;
  --stg-bg:     #111115;
  --stg-card:   #1e1e24;
  --stg-text:   #f0f0f8;
  --stg-muted:  #8e8e9a;
  --stg-border: rgba(255,255,255,.07);
  --stg-seg:    #2a2a32;
  --stg-shadow: 0 2px 12px rgba(0,0,0,.3);
}
:root[data-theme="light"] #page-settings {
  background: #f0f0f5;
  --stg-bg:     #f0f0f5;
  --stg-card:   #ffffff;
  --stg-text:   #0d0d14;
  --stg-muted:  #6e6e7a;
  --stg-border: rgba(0,0,0,.08);
  --stg-seg:    #e4e4ea;
  --stg-shadow: 0 2px 12px rgba(0,0,0,.07);
}

.stg-scroll { padding-top: 16px; padding-bottom: calc(env(safe-area-inset-bottom) + 48px); }

/* ── Hero card ── */
.stg-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 16px 0;
  padding: 18px 16px;
  background: var(--stg-card);
  border-radius: 20px;
  box-shadow: var(--stg-shadow);
}
.stg-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #5b5ef4 0%, #8b5cf6 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  font-family: var(--font); flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(91,94,244,.35);
}
.stg-hero-info { flex: 1; min-width: 0; }
.stg-hero-name {
  font-size: 16px; font-weight: 600; font-family: var(--font);
  color: var(--stg-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stg-hero-sub { font-size: 12px; color: var(--stg-muted); font-family: var(--font); margin-top: 2px; }
.stg-hero-badge {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #5b5ef4, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stg-hero-badge svg { stroke: #fff; }

/* ── Section labels ── */
.stg-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--stg-muted); padding: 18px 20px 6px;
  text-transform: uppercase; font-family: var(--font);
}

/* ── Cards ── */
.stg-group {
  background: var(--stg-card);
  border-radius: 16px;
  margin: 0 16px;
  overflow: hidden;
  box-shadow: var(--stg-shadow);
}
.stg-group-mt { margin-top: 6px; }

.stg-sep {
  height: 1px; background: var(--stg-border); margin-left: 58px;
}

/* ── Standard row ── */
.stg-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; min-height: 52px;
}
.stg-row-wrap { flex-wrap: wrap; row-gap: 10px; }

/* ── Icon badges ── */
.stg-ico {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ico-bg, #888);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--ico-bg, #888) 40%, transparent);
}
.stg-ico svg {
  width: 16px; height: 16px; stroke: #fff; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.stg-ico-ghost { width: 32px; height: 32px; flex-shrink: 0; }

.stg-row-label {
  flex: 1; font-size: 15.5px; font-family: var(--font); color: var(--stg-text);
  font-weight: 500;
}
.stg-row-val {
  font-size: 13px; color: var(--stg-muted);
  font-family: 'SF Mono','Fira Mono',monospace;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Theme segmented control ── */
.tseg {
  display: flex; background: var(--stg-seg);
  border-radius: 10px; padding: 3px; flex: 1; min-width: 0;
}
.tseg-btn {
  flex: 1; border: none; background: transparent;
  padding: 7px 4px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; font-family: var(--font);
  color: var(--stg-muted); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tseg-btn.active {
  background: var(--stg-card); color: var(--accent);
  box-shadow: 0 1px 5px rgba(0,0,0,.14);
}

/* ── Input rows inside cards ── */
.stg-inp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; min-height: 60px;
}
.stg-inp-wrap  { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.stg-inp-label { font-size: 11px; color: var(--stg-muted); font-family: var(--font); font-weight: 600; letter-spacing: .02em; }
.stg-inp {
  border: none; background: transparent; outline: none;
  font-size: 15.5px; font-family: var(--font); color: var(--stg-text); width: 100%;
}
.stg-inp::placeholder { color: var(--stg-muted); opacity: .5; }

/* ── CTA / primary button ── */
.stg-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: calc(100% - 32px); margin: 10px 16px 0;
  padding: 16px; border-radius: 16px; border: none;
  background: linear-gradient(135deg, #5b5ef4, #8b5cf6);
  color: #fff; font-family: var(--font); font-size: 15.5px; font-weight: 700;
  cursor: pointer; letter-spacing: .01em;
  box-shadow: 0 4px 16px rgba(91,94,244,.35);
  transition: opacity .15s, transform .1s;
}
.stg-action-btn:active { opacity: .85; transform: scale(.98); }

.stg-msg {
  text-align: center; font-size: 13px; font-family: var(--font);
  padding: 8px 20px 0; min-height: 22px; color: var(--stg-muted);
}

/* ── Logout button ── */
.stg-logout-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 17px; border: none;
  background: transparent; color: #ef4444;
  font-family: var(--font); font-size: 15.5px; font-weight: 700;
  cursor: pointer; transition: background .12s;
}
.stg-logout-btn:active { background: rgba(239,68,68,.08); }

/* ── Settings: hero row inside card ── */
.stg-hero-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 16px 14px;
}
.stg-logout-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; min-height: 52px;
  width: 100%; border: none; background: none; cursor: pointer; text-align: left;
}
.stg-logout-row:active { background: rgba(239,68,68,.06); }
.stg-red { color: #ef4444 !important; font-weight: 600; }

/* ── Settings: submit button inside card ── */
.stg-card-btn-wrap { padding: 12px 16px 14px; }
.stg-action-btn-card {
  width: 100%; margin: 0; border-radius: 12px;
  padding: 14px; font-size: 15px;
}

/* ── Theme row: icon+label on top, segment full-width below ── */
.stg-theme-row {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px;
}
.stg-theme-top { display: flex; align-items: center; gap: 12px; }
.stg-theme-row .tseg { flex: none; width: 100%; }

/* ── Add-app button full width ── */
.add-app-wrap-full { padding: 8px 0 16px; }
.add-app-btn-full  { border-radius: 14px; box-shadow: none; width: 100%; }
@media (prefers-color-scheme: dark) {
  .add-app-btn-full { border-top-color: rgba(255,255,255,.06); }
}

/* ── Analytics / Events pages ── */
#page-analytics, #page-events {
  position: fixed;
  top: var(--banner-h); left: 0; right: 0; bottom: var(--nav-h);
  background: #f4f5f9;
  overflow-y: auto;
}
#page-analytics[hidden], #page-events[hidden] { display: none; }

/* Coming-soon (used by Events) */
.coming-soon-wrap {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 80px 32px;
  text-align: center;
}
.coming-soon-icon { font-size: 56px; line-height: 1; }
.coming-soon-title {
  font-size: 22px; font-weight: 700; font-family: var(--font);
  color: #0d0d14; letter-spacing: -.02em;
}
.coming-soon-sub {
  font-size: 14px; color: #8a8a9a; font-family: var(--font);
  max-width: 280px; line-height: 1.55;
}

/* ── App picker dropdown (Analytics + Events) ── */
.app-picker { position: relative; }
.app-picker-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  background: #fff; border: 1.5px solid rgba(0,0,0,.1);
  border-radius: 12px; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 500; color: #0d0d14;
  transition: border-color .15s;
}
.app-picker-btn:hover, .app-picker-btn.open { border-color: #6366f1; }
.app-picker-btn > span { flex: 1; text-align: left; }
.app-picker-chevron { flex-shrink: 0; color: #8a8a9a; transition: transform .2s; }
.app-picker-btn.open .app-picker-chevron { transform: rotate(180deg); }

.app-picker-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 300;
  background: #fff; border-radius: 14px;
  border: 1.5px solid rgba(0,0,0,.08);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
.picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  font-family: var(--font); font-size: 14px; color: #0d0d14;
  transition: background .1s;
}
.picker-item:hover { background: #f4f5f9; }
.picker-item.picker-all { font-weight: 600; padding: 12px 14px; }
.picker-cb {
  width: 17px; height: 17px; accent-color: #6366f1;
  cursor: pointer; flex-shrink: 0;
}
.picker-sep { height: 1px; background: rgba(0,0,0,.07); margin: 0 12px; }

/* Build card rows in picker */
.picker-build { align-items: center; }
.picker-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  overflow: hidden; background: linear-gradient(135deg,#6366f1,#8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.picker-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.picker-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.picker-name { font-size: 13px; font-weight: 600; color: #0d0d14; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-ver  { font-size: 11px; color: #8a8a9a; }

/* Dark mode picker */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .app-picker-btn { background: #1e1e24; border-color: rgba(255,255,255,.1); color: #f0f0f8; }
  :root:not([data-theme="light"]) .app-picker-btn.open { border-color: #6366f1; }
  :root:not([data-theme="light"]) .app-picker-drop { background: #1e1e24; border-color: rgba(255,255,255,.1); }
  :root:not([data-theme="light"]) .picker-item { color: #f0f0f8; }
  :root:not([data-theme="light"]) .picker-item:hover { background: #2a2a35; }
  :root:not([data-theme="light"]) .picker-sep { background: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .picker-name { color: #f0f0f8; }
  :root:not([data-theme="light"]) .picker-ver  { color: #6a6a8a; }
}
:root[data-theme="dark"] .app-picker-btn { background: #1e1e24; border-color: rgba(255,255,255,.1); color: #f0f0f8; }
:root[data-theme="dark"] .app-picker-btn.open { border-color: #6366f1; }
:root[data-theme="dark"] .app-picker-drop { background: #1e1e24; border-color: rgba(255,255,255,.1); }
:root[data-theme="dark"] .picker-item { color: #f0f0f8; }
:root[data-theme="dark"] .picker-item:hover { background: #2a2a35; }
:root[data-theme="dark"] .picker-sep { background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .picker-name { color: #f0f0f8; }
:root[data-theme="dark"] .picker-ver  { color: #6a6a8a; }

/* ── Analytics layout ── */
.an-wrap {
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column; gap: 12px;
}

/* Period selector */
.an-period-row {
  display: flex; gap: 6px;
}
.an-period-btn {
  flex: 1;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px 0;
  border-radius: 10px;
  border: 1.5px solid rgba(0,0,0,.1);
  background: #fff;
  color: #6e6e7a;
  cursor: pointer;
  transition: all .15s;
}
.an-period-btn.active {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}

/* Stat tiles */
.an-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.an-tile {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.an-tile-val {
  font-family: var(--font); font-size: 28px; font-weight: 700;
  letter-spacing: -.03em; line-height: 1;
  color: #0d0d14;
}
.an-tile-lbl {
  font-family: var(--font); font-size: 12px; color: #8a8a9a;
}
.an-tile-orange .an-tile-val { color: #f59e0b; }
.an-tile-red    .an-tile-val { color: #ef4444; }

/* Cards */
.an-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.an-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.an-card-label {
  font-family: var(--font); font-size: 13px; font-weight: 700;
  color: #0d0d14; letter-spacing: -.01em;
}
.an-card-label-pad { margin-bottom: 12px; display: block; }
.an-legend-row { display: flex; gap: 10px; }
.an-leg {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font); font-size: 11px; color: #8a8a9a;
}
.an-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}

/* Chart */
.an-chart-area { overflow: hidden; border-radius: 6px; }
#an-chart { display: block; }

/* Bar rows */
.an-bars { display: flex; flex-direction: column; gap: 10px; }
.an-bar-row {
  display: flex; align-items: center; gap: 8px;
}
.an-bar-lbl {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 13px; color: #3a3a4a;
  width: 90px; flex-shrink: 0;
}
.an-dot-sm {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.an-bar-track {
  flex: 1; height: 8px; background: rgba(0,0,0,.07); border-radius: 99px; overflow: hidden;
}
.an-bar-fill {
  height: 100%; border-radius: 99px; transition: width .4s ease;
}
.an-bar-num {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: #3a3a4a; width: 28px; text-align: right; flex-shrink: 0;
}

/* Empty / Loading */
.an-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 48px 24px; gap: 8px;
}
.an-empty-ico { font-size: 48px; }
.an-empty-title {
  font-family: var(--font); font-size: 17px; font-weight: 700;
  color: #0d0d14; margin-top: 4px;
}
.an-empty-sub {
  font-family: var(--font); font-size: 13px; color: #8a8a9a;
  max-width: 260px; line-height: 1.5;
}
.an-loading {
  display: flex; justify-content: center; padding: 48px;
}
.an-spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(99,102,241,.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .an-period-btn {
    background: #1e1e24; color: #8e8e9a; border-color: rgba(255,255,255,.1);
  }
  :root:not([data-theme="light"]) .an-period-btn.active { background: #6366f1; color: #fff; }
  :root:not([data-theme="light"]) .an-tile,
  :root:not([data-theme="light"]) .an-card { background: #1e1e24; box-shadow: none; }
  :root:not([data-theme="light"]) .an-tile-val { color: #f0f0f8; }
  :root:not([data-theme="light"]) .an-card-label { color: #f0f0f8; }
  :root:not([data-theme="light"]) .an-bar-lbl, :root:not([data-theme="light"]) .an-bar-num { color: #c0c0d0; }
  :root:not([data-theme="light"]) .an-bar-track { background: rgba(255,255,255,.1); }
  :root:not([data-theme="light"]) .an-empty-title { color: #f0f0f8; }
  :root:not([data-theme="light"]) .an-tile-lbl, :root:not([data-theme="light"]) .an-leg { color: #6e6e7a; }
  :root:not([data-theme="light"]) #page-analytics { background: #111115; }
}
:root[data-theme="dark"] .an-period-btn { background: #1e1e24; color: #8e8e9a; border-color: rgba(255,255,255,.1); }
:root[data-theme="dark"] .an-period-btn.active { background: #6366f1; color: #fff; }
:root[data-theme="dark"] .an-tile,
:root[data-theme="dark"] .an-card { background: #1e1e24; box-shadow: none; }
:root[data-theme="dark"] .an-tile-val { color: #f0f0f8; }
:root[data-theme="dark"] .an-card-label { color: #f0f0f8; }
:root[data-theme="dark"] .an-bar-lbl, :root[data-theme="dark"] .an-bar-num { color: #c0c0d0; }
:root[data-theme="dark"] .an-bar-track { background: rgba(255,255,255,.1); }
:root[data-theme="dark"] .an-empty-title { color: #f0f0f8; }
:root[data-theme="dark"] .an-tile-lbl, :root[data-theme="dark"] .an-leg { color: #6e6e7a; }
:root[data-theme="dark"] #page-analytics { background: #111115; }

/* ── Events page ── */
.ev-wrap {
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column; gap: 12px;
}

/* Filters */
.ev-filters {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
}
.ev-filters::-webkit-scrollbar { display: none; }
.ev-filter-btn {
  flex-shrink: 0;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(0,0,0,.1);
  background: #fff;
  color: #6e6e7a;
  cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.ev-filter-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }

/* Event cards */
#ev-list { display: flex; flex-direction: column; gap: 8px; }

.ev-item {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.ev-item-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 14px;
  cursor: pointer;
}
.ev-lvl {
  font-family: var(--font); font-size: 10px; font-weight: 800;
  letter-spacing: .04em; padding: 3px 7px; border-radius: 6px;
  flex-shrink: 0; margin-top: 2px;
}
.ev-lvl-crit { background: #fef2f2; color: #dc2626; }
.ev-lvl-high { background: #fff7ed; color: #ea580c; }

.ev-item-body { flex: 1; min-width: 0; }
.ev-item-top {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px; flex-wrap: wrap;
}
.ev-kind-icon { display: flex; align-items: center; color: #8a8a9a; flex-shrink: 0; }
.ev-app-name {
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: #0d0d14; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev-label-badge {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px;
  background: #f0fdf4; color: #15803d; flex-shrink: 0;
}
.ev-item-sigs { display: flex; flex-wrap: wrap; gap: 4px; }
.ev-sig-tag {
  font-family: var(--font); font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 6px;
  background: #f1f5f9; color: #475569;
}
.ev-sig-reason { background: #fef3c7; color: #92400e; }
.ev-item-time {
  font-family: var(--font); font-size: 11px; color: #a0a0b0;
  flex-shrink: 0; margin-top: 2px; white-space: nowrap;
}

/* Triage */
.ev-triage {
  display: flex; gap: 6px; padding: 0 14px 14px;
}
.ev-tr-btn {
  flex: 1; font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 7px 4px; border-radius: 10px; border: none; cursor: pointer;
  transition: opacity .15s;
}
.ev-tr-btn:disabled { opacity: .5; }
.ev-tr-attack { background: #fef2f2; color: #dc2626; }
.ev-tr-fp     { background: #f0fdf4; color: #15803d; }
.ev-tr-ignore { background: #f1f5f9; color: #475569; }
.ev-tr-clear  { background: #f4f5f9; color: #8a8a9a; flex: 0; padding: 7px 12px; }

/* Empty / Loading */
.ev-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 64px 24px; gap: 8px;
}
.ev-empty-ico  { font-size: 48px; }
.ev-empty-title {
  font-family: var(--font); font-size: 17px; font-weight: 700;
  color: #0d0d14; margin-top: 4px;
}
.ev-empty-sub {
  font-family: var(--font); font-size: 13px; color: #8a8a9a;
  max-width: 260px; line-height: 1.5;
}
.ev-loading { display: flex; justify-content: center; padding: 48px; }

/* Dark mode — Events */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #page-events { background: #111115; }
  :root:not([data-theme="light"]) .ev-filter-btn { background: #1e1e24; color: #8e8e9a; border-color: rgba(255,255,255,.1); }
  :root:not([data-theme="light"]) .ev-filter-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }
  :root:not([data-theme="light"]) .ev-item { background: #1e1e24; box-shadow: none; }
  :root:not([data-theme="light"]) .ev-app-name { color: #f0f0f8; }
  :root:not([data-theme="light"]) .ev-sig-tag { background: #2a2a35; color: #a0a0b8; }
  :root:not([data-theme="light"]) .ev-item-time { color: #6e6e7a; }
  :root:not([data-theme="light"]) .ev-tr-clear { background: #2a2a35; color: #8e8e9a; }
  :root:not([data-theme="light"]) .ev-empty-title { color: #f0f0f8; }
}
:root[data-theme="dark"] #page-events { background: #111115; }
:root[data-theme="dark"] .ev-filter-btn { background: #1e1e24; color: #8e8e9a; border-color: rgba(255,255,255,.1); }
:root[data-theme="dark"] .ev-filter-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }
:root[data-theme="dark"] .ev-item { background: #1e1e24; box-shadow: none; }
:root[data-theme="dark"] .ev-app-name { color: #f0f0f8; }
:root[data-theme="dark"] .ev-sig-tag { background: #2a2a35; color: #a0a0b8; }
:root[data-theme="dark"] .ev-item-time { color: #6e6e7a; }
:root[data-theme="dark"] .ev-tr-clear { background: #2a2a35; color: #8e8e9a; }
:root[data-theme="dark"] .ev-empty-title { color: #f0f0f8; }

/* ── Relay Keys section ─────────────────────────────────────────────────── */
.relay-intro {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.55;
  margin-bottom: 14px;
}
.relay-intro em { font-style: normal; font-weight: 600; color: var(--text-primary, #111); }
.relay-token-chip {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  background: rgba(99,102,241,.1);
  color: #6366f1;
  transition: background .15s;
  user-select: none;
}
.relay-token-chip:hover { background: rgba(99,102,241,.2); }
.relay-how {
  margin-top: 16px;
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 14px;
}
.relay-how-title { font-size: 12px; font-weight: 600; color: var(--text-secondary, #6b7280); margin-bottom: 8px; }
.relay-code {
  font-family: ui-monospace, 'SFMono-Regular', monospace;
  font-size: 12px;
  background: var(--code-bg, #f3f4f6);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0;
  line-height: 1.6;
  color: var(--text-primary, #111);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .relay-intro { color: #9ca3af; }
  :root:not([data-theme="light"]) .relay-intro em { color: #f3f4f6; }
  :root:not([data-theme="light"]) .relay-code { background: #1e1e2e; color: #e2e8f0; }
}
:root[data-theme="dark"] .relay-intro { color: #9ca3af; }
:root[data-theme="dark"] .relay-intro em { color: #f3f4f6; }
:root[data-theme="dark"] .relay-code { background: #1e1e2e; color: #e2e8f0; }

/* ── Relay section inside job-detail ───────────────────────────────────── */
.job-section-relay { padding: 0 16px 8px; }
.relay-section-inner { }
.relay-keys-header { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 8px; }

/* ── Relay block inside download pane ──────────────────────────────────── */
.dl-relay-block {
  margin-top: 24px;
  padding: 16px;
  border-radius: 12px;
  background: var(--card-bg, #f9f9fb);
  border: 1px solid var(--border, #e5e7eb);
}
.dl-relay-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.dl-relay-desc  { font-size: 12px; color: var(--text-secondary, #6b7280); margin-bottom: 12px; line-height: 1.5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dl-relay-block { background: #1a1a22; border-color: rgba(255,255,255,.08); }
}
:root[data-theme="dark"] .dl-relay-block { background: #1a1a22; border-color: rgba(255,255,255,.08); }

/* ── Platform badges (iOS / Android) ── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.platform-badge.ios {
  background: rgba(0,122,255,.1);
  color: #007aff;
  border-color: rgba(0,122,255,.2);
}
.platform-badge.android {
  background: rgba(61,220,132,.1);
  color: #3ddc84;
  border-color: rgba(61,220,132,.2);
}
.platform-badge.macos {
  background: rgba(162,132,94,.12);
  color: #a2845e;
  border-color: rgba(162,132,94,.25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .platform-badge.ios {
    background: rgba(10,132,255,.18);
    color: #0a84ff;
    border-color: rgba(10,132,255,.3);
  }
  :root:not([data-theme="light"]) .platform-badge.macos {
    background: rgba(200,160,100,.15);
    color: #c8a064;
    border-color: rgba(200,160,100,.28);
  }
}
:root[data-theme="dark"] .platform-badge.ios {
  background: rgba(10,132,255,.18);
  color: #0a84ff;
  border-color: rgba(10,132,255,.3);
}
:root[data-theme="dark"] .platform-badge.macos {
  background: rgba(200,160,100,.15);
  color: #c8a064;
  border-color: rgba(200,160,100,.28);
}
.platform-badge.windows {
  background: rgba(0,120,215,.1);
  color: #0078d7;
  border-color: rgba(0,120,215,.22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .platform-badge.windows {
    background: rgba(0,168,255,.15);
    color: #00a8ff;
    border-color: rgba(0,168,255,.28);
  }
}
:root[data-theme="dark"] .platform-badge.windows {
  background: rgba(0,168,255,.15);
  color: #00a8ff;
  border-color: rgba(0,168,255,.28);
}

/* ── Billing card ──────────────────────────────────────────────────────────── */
.billing-bar-wrap {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.billing-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .4s ease;
}
.billing-bar-fill.billing-bar-warn  { background: #f59e0b; }
.billing-bar-fill.billing-bar-full  { background: #ef4444; }

.billing-upgrade-btn {
  flex: 1;
  min-width: 120px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
}
.billing-upgrade-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.billing-upgrade-btn.billing-btn-featured {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.billing-upgrade-btn.billing-btn-featured:hover {
  opacity: .88;
}
.billing-upgrade-btn.billing-btn-portal {
  border-color: var(--text-3);
  color: var(--text-2);
  font-weight: 500;
}
