/* ──────────────────────────────────────────────────────────────────────────────
   Tokenix — style.css
   Dark developer-tool aesthetic.
   Color palette:
     bg:       #0d1117  (GitHub dark)
     surface:  #161b22  (cards, inputs)
     surface2: #21262d  (hover states, table header)
     border:   #30363d
     text:     #e6edf3
     muted:    #8b949e
     accent:   #6366f1  (indigo)
     green:    #3fb950
     yellow:   #d29922
     red:      #f85149
──────────────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #21262d;
  --border:   #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --accent:   #6366f1;
  --accent-hover: #818cf8;
  --green:    #3fb950;
  --yellow:   #d29922;
  --red:      #f85149;
  --radius:   8px;
  --radius-lg: 12px;
  --shadow:   0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
  --font:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  background: rgba(13,17,23,.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.logo-bracket { color: var(--accent); }
.logo-name    { color: var(--text); }

.logo-badge {
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color .15s;
}

.nav-links a:hover { color: var(--text); }

.nav-pro {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 20px;
}

.accent {
  background: linear-gradient(135deg, #6366f1, #818cf8 60%, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 540px;
  margin: 0 auto 24px;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid;
}

.badge-green  { color: var(--green);  border-color: var(--green);  background: rgba(63,185,80,.1); }
.badge-yellow { color: var(--yellow); border-color: var(--yellow); background: rgba(210,153,34,.1); }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ── Input section ──────────────────────────────────────────────────────────── */
.input-section { padding-bottom: 40px; }

.input-card { padding: 0; overflow: hidden; }

/* Tabs */
.input-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 20px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

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

/* Tab content */
.tab-content { display: none; padding: 24px; }
.tab-content.active { display: block; }

/* Textarea */
.textarea-wrap { position: relative; margin-bottom: 16px; }

#text-input {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 14px 16px;
  outline: none;
  transition: border-color .15s;
}

#text-input:focus { border-color: var(--accent); }
#text-input::placeholder { color: var(--muted); }

.textarea-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.meta-sep { opacity: .4; }

/* Input actions */
.input-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-ghost:hover:not(:disabled) { border-color: var(--muted); color: var(--text); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.btn-icon:hover { color: var(--text); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover); }

/* ── Dropzone ───────────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,.05);
}

.drop-icon {
  color: var(--muted);
  margin-bottom: 16px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.drop-label {
  font-size: 1rem;
  margin-bottom: 8px;
}

.drop-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
  font-family: var(--mono);
}

/* File info strip */
.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text);
}

.file-info svg { flex-shrink: 0; color: var(--muted); }

.file-size-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-left: auto;
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--muted);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Error banner ───────────────────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1100px;
  margin: 0 auto 20px;
  padding: 14px 18px;
  background: rgba(248,81,73,.1);
  border: 1px solid rgba(248,81,73,.35);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 0.875rem;
}

.error-banner svg { flex-shrink: 0; }
.error-banner span { flex: 1; }

/* ── Results ────────────────────────────────────────────────────────────────── */
.results-section { padding-bottom: 60px; }

