/* AEAT Sync — Developer console UI */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #c9cdd4;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #0891b2;
  --info-light: #ecfeff;

  /* Dark palette (sidebar + code blocks) */
  --dark: #0f1117;
  --dark-2: #161b22;
  --dark-3: #21262d;
  --dark-4: #30363d;
  --dark-text: #e6edf3;
  --dark-muted: #8b949e;
  --dark-accent: #58a6ff;
  --dark-green: #3fb950;

  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --mono: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

/* ── Reset & base ────────────────────────────────────────────────────────── */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

ul { list-style: none; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
  width: 224px;
  background: var(--dark);
  color: var(--dark-text);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--dark-4);
}
.sidebar-logo {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}
.sidebar-brand-tag {
  font-size: 11px;
  color: var(--dark-muted);
  font-weight: 400;
  line-height: 1;
  margin-top: 1px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}
.sidebar-nav-label {
  padding: 12px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dark-muted);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--dark-muted);
  font-size: 13.5px;
  border-radius: 0;
  transition: color .12s, background .12s;
  position: relative;
}
.sidebar-nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .7;
}
.sidebar-nav a:hover {
  color: var(--dark-text);
  background: var(--dark-3);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: #fff;
  background: var(--dark-3);
  font-weight: 500;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--dark-4);
}
.sidebar-user {
  font-size: 12px;
  color: var(--dark-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.sidebar-footer a {
  font-size: 12px;
  color: var(--dark-muted);
  display: inline-block;
}
.sidebar-footer a:hover { color: var(--dark-text); text-decoration: none; }

/* ── Main content ────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  padding: 28px 36px;
  min-width: 0;
  max-width: 1080px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.card-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.card-body { padding: 20px; }
.card-body + .card-body { padding-top: 0; }

/* ── Grid helpers ────────────────────────────────────────────────────────── */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ── Stats ───────────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 4px; font-weight: 500; }

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }
td a { font-weight: 500; }

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-accepted  { background: #dcfce7; color: #15803d; }
.badge-accepted::before  { background: #16a34a; }
.badge-delivered { background: #dcfce7; color: #15803d; }
.badge-delivered::before { background: #16a34a; }
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-success::before   { background: #16a34a; }
.badge-rejected  { background: #fee2e2; color: #b91c1c; }
.badge-rejected::before  { background: #dc2626; }
.badge-failed    { background: #fee2e2; color: #b91c1c; }
.badge-failed::before    { background: #dc2626; }
.badge-danger    { background: #fee2e2; color: #b91c1c; }
.badge-danger::before    { background: #dc2626; }
.badge-pending   { background: #fef9c3; color: #92400e; }
.badge-pending::before   { background: #d97706; }
.badge-warning   { background: #fef9c3; color: #92400e; }
.badge-warning::before   { background: #d97706; }
.badge-submitted { background: #dbeafe; color: #1d4ed8; }
.badge-submitted::before { background: #2563eb; }
.badge-info      { background: #cffafe; color: #0e7490; }
.badge-info::before      { background: #0891b2; }
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-active::before    { background: #16a34a; }
.badge-inactive  { background: #f1f5f9; color: #6b7280; }
.badge-inactive::before  { background: #9ca3af; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
  font-family: inherit;
  line-height: 1;
}
.btn:disabled,
.btn.loading { opacity: .6; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; text-decoration: none; color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--bg); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-full { width: 100%; }

/* Loading spinner inside button */
.btn.htmx-request::after,
.btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* htmx indicators */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 5px;
  font-size: 13px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Alerts / flash ──────────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #86efac; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light); color: #0e7490; border: 1px solid #67e8f9; }

/* ── API Key block ───────────────────────────────────────────────────────── */

.key-block {
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.key-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dark-muted);
  margin-bottom: 8px;
}
.key-value {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--dark-green);
  background: transparent;
  border: none;
  outline: none;
  flex: 1;
  min-width: 0;
  padding: 0;
  cursor: text;
  user-select: all;
}
.key-copy-btn {
  background: var(--dark-4);
  color: var(--dark-text);
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s;
}
.key-copy-btn:hover { background: #484f58; }
.key-copy-btn.copied { background: #155724; color: #d1e7dd; }

/* ── Code blocks / integration tabs ─────────────────────────────────────── */

.code-tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0;
}
.code-tab-bar {
  display: flex;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}
.code-tab-btn {
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition: color .12s;
}
.code-tab-btn:hover { color: var(--text); }
.code-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.code-tab-panel { display: none; position: relative; }
.code-tab-panel.active { display: block; }
.code-block {
  background: var(--dark);
  color: #e6edf3;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 18px 20px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  border-radius: 0;
}
.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--dark-4);
  color: var(--dark-muted);
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.code-copy-btn:hover { background: #484f58; color: var(--dark-text); }
.code-copy-btn.copied { background: #0d3321; color: var(--dark-green); }

/* Syntax highlights (minimal) */
.tok-keyword { color: #ff7b72; }
.tok-string  { color: #a5d6ff; }
.tok-comment { color: #8b949e; }
.tok-key     { color: var(--dark-accent); }
.tok-val     { color: #79c0ff; }

/* ── Test invoice result ─────────────────────────────────────────────────── */

.test-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.test-result.success {
  background: var(--success-light);
  border: 1px solid #86efac;
  color: #166534;
}
.test-result.error {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  color: #991b1b;
}
.test-result-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.test-result-field { font-weight: 600; margin-right: 4px; }

/* ── Timeline ────────────────────────────────────────────────────────────── */

.timeline { padding: 4px 0; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  position: relative;
}
.timeline-item + .timeline-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: -8px;
  height: 8px;
  width: 1px;
  background: var(--border);
}
.timeline-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0;
  margin-top: 3px;
}
.timeline-body {}
.timeline-event { font-weight: 500; font-size: 13px; }
.timeline-time  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */

.pagination { display: flex; gap: 4px; margin-top: 20px; flex-wrap: wrap; }
.pagination a,
.pagination span {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text);
}
.pagination a:hover { background: var(--bg); text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .dots { border: none; color: var(--text-muted); padding: 5px 4px; }

/* ── Auth / login page ───────────────────────────────────────────────────── */

.auth-page {
  display: flex;
  min-height: 100vh;
}
.auth-aside {
  width: 44%;
  background: var(--dark);
  padding: 60px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 48px;
}
.auth-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
}
.auth-logo-name { font-size: 18px; font-weight: 700; color: #fff; }
.auth-headline {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 12px;
}
.auth-sub {
  font-size: 15px;
  color: var(--dark-muted);
  margin-bottom: 32px;
  line-height: 1.5;
}
.auth-features { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.45;
}
.auth-feat-icon {
  width: 22px;
  height: 22px;
  background: rgba(37,99,235,.25);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.auth-feat-icon svg { width: 12px; height: 12px; color: var(--dark-accent); }

.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  background: var(--bg);
  gap: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.auth-tab-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-family: inherit;
  transition: color .12s;
}
.auth-tab-btn:hover { color: var(--text); }
.auth-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-tab-panel { display: none; }
.auth-tab-panel.active { display: block; }

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  position: relative;
  margin: 20px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ── Auth aside nav (browse links) ──────────────────────────────────────── */

.auth-aside-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 32px;
  margin-bottom: 4px;
}
.auth-aside-nav a {
  color: rgba(255,255,255,.5);
  font-size: 13px;
  text-decoration: none;
  padding: 9px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  transition: color .12s;
}
.auth-aside-nav a:last-child { border-bottom: none; }
.auth-aside-nav a:hover { color: rgba(255,255,255,.9); }
.auth-aside-nav a svg { flex-shrink: 0; opacity: .6; }

/* ── Auth explore cards (below auth-card on right) ───────────────────────── */

.auth-explore {
  width: 100%;
  max-width: 420px;
}
.auth-explore-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.auth-explore-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.auth-explore-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  line-height: 1.35;
  transition: border-color .12s, box-shadow .12s, color .12s;
}
.auth-explore-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  color: var(--primary);
}
.auth-explore-card-icon {
  width: 34px;
  height: 34px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color .12s;
}
.auth-explore-card:hover .auth-explore-card-icon { color: var(--primary); }

@media (max-width: 480px) {
  .auth-explore-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Onboarding ──────────────────────────────────────────────────────────── */

.onboarding-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 0;
}
.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.step-bar-item {
  display: flex;
  align-items: center;
  flex: 1;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  z-index: 1;
}
.step-num.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.step-num.done   { border-color: var(--success); background: var(--success); color: #fff; }
.step-bar-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
}
.step-bar-line.done { background: var(--success); }

/* ── Webhook/settings specific ───────────────────────────────────────────── */

.endpoint-url {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Empty states ────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 28px; margin-bottom: 12px; opacity: .5; }
.empty-state p   { font-size: 13px; }

/* ── Documentation page ─────────────────────────────────────────────────── */
.docs-intro { font-size: 14px; line-height: 1.7; color: var(--text); max-width: 720px; }
.docs-intro p { margin: 0; }

/* Feature tiles */
.docs-feature-tile {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
}
.docs-tile-icon {
  width: 36px; height: 36px; background: var(--primary-light);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--primary); margin-bottom: 10px;
}
.docs-tile-heading { font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--text); }

/* Step flow */
.docs-flow { display: flex; flex-direction: column; }
.docs-step { display: flex; gap: 16px; align-items: flex-start; }
.docs-step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.docs-step-body { flex: 1; padding-bottom: 4px; }
.docs-step-body h4 { font-size: 14px; font-weight: 600; margin: 4px 0 8px; color: var(--text); }
.docs-step-body p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0 0 10px; }
.docs-step-connector {
  width: 1px; height: 24px;
  background: var(--border); margin: 4px 0 4px 15px;
}
.docs-code-example {
  background: var(--dark); border-radius: 8px;
  padding: 12px 14px; margin-top: 8px;
}
.docs-code-label {
  display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--dark-text);
  margin-bottom: 6px; opacity: .6;
}
.docs-code-example pre {
  margin: 0; font-family: var(--mono); font-size: 12px;
  color: #e2e8f0; line-height: 1.6; white-space: pre-wrap; word-break: break-all;
}
.docs-info-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.docs-info-chip {
  background: var(--primary-light); color: var(--primary);
  border: 1px solid #bfdbfe; border-radius: 20px;
  padding: 3px 10px; font-size: 12px; font-weight: 500;
}
.docs-status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.docs-status-pill {
  display: flex; align-items: center; gap: 5px;
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 500;
}
.docs-status-pill.success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.docs-status-pill.warning { background: #fffbeb; color: #d97706;    border: 1px solid #fde68a; }
.docs-status-pill.danger  { background: #fef2f2; color: var(--danger);  border: 1px solid #fecaca; }

/* Integration flow */
.docs-integration-flow { display: flex; flex-direction: column; gap: 0; }
.docs-int-step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.docs-int-step-highlight {
  background: var(--primary-light); border-color: #bfdbfe;
}
.docs-int-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.docs-int-step-highlight .docs-int-icon {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.docs-int-step strong { font-size: 13px; color: var(--text); display: block; margin-bottom: 3px; }
.docs-int-arrow {
  text-align: center; color: var(--border); font-size: 18px;
  line-height: 1; padding: 4px 0 4px 24px;
}

/* Reference tables / FAQ */
.docs-ref-row {
  background: var(--dark); color: #e2e8f0;
  border-radius: 8px; padding: 10px 14px;
  font-size: 12px; font-family: var(--mono);
}
.docs-status-table { display: flex; flex-direction: column; gap: 10px; }
.docs-status-row-item { display: flex; align-items: center; gap: 10px; }
.docs-status-row-item .badge { flex-shrink: 0; }
.docs-faq { display: flex; flex-direction: column; gap: 0; }
.docs-faq-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.docs-faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.docs-faq-item h5 { font-size: 13px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.docs-faq-item p  { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.55; }
.docs-help-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.docs-help-list li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
}
.docs-help-list svg { flex-shrink: 0; margin-top: 2px; }

/* ── Webhook guide card ──────────────────────────────────────────────────── */
.webhook-guide-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  color: var(--primary);
}
.webhook-guide-heading {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 0 0 6px;
}
.webhook-steps {
  margin: 8px 0 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px; color: var(--text-muted); line-height: 1.55;
}
.webhook-steps li strong { color: var(--text); }
.webhook-steps a { color: var(--primary); }
.webhook-checklist {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 7px;
  font-size: 13px; color: var(--text-muted);
}
.webhook-checklist li {
  display: flex; align-items: flex-start; gap: 7px; line-height: 1.5;
}
.webhook-checklist svg { flex-shrink: 0; margin-top: 3px; stroke: var(--success); }
.info-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.info-box strong { color: var(--text); }
.divider {
  border: none; border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Language toggle ────────────────────────────────────────────────────── */
.lang-toggle { display: flex; gap: 4px; margin-top: 8px; }
.lang-btn {
  background: none;
  border: 1px solid var(--dark-4);
  border-radius: 4px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  color: var(--dark-muted);
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
  letter-spacing: .5px;
  line-height: 1.6;
}
.lang-btn:hover { background: var(--dark-3); color: var(--dark-text); }
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* i18n CSS-driven visibility */
html.lang-es [data-lang="en"] { display: none !important; }
html:not(.lang-es) [data-lang="es"] { display: none !important; }

/* ── Utility ─────────────────────────────────────────────────────────────── */

.mono    { font-family: var(--mono); font-size: 12.5px; }
.mono-sm { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-sm      { font-size: 12px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.p-0   { padding: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  /* Auth page: stack aside above form */
  .auth-page { flex-direction: column; }
  .auth-aside {
    width: 100%;
    padding: 28px 24px 22px;
    justify-content: flex-start;
  }
  .auth-logo { margin-bottom: 18px; }
  .auth-hero-badge { margin-bottom: 14px; font-size: 12px; }
  .auth-headline-large { font-size: 22px; margin-bottom: 14px; }
  .auth-compliance-note { font-size: 13px; margin-bottom: 14px; }
  /* Hide long content that doesn't fit in a compact banner */
  .auth-features-v2 { display: none; }
  .auth-aside-nav { display: none; }
  .auth-aside .lang-toggle { margin-top: 16px; padding-top: 0; }
  .auth-main { padding: 28px 16px; justify-content: flex-start; }

  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
/* Ensure mobile topbar hidden on tablets where sidebar is always visible */
@media (min-width: 641px) {
  .mobile-topbar { display: none !important; }
  .mobile-nav-overlay { display: none !important; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }

  /* Further compress the auth aside on small phones */
  .auth-aside { padding: 20px 16px 18px; }
  .auth-headline-large { font-size: 19px; }
  .auth-compliance-note { display: none; }
  .auth-main { padding: 20px 16px; }
  .auth-card { padding: 24px 18px; }
}

/* ── Mobile navigation drawer ────────────────────────────────────────────── */

.mobile-topbar {
  display: none;
}

@media (max-width: 640px) {
  /* Reset sidebar hide — replaced by drawer */
  .sidebar { display: flex; }

  /* Dashboard layout stacks: topbar + content */
  .layout { flex-direction: column; }
  .main { padding: 12px 14px; padding-top: 56px; }

  /* Fixed top bar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 50px;
    background: var(--dark);
    border-bottom: 1px solid var(--dark-4);
    padding: 0 14px;
    z-index: 200;
  }
  .mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mobile-menu-btn {
    width: 36px; height: 36px;
    background: none;
    border: none;
    color: var(--dark-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
  }
  .mobile-menu-btn:hover { background: var(--dark-3); }

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }

  /* Overlay backdrop */
  .mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 299;
  }
  .mobile-nav-overlay.visible { display: block; }

  /* Auth page adjustments */
  .auth-aside { padding: 20px 16px 18px; }
  .auth-headline-large { font-size: 19px; }
  .auth-compliance-note { display: none; }
  .auth-main { padding: 20px 16px; }
  .auth-card { padding: 24px 18px; }
}

/* ── SEO / article helpers ───────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dark-muted); margin-bottom: 8px; }

/* ══════════════════════════════════════════════════════════════════════
   UI REDESIGN — conversion-focused components
   ══════════════════════════════════════════════════════════════════════ */

/* ── Landing hero panel ──────────────────────────────────────────────────── */
.auth-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  letter-spacing: .2px;
  margin-bottom: 20px;
}
.auth-hero-badge .badge-dot {
  width: 6px; height: 6px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
}
.auth-headline-large {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.8px;
  color: #fff;
  margin-bottom: 16px;
}
@media (max-width: 1100px) { .auth-headline-large { font-size: 26px; } }
.auth-compliance-note {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: rgba(255,255,255,.75);
  line-height: 1.55;
  margin-bottom: 28px;
}
.auth-compliance-note strong { color: #fff; }
.auth-features-v2 { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.auth-features-v2 li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: rgba(255,255,255,.8);
  font-size: 13.5px;
  line-height: 1.5;
}
.auth-feat-check {
  width: 20px; height: 20px;
  background: rgba(74,222,128,.15);
  border: 1px solid rgba(74,222,128,.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.auth-feat-check svg { color: #4ade80; }
.auth-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.auth-card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Entry screen (post-login "how to send invoices") ────────────────────── */
.entry-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}
.entry-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  display: block;
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.entry-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(37,99,235,.12);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--text);
}
.entry-card-primary {
  border-color: var(--primary);
  background: var(--primary-light);
}
.entry-card-primary:hover {
  background: #dbeafe;
  box-shadow: 0 4px 20px rgba(37,99,235,.18);
}
.entry-card-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.entry-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--primary);
}
.entry-card-primary .entry-card-icon {
  background: rgba(37,99,235,.1);
}
.entry-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
}
.entry-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}
.entry-card-arrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.entry-section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Upload zone (production) ────────────────────────────────────────────── */
.upload-page-wrap { max-width: 680px; }
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  background: var(--surface);
}
.upload-zone:hover,
.upload-zone.drag-active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-zone-icon {
  width: 56px; height: 56px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary);
}
.upload-zone h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}
.upload-zone p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
}
.upload-zone-hint {
  font-size: 12px;
  color: var(--text-subtle);
  background: var(--bg);
  border: 1px solid var(--border);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
}
.upload-file-selected {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 13px;
}
.upload-file-selected.visible { display: flex; }
.upload-file-icon { color: var(--primary); flex-shrink: 0; }
.upload-file-name { font-weight: 600; flex: 1; }
.upload-file-size { color: var(--text-muted); font-size: 12px; }

/* Upload progress stages */
.upload-stages {
  display: none;
  flex-direction: column;
  gap: 0;
  margin-top: 24px;
}
.upload-stages.visible { display: flex; }
.upload-stage {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 8px;
  transition: background .2s;
}
.upload-stage-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, border-color .2s;
}
.upload-stage.done .upload-stage-icon {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.upload-stage.active .upload-stage-icon {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.upload-stage-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.upload-stage.active .upload-stage-label { color: var(--text); font-weight: 600; }
.upload-stage.done  .upload-stage-label  { color: var(--success); }
.upload-stage-spin {
  width: 14px; height: 14px;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}
.upload-stage.active .upload-stage-spin { display: block; }
.upload-stage.done   .upload-stage-spin { display: none; }

/* ── Review page ─────────────────────────────────────────────────────────── */
.review-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .review-layout { grid-template-columns: 1fr; }
}
.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}
.status-banner-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.status-banner-msg { flex: 1; }
.status-banner-sub { font-size: 12px; font-weight: 400; color: inherit; opacity: .8; }
.status-banner.ready {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}
.status-banner.ready .status-banner-icon { background: var(--success); color: #fff; }
.status-banner.warn {
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  color: #92400e;
}
.status-banner.warn .status-banner-icon { background: var(--warning); color: #fff; }
.status-banner.error-state {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  color: #991b1b;
}
.status-banner.error-state .status-banner-icon { background: var(--danger); color: #fff; }
.review-ocr-panel {
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: 12px;
  overflow: hidden;
}
.review-ocr-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--dark-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.review-ocr-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dark-muted);
}
.review-ocr-pre {
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow-y: auto;
  line-height: 1.7;
  margin: 0;
}
.review-form-section { margin-bottom: 24px; }
.review-form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-field-error .form-control {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.field-error-msg {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}
.items-table-wrap { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.items-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.items-table td:first-child { padding-left: 10px; }
.items-table td:last-child { width: 40px; text-align: center; }
.items-table tr:last-child td { border-bottom: none; }
.items-table .form-control { padding: 6px 8px; font-size: 12.5px; }
.btn-remove-item {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  font-size: 16px;
  font-family: inherit;
  transition: color .1s, background .1s;
}
.btn-remove-item:hover { color: var(--danger); background: var(--danger-light); }

/* ── Scans history table ──────────────────────────────────────────────────── */
.scan-status-processing { background: var(--warning-light); color: #92400e; }
.scan-status-processing::before { background: var(--warning); }
.scan-status-ready { background: #dbeafe; color: #1d4ed8; }
.scan-status-ready::before { background: var(--primary); }
.scan-status-sent,
.scan-status-confirmed { background: #dcfce7; color: #15803d; }
.scan-status-sent::before, .scan-status-confirmed::before { background: var(--success); }
.scan-status-failed { background: #fee2e2; color: #b91c1c; }
.scan-status-failed::before { background: var(--danger); }
.scan-status-uploaded { background: #f1f5f9; color: #6b7280; }
.scan-status-uploaded::before { background: #9ca3af; }

/* ── Dashboard simplified ────────────────────────────────────────────────── */
.dash-stats-v2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dash-stat-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.dash-stat-v2-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
}
.dash-stat-v2-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Compliance deadline banner ──────────────────────────────────────────── */
.compliance-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 28px;
}
.compliance-banner-icon {
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.compliance-banner-body { flex: 1; }
.compliance-banner-body h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.compliance-banner-body p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Mobile responsive extras ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .entry-cards { grid-template-columns: 1fr; }
  .dash-stats-v2 { grid-template-columns: 1fr 1fr; }
  .upload-zone { padding: 36px 20px; }
}
@media (max-width: 480px) {
  .dash-stats-v2 { grid-template-columns: 1fr 1fr; }
  .auth-headline-large { font-size: 22px; }
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--dark-muted); }
.docs-list { padding-left: 20px; line-height: 1.8; color: var(--text-muted, var(--dark-muted)); font-size: 14px; }
.docs-list li { margin-bottom: 4px; }

/* ── Activation Layer ────────────────────────────────────────────────────── */

.activation-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.activation-strip-body { flex: 1; min-width: 0; }
.activation-strip-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: 3px;
}
.activation-strip-sub {
  font-size: 12px;
  color: var(--dark-muted);
}
.activation-strip-result {
  min-width: 0;
  flex: 1;
}
.activation-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.htmx-request .activation-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Simulator */
.simulator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.simulator-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.simulator-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.simulator-textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  background: var(--dark);
  color: var(--dark-text);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 160px;
  resize: vertical;
}
.simulator-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.simulator-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
#simulate-result { min-height: 0; }

/* Result cards */
.activation-result {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 10px;
}
.activation-result-ok {
  background: var(--success-light);
  border-color: #86efac;
}
.activation-result-fail {
  background: var(--danger-light);
  border-color: #fca5a5;
}
.activation-result-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.activation-result-ok .activation-result-header svg { color: var(--success); }
.activation-result-fail .activation-result-header svg { color: var(--danger); }
.activation-result-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.activation-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.activation-result-label {
  color: var(--text-muted);
  min-width: 70px;
  flex-shrink: 0;
}
.activation-result-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}
.activation-result-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Copy button */
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transition: background .15s, color .15s;
}
.copy-btn:hover { background: var(--bg); color: var(--primary); }
.copy-btn.copied { color: var(--success); border-color: #86efac; }

/* Next step hint */
.next-step-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Activity log */
.activity-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.activity-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.activity-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.api-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.api-log-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border);
}
.api-log-row td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.api-log-row:last-child td { border-bottom: none; }
.api-log-ok td { background: transparent; }
.api-log-fail td { background: var(--danger-light); }
.api-log-endpoint { font-family: var(--mono); color: var(--text); font-size: 11px; }

/* Webhook inline test result */
.wh-test-result {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
}
.wh-test-ok { color: var(--success); background: var(--success-light); }
.wh-test-fail { color: var(--danger); background: var(--danger-light); }

/* API key copy row */
.api-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.api-key-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }




