/* LaTeX Doctor — Modern UI
   Color palette aligned with landing page (#2563eb primary blue)
   -------------------------------------------------------------------- */
:root {
  --ink:        #0f172a;
  --ink-muted:  #475569;
  --ink-faint:  #94a3b8;
  --accent:     #2563eb;
  --accent-mid: #1d4ed8;
  --accent-soft:#dbeafe;
  --paper:      #ffffff;
  --panel:      #ffffff;
  --border:     #e2e8f0;
  --border-mid: #cbd5e1;
  --success:    #166534;
  --success-bg: #f0fdf4;
  --error:      #991b1b;
  --error-bg:   #fef2f2;
  --warn:       #92400e;
  --warn-bg:    #fffbeb;

  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono:  ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;

  --radius:     8px;
  --radius-md:  12px;
  --max-prose:  720px;
  --max-form:   880px;

  --shadow-sm:  0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:  0 4px 16px rgba(15,23,42,0.08), 0 1px 4px rgba(15,23,42,0.04);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  background: #f8fafc;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── SITE HEADER ──────────────────────────────────────────────── */
.site-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 4vw, 40px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
}
.site-wordmark {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.site-wordmark em { color: var(--accent); font-style: normal; }
.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--ink); background: #f1f5f9; }
.site-nav a.active { color: var(--accent); font-weight: 500; }
.site-nav .nav-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }

/* ── MAIN LAYOUT ──────────────────────────────────────────────── */
.page-main {
  width: min(var(--max-form), calc(100% - 2 * clamp(16px, 4vw, 40px)));
  margin: 0 auto;
  padding: 48px 0 80px;
}
.page-main--narrow { max-width: var(--max-prose); }

/* ── PAGE HEADER ──────────────────────────────────────────────── */
.page-hd {
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  margin-bottom: 36px;
}
.page-hd__eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}
.page-hd h1 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-hd .lead {
  margin: 10px 0 0;
  font-size: 1rem;
  color: var(--ink-muted);
  max-width: var(--max-prose);
}