/* Summary bar */
.results-summary {
  display: flex;
  gap: 32px;
  padding: 20px 0 24px;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.mono { font-family: var(--mono); }

/* Provider filter pills */
.provider-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-pill {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}

.filter-pill:hover { border-color: var(--muted); color: var(--text); }

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Results table */
.table-wrap {
  overflow-x: auto;
  padding: 0;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.results-table thead {
  background: var(--surface2);
  position: sticky;
  top: 56px; /* below navbar */
  z-index: 10;
}

.results-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.th-hint {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  opacity: .7;
  margin-top: 1px;
}

.results-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(48,54,61,.6);
  vertical-align: middle;
}

.results-table tbody tr:hover { background: rgba(33,38,45,.6); }
.results-table tbody tr:last-child td { border-bottom: none; }

/* Provider separator row */
.provider-row td {
  background: var(--surface2);
  padding: 6px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

/* Model name cell */
.cell-model { min-width: 180px; }

.model-name {
  font-weight: 600;
  color: var(--text);
}

.model-provider-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.model-note {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  max-width: 260px;
  line-height: 1.4;
}

/* Token count cell */
.cell-tokens {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* Context bar cell */
.cell-context { min-width: 160px; }

.context-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-bar-bg {
  flex: 1;
  height: 5px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}

.context-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .4s cubic-bezier(.4,0,.2,1);
}

.context-bar-fill.warn  { background: var(--yellow); }
.context-bar-fill.over  { background: var(--red); }

.context-pct {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 46px;
  text-align: right;
}

/* Cost cells */
.cell-cost {
  font-family: var(--mono);
  font-size: 0.875rem;
  white-space: nowrap;
  color: var(--text);
}

.cost-tiny { color: var(--green); }      /* < $0.001 */
.cost-small { color: var(--text); }      /* < $0.10 */
.cost-medium { color: var(--yellow); }   /* < $1.00 */
.cost-large { color: var(--red); }       /* ≥ $1.00 */

/* Accuracy badge */
.accuracy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: help;
  white-space: nowrap;
}

.badge-exact {
  background: rgba(63,185,80,.12);
  color: var(--green);
  border: 1px solid rgba(63,185,80,.25);
}

.badge-estimated {
  background: rgba(210,153,34,.1);
  color: var(--yellow);
  border: 1px solid rgba(210,153,34,.25);
}

/* Exceeds context warning */
.fits-no {
  color: var(--red);
  font-size: 0.75rem;
  display: block;
  margin-top: 2px;
}

/* Table footnote */
.table-footnote {
  padding-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── How it works ───────────────────────────────────────────────────────────── */
.how-section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.how-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 36px;
  letter-spacing: -0.01em;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.how-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.how-icon {
  font-size: 1.75rem;
  margin-bottom: 14px;
  display: block;
}

.how-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.how-card p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

/* ── Pro section ────────────────────────────────────────────────────────────── */
.pro-section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg) 0%, rgba(99,102,241,.04) 100%);
}

.pro-header {
  text-align: center;
  margin-bottom: 48px;
}

.pro-chip {
  display: inline-block;
  background: rgba(99,102,241,.15);
  color: var(--accent-hover);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}

.pro-header h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.pro-header p { color: var(--muted); font-size: 1rem; }

.pro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.pro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color .2s, transform .2s;
}

.pro-card:hover {
  border-color: rgba(99,102,241,.4);
  transform: translateY(-2px);
}

.pro-icon { font-size: 1.75rem; margin-bottom: 14px; display: block; }

.pro-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 10px; }
.pro-card p  { color: var(--muted); font-size: 0.875rem; line-height: 1.7; }

.btn-notify {
  display: block;
  margin: 0 auto;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 36px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}

.btn-notify:hover { opacity: .88; transform: translateY(-1px); }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.875rem;
}

.footer-copy { color: var(--muted); font-size: 0.8rem; }

.footer-right {
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 480px;
  line-height: 1.5;
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1,4,9,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 440px;
  width: calc(100% - 48px);
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.modal h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 10px; }
.modal p  { color: var(--muted); font-size: 0.9rem; margin-bottom: 24px; }

.modal-form {
  display: flex;
  gap: 10px;
}

.modal-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
}

.modal-form input:focus { border-color: var(--accent); }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color .15s;
}

.modal-close:hover { color: var(--text); }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 48px 0 36px; }
  .results-summary { gap: 20px; }
  .summary-value { font-size: 1.25rem; }
  .modal-form { flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .nav-links { gap: 16px; }
  .how-grid, .pro-grid { grid-template-columns: 1fr; }
  .results-table th.col-context,
  .results-table td.col-context { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   PRO TOOLS — Format Cleaner & Smart Retrieval
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Pro tools section wrapper ───────────────────────────────────────────────── */
.pro-tools-section {
  padding: 0 0 60px;
}

.pro-tools-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.pro-tools-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.pro-chip-sm {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
}

/* ── Locked state (ENABLE_PAID_FEATURES=false) ─────────────────────────────── */
.pro-locked-banner {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  color: var(--muted);
}

.pro-locked-banner .lock-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: .5;
}

.pro-locked-banner h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.pro-locked-banner p {
  font-size: 0.875rem;
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.6;
}

.pro-locked-banner code {
  font-size: 0.82rem;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--accent);
}