/* ── TYPOGRAPHY ───────────────────────────────────────────────── */
h2 {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}
h3 { font-size: 0.9375rem; font-weight: 600; margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .monospace {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
p { margin: 0; }

/* ── TIER CARDS ───────────────────────────────────────────────── */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.tier-card {
  background: var(--panel);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.tier-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.tier-card__name {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.tier-card__glyph { font-size: 1.1rem; }
.tier-card__price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
}
.tier-card__price sub {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--ink-muted);
  vertical-align: baseline;
}
.tier-card__desc {
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.5;
}
.tier-card__features {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.tier-card__features li::before { content: "— "; color: var(--ink-faint); }
.tier-card .btn-primary, .tier-card .btn-secondary { margin-top: auto; }
.tier-card--highlight { background: #eff6ff; border-color: var(--accent); }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, transform .12s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-mid);
  border-color: var(--accent-mid);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover { background: #f8fafc; border-color: var(--ink-faint); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid transparent;
  padding: 8px 12px;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); text-decoration: none; }
.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid #fca5a5;
  font-size: 0.8125rem;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background .15s;
}
.btn-danger:hover { background: var(--error-bg); }
button[disabled], .btn-primary[disabled], .btn-secondary[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── FORMS ────────────────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}
.form-field .field-hint {
  font-size: 0.75rem;
  color: var(--ink-muted);
}
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="password"], .form-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, .form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
input::placeholder { color: var(--ink-faint); }

.form-row { display: flex; gap: 10px; align-items: flex-end; }
.form-row .form-field { flex: 1; }

/* ── NOTICE / ALERTS ──────────────────────────────────────────── */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--ink-muted);
}
.alert-success { border-color: #86efac; background: var(--success-bg); color: var(--success); }
.alert-error   { border-color: #fca5a5; background: var(--error-bg);   color: var(--error); }
.alert-warn    { border-color: #fcd34d; background: var(--warn-bg);     color: var(--warn); }

/* ── TABLE (clean) ────────────────────────────────────────────── */
.table-clean {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table-clean th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
}
.table-clean td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--ink);
}
.table-clean tbody tr:last-child td { border-bottom: 0; }
.table-clean tbody tr:hover td { background: #f8fafc; }

/* ── CARD / PANEL ─────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card__body { padding: 20px; }
.card__empty {
  padding: 20px;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

/* ── TIER BADGE ───────────────────────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tier-badge--free  { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.tier-badge--pro   { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.tier-badge--max   { background: #f5f3ff; color: #5b21b6; border: 1px solid #ddd6fe; }
.tier-badge--ultra { background: #fdf4ff; color: #7e22ce; border: 1px solid #f0abfc; }

/* ── STAT ROW (account overview) ─────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--border);
  margin-bottom: 28px;
}
.stat-cell {
  background: var(--panel);
  padding: 16px 18px;
}
.stat-cell__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 4px;
}
.stat-cell__value {
  font-size: 0.9375rem;
  color: var(--ink);
}

/* ── COPY BUTTON ──────────────────────────────────────────────── */
.copy-wrap { display: inline-flex; align-items: center; gap: 6px; }
.btn-copy {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  transition: background .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-copy:hover { background: #f1f5f9; }
.btn-copy.copied { color: var(--success); border-color: #86efac; }

/* ── UPGRADE RADIO CARDS ─────────────────────────────────────── */
.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.upgrade-option {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.upgrade-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.upgrade-option:has(input:checked) {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.upgrade-option:has(input:disabled) {
  opacity: .4;
  cursor: not-allowed;
  background: #f8fafc;
}
.upgrade-option__name {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  display: block;
  margin-bottom: 2px;
}
.upgrade-option__price {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.upgrade-option__note {
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: 4px;
  display: block;
}

/* ── FOOTER ───────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px clamp(16px, 4vw, 40px);
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  align-items: center;
}
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: var(--ink); }
.site-footer__spacer { flex: 1; }

/* ── SECTION DIVIDER ──────────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ── STEP INDICATOR ───────────────────────────────────────────── */
.step-list { display: flex; gap: 6px; align-items: center; margin-bottom: 28px; }
.step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.step-item__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-item--active .step-item__num { border-color: var(--accent); background: var(--accent); color: #fff; }
.step-item--active { color: var(--ink); font-weight: 600; }
.step-item--done .step-item__num { border-color: var(--success); background: var(--success); color: #fff; }
.step-sep { width: 24px; height: 1px; background: var(--border); }

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tier-grid { grid-template-columns: 1fr; }
  .stat-row  { grid-template-columns: 1fr 1fr; }
  .upgrade-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
}

/* ── DEVICE PAGE ──────────────────────────────────────────────── */
.device-explainer {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.device-explainer h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}
.device-explainer p { font-size: .875rem; color: var(--ink-muted); margin-bottom: 10px; }
.device-explainer ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: .875rem;
  color: var(--ink-muted);
  line-height: 1.7;
}

.device-progress {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.device-progress__fill {
  height: 100%;
  border-radius: 999px;
  background: #22c55e;
  transition: width .3s ease;
}
.device-progress__fill--amber { background: #f59e0b; }
.device-progress__fill--red   { background: #ef4444; }

.device-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.device-row:last-child { border-bottom: 0; }
.device-row--current { background: #eff6ff; }
.device-row__icon {
  font-size: 1.3rem;
  line-height: 1;
  padding-top: 2px;
  flex-shrink: 0;
}
.device-row__body { flex: 1; min-width: 0; overflow: hidden; }
.device-row__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}
.device-row__meta {
  font-size: .8125rem;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.device-row__id {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
}
.device-row__id-label {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.device-row__id-label:hover { color: var(--ink); }
.device-row__id-value {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: inline-block;
  vertical-align: middle;
}
.device-row__actions {
  flex-shrink: 0;
  padding-top: 2px;
}

.device-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.device-pill--this {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #bfdbfe;
}

.advanced-rebind { margin-bottom: 8px; }
.advanced-rebind__toggle {
  cursor: pointer;
  font-size: .875rem;
  color: var(--ink-muted);
  padding: 10px 4px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.advanced-rebind__toggle::-webkit-details-marker { display: none; }
.advanced-rebind__toggle::before {
  content: "▸";
  font-size: .75rem;
  transition: transform .15s;
}
details[open] .advanced-rebind__toggle::before { transform: rotate(90deg); }
.advanced-rebind__toggle:hover { color: var(--ink); }
.advanced-rebind__body { margin-top: 10px; }

/* ── DASHBOARD LAYOUT ─────────────────────────────────────────── */
.page-main--dashboard {
  padding: 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: calc(100vh - 56px - 49px);
  overflow: hidden;
}
.dash-inner {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-grid--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.dash-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow .18s ease;
}
.dash-card:hover { box-shadow: var(--shadow-md); }
.dash-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.dash-card__head h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.dash-card__body {
  padding: 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-card__body--table { padding: 0; }

.dash-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 3px;
}

.dash-hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.dash-hero__title {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px 0;
}
.dash-hero__sub {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin: 0;
}
.dash-hero__actions { display: flex; gap: 8px; flex-shrink: 0; }

.index-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.index-action-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform .15s, box-shadow .15s;
}
.index-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.index-action-card__icon { font-size: 1.1rem; line-height: 1; }
.index-action-card__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.index-action-card__desc {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin: 0;
  flex: 1;
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.feature-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.4;
}
.feature-list li strong { color: var(--ink); }

.quota-bar {
  width: 100%;
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.quota-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s ease;
}
.quota-bar__fill--warn  { background: #f59e0b; }
.quota-bar__fill--alert { background: #ef4444; }

.key-row { display: flex; align-items: center; gap: 8px; }
.key-obscured {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  filter: blur(4px);
  user-select: none;
  transition: filter .2s;
}
.key-obscured.revealed { filter: none; user-select: text; }
.key-reveal-btn {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  transition: background .15s;
  white-space: nowrap;
}
.key-reveal-btn:hover { background: #f1f5f9; }

.upgrade-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.upgrade-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.upgrade-card:has(input:checked),
.upgrade-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
  background: #eff6ff;
}
.upgrade-card--current {
  border-color: var(--accent);
  background: #eff6ff;
}
.upgrade-card--dimmed {
  opacity: .45;
  cursor: not-allowed;
  background: #f8fafc;
}
.upgrade-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.upgrade-card__badge { display: inline-flex; }
.upgrade-card__name {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.upgrade-card__price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
}
.upgrade-card__price-sub {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--ink-muted);
}
.upgrade-card__features {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.upgrade-card__features li::before { content: "— "; color: var(--ink-faint); }
.upgrade-card__note {
  font-size: 0.6875rem;
  color: var(--ink-faint);
  margin-top: 2px;
}
.current-plan-ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
}

@media (max-width: 999px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid--4 { grid-template-columns: 1fr 1fr; }
  .index-actions { grid-template-columns: 1fr; }
  .page-main--dashboard { height: auto; overflow: auto; }
}
@media (max-width: 600px) {
  .dash-grid--4 { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .btn-primary, .btn-secondary,
  .device-row__actions, .advanced-rebind { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page-main { padding: 0; width: 100%; }
  .card, .stat-cell { border: .5pt solid #ccc; }
  .device-row__id-label { cursor: default; }
}