/* ── Upgrade CTA banner (ENABLE_BILLING=true, not yet subscribed) ─────────── */
.pro-upgrade-banner {
  background: linear-gradient(135deg, rgba(99,102,241,.08) 0%, rgba(139,92,246,.08) 100%);
  border: 1px solid rgba(99,102,241,.25);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.upgrade-left {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex: 1;
}

.pro-upgrade-banner .lock-icon {
  font-size: 2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.pro-upgrade-banner h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.pro-upgrade-banner > .upgrade-left > div > p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.upgrade-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upgrade-features li {
  font-size: 0.82rem;
  color: var(--muted);
}

.upgrade-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.btn-upgrade {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
}

.btn-upgrade:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-upgrade:active:not(:disabled) { transform: translateY(0); }
.btn-upgrade:disabled { opacity: .6; cursor: default; }

.upgrade-error {
  font-size: 0.8rem;
  color: var(--red);
  text-align: center;
  max-width: 200px;
}

@media (max-width: 640px) {
  .pro-upgrade-banner { flex-direction: column; gap: 20px; }
  .upgrade-right { width: 100%; }
  .btn-upgrade { width: 100%; }
}

/* ── Two-column grid for tools ───────────────────────────────────────────────── */
.pro-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 800px) {
  .pro-tools-grid { grid-template-columns: 1fr; }
}

/* ── Individual tool card ────────────────────────────────────────────────────── */
.pro-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pro-tool-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.pro-tool-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.pro-tool-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.pro-tool-card-header p {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.accuracy-note {
  font-size: 0.72rem;
  color: var(--yellow);
  margin-top: 3px;
  display: block;
}

.pro-tool-body {
  padding: 20px;
}

/* ── Mini dropzone (compact version for pro tools) ───────────────────────────── */
.mini-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 12px;
  background: var(--bg);
}

.mini-dropzone:hover, .mini-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,.04);
}

.mini-dropzone-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.mini-dropzone-label strong {
  color: var(--accent);
  cursor: pointer;
}

.mini-dropzone-hint {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: .7;
  margin-top: 4px;
}

/* ── Query textarea (retriever) ──────────────────────────────────────────────── */
.query-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 10px 14px;
  outline: none;
  resize: vertical;
  min-height: 72px;
  margin-bottom: 12px;
  transition: border-color .15s;
}

.query-input:focus { border-color: var(--accent); }
.query-input::placeholder { color: var(--muted); }

/* ── Results panels ──────────────────────────────────────────────────────────── */
.pro-result {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* Savings summary bar */
.savings-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(63,185,80,.07);
  border: 1px solid rgba(63,185,80,.2);
  border-radius: var(--radius);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.savings-summary .savings-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.savings-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.savings-value {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green);
}

.savings-value.neutral { color: var(--muted); }

/* Comparison mini-table */
.cmp-table-wrap {
  overflow-x: auto;
  margin-bottom: 14px;
}

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.cmp-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cmp-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(48,54,61,.5);
  font-family: var(--mono);
  font-size: 0.77rem;
  white-space: nowrap;
}

.cmp-table tr:last-child td { border-bottom: none; }

.cmp-table .td-model {
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text);
}

.cmp-table .td-saved { color: var(--green); font-weight: 600; }
.cmp-table .td-money { color: var(--green); }
.cmp-table .td-neutral { color: var(--muted); }

/* Show/hide model rows toggle */
.cmp-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Clean text output */
.clean-text-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  margin-bottom: 10px;
}

.clean-text-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Chunk items (retriever) */
.chunks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  max-height: 340px;
  overflow-y: auto;
}

.chunk-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px;
}

.chunk-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.chunk-rank {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.chunk-score {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.chunk-text {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Btn small variant */
.btn-sm {
  font-size: 0.78rem;
  padding: 6px 14px;
}

/* Top-K selector */
.topk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.topk-row label { white-space: nowrap; }

.topk-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 0.82rem;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

.topk-select:focus { border-color: var(--accent); }

/* Pro tool loading spinner (inline) */
.pro-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
