/* ═══════════════════════════════════════════════════════════
   AGENTFORMS — Consolidated Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────
   1. RESET + DESIGN TOKENS
   ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5f5f5;
    --bg-card: #fff;
    --bg-elevated: #f9f9f9;
    --text: #1a1a2e;
    --text-muted: #666;
    --text-dim: #999;
    --accent: #10b981;
    --accent-bright: #059669;
    --accent-dim: rgba(16, 185, 129, 0.08);
    --accent-glow: rgba(16, 185, 129, 0.15);
    --border: #e5e7eb;
    --border-light: #ddd;
    --success: #22c55e;
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ───────────────────────────────────────────────────────────
   2. LAYOUT
   ─────────────────────────────────────────────────────────── */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.main-wrapper {
    flex: 1 0 auto;
}

/* ───────────────────────────────────────────────────────────
   3. NAVIGATION
   ─────────────────────────────────────────────────────────── */
nav {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 50;
    width: 100%;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    font-family: var(--font);
}

.logo span {
    color: var(--accent);
}

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

.nav-links > a:not(.btn):not(.logo) {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
    font-family: var(--font);
}

.nav-links > a:not(.btn):not(.logo):hover {
    color: var(--text);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: var(--font);
}

.btn-logout:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--accent);
}

.user-email {
    font-size: 13px;
    color: var(--text-muted);
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    line-height: 0;
}

.nav-hamburger svg {
    display: block;
}

.nav-hamburger svg path {
    stroke: var(--text);
    stroke-width: 2;
    stroke-linecap: round;
}

/* ───────────────────────────────────────────────────────────
   4. BUTTONS
   ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 24px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    font-family: var(--font);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover {
    background: var(--accent-bright);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-light);
    color: var(--text);
    box-shadow: none;
}

.btn-outline:hover {
    border-color: #bbb;
    color: var(--text);
    background: rgba(0, 0, 0, 0.02);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    line-height: 1.4;
}

/* ───────────────────────────────────────────────────────────
   5. FORMS
   ─────────────────────────────────────────────────────────── */
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    cursor: pointer;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="search"],
input[type="tel"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
select,
textarea,
.form-control {
    margin: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    background: #fafafa;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    min-height: 42px;
    box-sizing: border-box;
    font-family: var(--font);
    width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
select:focus,
textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
input[type="url"]::placeholder,
input[type="date"]::placeholder,
input[type="search"]::placeholder,
input[type="tel"]::placeholder,
input[type="time"]::placeholder,
input[type="datetime-local"]::placeholder,
input[type="month"]::placeholder,
input[type="week"]::placeholder,
textarea::placeholder,
.form-control::placeholder {
    color: var(--text-dim);
    opacity: 1;
}

/* Color input */
input[type="color"] {
    padding: 2px;
    height: 42px;
    width: 42px;
    cursor: pointer;
    border-radius: 6px;
}

/* File input */
input[type="file"] {
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--font);
    border: 1.5px dashed var(--border);
    border-radius: 6px;
    background: #fafafa;
    min-height: 42px;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Range input */
input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Disabled inputs */
input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
}

/* Checkbox + Radio */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* Select arrow */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Textarea */
textarea {
    min-height: 80px;
    resize: vertical;
}

/* Form groups */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group .form-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Inline form */
.form-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
}

/* ───────────────────────────────────────────────────────────
   6. CARDS
   ─────────────────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.card .description {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Card header */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    margin-bottom: 0;
}

/* Card footer */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Empty state */
.card.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

/* ───────────────────────────────────────────────────────────
   7. ALERTS
   ─────────────────────────────────────────────────────────── */
.success,
.alert-success {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.error,
.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.info,
.alert-info {
    background: #dbeafe;
    color: #1e40af;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.warning,
.alert-warning {
    background: #fef3c7;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ───────────────────────────────────────────────────────────
   8. TOGGLES
   ─────────────────────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 14px;
}

.toggle-label .label-title {
    font-weight: 600;
}

.toggle-label .label-desc {
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ───────────────────────────────────────────────────────────
   9. DANGER ZONE
   ─────────────────────────────────────────────────────────── */
.danger-zone {
    border: 1px solid #fecaca;
}

.danger-zone h2 {
    color: #dc3545;
}

/* ───────────────────────────────────────────────────────────
   10. USER INFO
   ─────────────────────────────────────────────────────────── */
.user-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details .name {
    font-weight: 600;
    font-size: 16px;
}

.user-details .email {
    color: #666;
    font-size: 13px;
    margin-top: 2px;
}

.user-details .tier {
    display: inline-block;
    margin-top: 4px;
}

/* ───────────────────────────────────────────────────────────
   11. MODAL
   ─────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

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

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn-outline {
    background: white;
}

/* ───────────────────────────────────────────────────────────
   12. DASHBOARD
   ─────────────────────────────────────────────────────────── */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.dashboard-header h1 {
    font-size: 24px;
    font-weight: 700;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

/* Data list */
.data-list {
    list-style: none;
    padding: 0;
}

.data-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.data-list li:last-child {
    border-bottom: none;
}

/* ── Dashboard Layout (user_dashboard.html) ────────────────── */
.dashboard {
    padding: 32px 0 64px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.dashboard-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-muted);
}

.tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--accent-dim);
    color: var(--accent-bright);
}

/* Stats */
.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Magic Link Banner */
.magic-link-banner {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.magic-link-banner .banner-text {
    flex: 1;
    min-width: 200px;
}

.magic-link-banner .banner-text h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--text);
}

.magic-link-banner .banner-text p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.magic-link-banner label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    margin: 0;
}

/* Referral Card */
.referral-card {
    background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(16, 185, 129, 0.03) 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.referral-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.referral-info .ref-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.referral-info .ref-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

.referral-info .ref-text strong {
    color: var(--accent-bright);
}

.ref-code {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-elevated);
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    letter-spacing: 0.05em;
    user-select: all;
}

/* Dashboard Sections */
.dash-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 24px;
    overflow: hidden;
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.dash-section-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.dash-section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dash-section-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* Dashboard Tables */
.dash-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.dash-table thead th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.dash-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

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

.dash-table tbody tr:hover {
    background: var(--bg-elevated);
}

/* Column widths — Forms table */
.dash-table.forms-table thead th:nth-child(1),
.dash-table.forms-table tbody td:nth-child(1) { width: 25%; }
.dash-table.forms-table thead th:nth-child(2),
.dash-table.forms-table tbody td:nth-child(2) { width: 20%; }
.dash-table.forms-table thead th:nth-child(3),
.dash-table.forms-table tbody td:nth-child(3) { width: 25%; }
.dash-table.forms-table thead th:nth-child(4),
.dash-table.forms-table tbody td:nth-child(4) { width: 15%; }
.dash-table.forms-table thead th:nth-child(5),
.dash-table.forms-table tbody td:nth-child(5) { width: 15%; }

/* Column widths — Submissions table */
.dash-table.submissions-table thead th:nth-child(1),
.dash-table.submissions-table tbody td:nth-child(1) { width: 20%; }
.dash-table.submissions-table thead th:nth-child(2),
.dash-table.submissions-table tbody td:nth-child(2) { width: 15%; }
.dash-table.submissions-table thead th:nth-child(3),
.dash-table.submissions-table tbody td:nth-child(3) { width: 25%; }
.dash-table.submissions-table thead th:nth-child(4),
.dash-table.submissions-table tbody td:nth-child(4) { width: 30%; white-space: normal; }
.dash-table.submissions-table thead th:nth-child(5),
.dash-table.submissions-table tbody td:nth-child(5) { width: 10%; }

/* Table cells */
.cell-form-name {
    font-weight: 500;
    color: var(--text);
}

.cell-token {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cell-token .token {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--bg-elevated);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-token .copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 2px;
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1;
}

.cell-token .copy-btn:hover {
    color: var(--accent);
}

.cell-email {
    color: var(--text-muted);
    font-size: 13px;
}

.cell-date {
    color: var(--text-muted);
    font-size: 13px;
}

.cell-message {
    color: var(--text);
}

.cell-message .expand-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    margin-left: 4px;
    font-family: var(--font);
}

.cell-message .expand-btn:hover {
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* API Keys Section */
.api-keys-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.api-keys-section h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

/* ───────────────────────────────────────────────────────────
   13. TABLES
   ─────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f8f8;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

/* ───────────────────────────────────────────────────────────
   14. BADGES
   ─────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ───────────────────────────────────────────────────────────
   15. SECTIONS + FOOTER
   ─────────────────────────────────────────────────────────── */
section {
    padding: 80px 0;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 16px;
    font-family: var(--font);
}

.section-label::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.5;
}

.section-title {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.15;
}

.section-sub {
    font-size: 17px;
    color: var(--text-muted);
    max-width: 520px;
    line-height: 1.5;
}

.section-header {
    margin-bottom: 48px;
}

.section-header.center {
    text-align: center;
}

.section-header.center .section-label {
    justify-content: center;
}

.section-header.center .section-sub {
    margin: 0 auto;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    flex-shrink: 0;
}

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

.footer-copy {
    font-size: 13px;
    color: var(--text-dim);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-dim);
    text-decoration: none;
}

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

/* ───────────────────────────────────────────────────────────
   15b. LANDING PAGE
   ─────────────────────────────────────────────────────────── */

/* Hero */
.hero {
    padding: 80px 0 60px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.08;
    margin-bottom: 16px;
    color: var(--text);
}

.hero .accent {
    color: var(--accent);
}

.hero-sub {
    font-size: clamp(16px, 2vw, 19px);
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.hero-note {
    font-size: 13px;
    color: var(--text-dim);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-dim);
    margin-bottom: 24px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* Code Preview */
.code-preview {
    background: #1e1e2e;
    border: 1px solid #313244;
    border-radius: 10px;
    overflow: hidden;
    max-width: 640px;
    margin: 48px auto 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    text-align: left;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid #313244;
    background: #181825;
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.code-dot.red { background: #f38ba8; }
.code-dot.yellow { background: #f9e2af; }
.code-dot.green { background: #a6e3a1; }

.code-title {
    font-size: 12px;
    color: #89b4fa;
    font-family: var(--mono);
    font-weight: 500;
    margin-left: 8px;
}

.code-body {
    padding: 24px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.65;
    color: #cdd6f4;
}

.code-body .comment { color: #6c7086; }
.code-body .string { color: #a6e3a1; }
.code-body .param { color: #89b4fa; }
.code-body .keyword { color: #cba6f7; }

/* Problem Section */
.problem-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.problem {
    text-align: center;
    padding: 24px;
    background: var(--bg);
    border-radius: 10px;
}

.problem-icon {
    font-size: 32px;
    margin-bottom: 16px;
}

.problem h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.problem p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Use Case Rows */
.use-case-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    margin-bottom: 64px;
}

.use-case-row:last-child {
    margin-bottom: 0;
}

.use-case-text h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.use-case-text p {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.use-case-text ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.use-case-text ul li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
    color: var(--text-muted);
}

.use-case-text ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.use-case-visual {
    background: #1e1e2e;
    border: 1px solid #313244;
    border-radius: 10px;
    overflow: hidden;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 24px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.feature:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--accent);
}

.feature-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.feature h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.feature p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Architecture Flow */
.arch-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 0;
}

.arch-node {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 32px;
    text-align: center;
}

.arch-node h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.arch-node p {
    font-size: 13px;
    color: var(--text-muted);
}

.arch-arrow {
    font-size: 24px;
    color: var(--accent);
    font-weight: 700;
}

/* CTA */
.cta {
    padding: 60px 0;
}

.cta-box {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
}

.cta-box h2 {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.cta-box p {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ───────────────────────────────────────────────────────────
   16. AUTH PAGES
   ─────────────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px - 64px); /* viewport - nav - footer */
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-card .subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Tabs */
.auth-tabs {
    display: flex;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: var(--font);
}

.auth-tab.active {
    background: white;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-tab:hover:not(.active) {
    color: var(--text);
}

.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
}

/* Auth form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fafafa;
    font-family: var(--font);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-form .remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    cursor: pointer;
}

.auth-form .remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.auth-form .btn {
    width: 100%;
    margin-top: 8px;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-dim);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider:not(:empty)::before {
    margin-right: 12px;
}

.auth-divider:not(:empty)::after {
    margin-left: 12px;
}

/* GitHub button */
.btn-github {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 24px;
    background: #24292f;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: var(--font);
}

.btn-github:hover {
    background: #1f2328;
}

/* Auth footer */
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Magic link hint */
.magic-hint {
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
    margin-top: 12px;
    line-height: 1.4;
}

/* ───────────────────────────────────────────────────────────
   17. COOKIE BANNER
   ─────────────────────────────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    z-index: 999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.cookie-banner-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cookie-banner-text {
    font-size: 13px;
    color: var(--text-muted);
}

.cookie-banner-text a {
    color: var(--accent);
    text-decoration: none;
}

.cookie-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ───────────────────────────────────────────────────────────
   18. RESPONSIVE
   ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-links {
        gap: 16px;
    }

    .nav-links a.hide-mobile {
        display: none;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-header .user-info {
        width: 100%;
    }

    .referral-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .api-keys-section {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .nav-hamburger {
        display: block;
    }

    .nav-links {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        z-index: 101;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 8px 0;
        display: none;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links > a:not(.btn):not(.logo),
    .nav-links .btn-sm {
        padding: 12px 24px;
        font-size: 15px;
        width: 100%;
        text-align: left;
        box-sizing: border-box;
    }

    .nav-links .btn-sm {
        border-radius: 0;
        margin: 4px 12px;
        width: calc(100% - 24px);
        justify-content: center;
    }

    .nav-links .btn-logout {
        border-radius: 0;
        margin: 4px 12px;
        width: calc(100% - 24px);
        display: inline-flex;
        justify-content: center;
    }

    .nav-links .user-email {
        padding: 8px 24px;
        font-size: 13px;
    }

    .nav-links form {
        display: block;
    }

    .hide-mobile {
        display: none !important;
    }

    .container {
        padding: 12px;
    }

    .stats-row {
        flex-wrap: wrap;
    }

    .stat {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
    }

    th,
    td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    form input,
    form textarea {
        min-height: 44px;
    }

    .cookie-banner-inner {
        flex-direction: column;
        text-align: center;
    }

    .cookie-banner-actions {
        width: 100%;
        justify-content: center;
    }

    /* Landing page responsive */
    .problem-grid {
        grid-template-columns: 1fr;
    }

    .use-case-row {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .arch-flow {
        flex-direction: column;
    }

    .arch-arrow {
        transform: rotate(90deg);
    }

    .cta-box {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .nav-links .btn {
        padding: 7px 14px;
        font-size: 13px;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 24px;
    }

    .hero {
        padding: 48px 0 40px;
    }

    .code-preview {
        margin: 32px auto 0;
    }
}

/* ═══════════════════════════════════════════════════════════
   25. DOCUMENTS DASHBOARD
   ═══════════════════════════════════════════════════════════ */

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Primary button (used in documents dashboard) */
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    font-family: var(--font);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.primary-btn:hover {
    background: var(--accent-bright);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.primary-btn.primary {
    background: var(--accent);
}

/* Action button */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: var(--font);
    text-decoration: none;
    line-height: 1.4;
}

.action-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.action-btn.primary:hover {
    background: var(--accent-bright);
    border-color: var(--accent-bright);
}

/* Tab bar */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font);
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* Status bar (filter chips) */
.status-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 4px;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
    white-space: nowrap;
    font-family: var(--font);
}

.status-chip:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.status-chip.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.chip-count {
    font-weight: 600;
}

.chip-label {
    text-transform: capitalize;
}

/* Document table */
.doc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.doc-table thead {
    background: var(--bg-elevated);
}

.doc-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.doc-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.doc-table tbody tr:hover {
    background: var(--accent-dim);
}

/* Document link */
.doc-link {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s;
}

.doc-link:hover {
    color: var(--accent);
}

/* Overdue dot */
.overdue-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* Type badge */
.type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.type-badge.type-invoice {
    background: #dbeafe;
    color: #1e40af;
}

.type-badge.type-quote {
    background: #fef3c7;
    color: #92400e;
}

.type-badge.type-proposal {
    background: #d1fae5;
    color: #065f46;
}

.type-badge.type-receipt {
    background: #e5e7eb;
    color: #374151;
}

.type-badge.type-custom {
    background: #f3e8ff;
    color: #6b21a8;
}

/* Status badge */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.status-draft {
    background: #e5e7eb;
    color: #374151;
}

.status-badge.status-sent {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.status-viewed {
    background: #e0e7ff;
    color: #3730a3;
}

.status-badge.status-unpaid {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.status-void {
    background: #fee2e2;
    color: #991b1b;
}

/* Site badge */
.site-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: #f3f4f6;
    color: var(--text-muted);
}

/* Document actions */
.doc-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 4px;
}

/* Template grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

/* Modal box */
.modal-box {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Modal header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

/* Modal close */
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

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

/* Modal body */
.modal-body {
    padding: 24px;
}

/* Modal footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Line items */
.line-item-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.line-item-row input {
    flex: 1;
    min-width: 0;
}

.line-item-row input.li-desc {
    flex: 2;
}

.line-item-row input.li-qty {
    flex: 0.5;
}

.line-item-row input.li-price {
    flex: 0.75;
}

.line-item-remove {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.line-item-remove:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #ef4444;
}

.line-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

/* Preview overlay */
.preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    flex-direction: column;
}

.preview-overlay.active {
    display: flex;
}

/* Preview toolbar */
.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #1e1e2e;
    color: #fff;
    flex-shrink: 0;
}

.preview-toolbar h3 {
    font-size: 16px;
    font-weight: 600;
}

/* Preview actions */
.preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.preview-actions button,
.preview-actions a {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    font-family: var(--font);
}

.preview-actions button:hover,
.preview-actions a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-actions a.primary {
    background: var(--accent);
    border-color: var(--accent);
}

.preview-actions a.primary:hover {
    background: var(--accent-bright);
}

/* Preview iframe wrap */
.preview-iframe-wrap {
    flex: 1;
    min-height: 0;
}

.preview-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--text);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    font-family: var(--font);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Documents dashboard responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .doc-table {
        font-size: 13px;
    }

    .doc-table thead th,
    .doc-table tbody td {
        padding: 10px 12px;
    }

    .modal-box {
        max-width: 100%;
        margin: 16px;
    }

    .line-item-row {
        flex-wrap: wrap;
    }

    .line-item-row input {
        min-width: 60px;
    }

    .preview-actions {
        flex-wrap: wrap;
    }

    .tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 13px;
    }

    .status-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .status-chip {
        flex-shrink: 0;
    }
}

/* ───────────────────────────────────────────────────────────
   SETTINGS — Page Layout
   ─────────────────────────────────────────────────────────── */
.settings-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.settings-header h1 {
    font-size: 24px;
    font-weight: 700;
}
.settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
}
.settings-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
}
.settings-sidebar a {
    display: block;
    padding: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}
.settings-sidebar a:hover {
    background: #e9ecef;
    color: var(--text);
}
.settings-sidebar a.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}
.settings-content { min-width: 0; }

/* Page-specific badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
}
.badge-free { background: #e9ecef; color: #333; }
.badge-starter { background: var(--accent-dim); color: var(--accent); }
.badge-pro { background: #fef3c7; color: #92400e; }
.badge-ai { background: #f3e8ff; color: #6b21a8; font-weight: 600; }

.verified-badge,
.unverified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}
.verified-badge {
    background: #dcfce7;
    color: #166534;
}
.unverified-badge {
    background: #fef3c7;
    color: #92400e;
}

/* ───────────────────────────────────────────────────────────
   SETTINGS — API Keys
   ─────────────────────────────────────────────────────────── */
.api-keys-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.api-keys-header h2 {
    font-size: 18px;
    margin-bottom: 0;
}

.api-keys-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: 100%;
}
.api-keys-table th,
.api-keys-table td {
    padding: 10px 12px;
    overflow: hidden;
}
.api-keys-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    border-bottom: 2px solid var(--border);
    background: var(--bg-elevated);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}
.api-keys-table td {
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    text-align: left;
    vertical-align: middle;
}
/* Column widths */
.api-keys-table th:nth-child(1),
.api-keys-table td:nth-child(1) { width: 18%; }
.api-keys-table th:nth-child(2),
.api-keys-table td:nth-child(2) { width: 16%; }
.api-keys-table th:nth-child(3),
.api-keys-table td:nth-child(3) { width: 20%; }
.api-keys-table th:nth-child(4),
.api-keys-table td:nth-child(4) { width: 15%; }
.api-keys-table th:nth-child(5),
.api-keys-table td:nth-child(5) { width: 14%; }
.api-keys-table th:nth-child(6),
.api-keys-table td:nth-child(6) { width: 17%; }

.api-keys-table .token {
    display: inline-block;
    font-family: var(--mono);
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

.new-key-display {
    background: #f0f9ff;
    border: 1px solid #93c5fd;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}
.new-key-display code {
    font-size: 15px;
    word-break: break-all;
    display: block;
    margin: 8px 0;
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}
.new-key-display .copy-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
}
.new-key-display .copy-btn:hover {
    background: var(--accent-bright);
}
.new-key-display .warning {
    color: #d97706;
    font-size: 12px;
    margin-top: 8px;
}

.perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    margin: 12px 0;
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.perm-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}
.perm-item label {
    cursor: pointer;
}
.perm-label {
    font-weight: 600;
    font-size: 14px;
    margin-top: 12px;
    display: block;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}
.back-link:hover { text-decoration: underline; }

.empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Settings responsive */
@media (max-width: 640px) {
    .container { padding: 8px; }
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-sidebar {
        position: static;
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border);
    }
    .settings-sidebar a {
        white-space: nowrap;
        padding: 6px 12px;
        margin-bottom: 0;
    }
    .api-keys-table { display: block; }
    .api-keys-table thead,
    .api-keys-table tbody,
    .api-keys-table tr,
    .api-keys-table th,
    .api-keys-table td { display: block; }
    .api-keys-table thead tr { display: none; }
    .api-keys-table tr {
        padding: 12px 0;
        border-bottom: 2px solid var(--border);
    }
    .api-keys-table td {
        text-align: right;
        padding: 6px 12px;
        border: none;
        position: relative;
        padding-left: 50%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .api-keys-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
    }
    .api-keys-table td:nth-child(n) { width: 100%; }
    .api-keys-table td:last-child {
        justify-content: flex-end;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }
    .api-keys-table td:last-child::before { display: none; }
}

/* ───────────────────────────────────────────────────────────
   25. API DOCS
   ─────────────────────────────────────────────────────────── */

/* Hero pseudo-element */
.hero::before {
    content: '';
    position: absolute;
    top: -200px; left: 50%; transform: translateX(-50%);
    width: 600px; height: 600px;
    background: radial-gradient(ellipse, var(--accent-dim) 0%, transparent 70%);
    pointer-events: none;
}

/* Hero badge (scoped to hero context) */
.hero .badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 6px;
    font-size: 12px; color: var(--accent);
    margin-bottom: 24px;
    font-family: var(--mono);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* AUTH CALLOUT */
.auth-callout {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin-top: 48px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.auth-callout h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-callout p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.55;
}

.auth-callout a {
    color: var(--accent);
    text-decoration: none;
}

.auth-callout a:hover {
    text-decoration: underline;
}

.auth-callout .code-block {
    margin: 12px 0 0;
    max-width: 100%;
}

/* ENDPOINT CARD */
.endpoint-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 28px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.endpoint-card:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    min-width: 56px;
}

.method-get {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.method-post {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-bright);
}

.method-put {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.method-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.endpoint-url {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-elevated);
    padding: 5px 12px;
    border-radius: 5px;
    border: 1px solid var(--border);
}

.endpoint-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* PARAMS TABLE */
.params-table {
    margin-top: 16px;
    width: 100%;
}

.params-table-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.param-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.param-row:last-child {
    border-bottom: none;
}

.param-name {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    min-width: 180px;
}

.param-type {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.param-desc {
    flex: 1;
    color: var(--text-muted);
    font-size: 13px;
}

.param-required {
    font-size: 11px;
    color: #ef4444;
    font-weight: 600;
    text-transform: uppercase;
}

/* CODE BLOCK overrides for inline use */
.code-inline {
    background: #1e1e2e;
    border: 1px solid #313244;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
}

.code-inline pre {
    padding: 20px 24px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.65;
    color: #cdd6f4;
}

.code-inline pre .kw { color: #cba6f7; }
.code-inline pre .str { color: #a6e3a1; }
.code-inline pre .cm { color: #6c7086; }
.code-inline pre .fn { color: #89b4fa; }
.code-inline pre .num { color: #f9e2af; }

/* EXAMPLES */
.example-block {
    margin-bottom: 32px;
}

.example-block:last-child {
    margin-bottom: 0;
}

.example-block h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

/* RESOURCE LIST */
.resource-list {
    list-style: none;
    padding: 0;
}

.resource-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.resource-list li:last-child {
    border-bottom: none;
}

.resource-list dt {
    font-weight: 600;
    color: var(--text);
    min-width: 140px;
}

.resource-list dd {
    color: var(--text-muted);
    margin: 0;
}

.resource-list a {
    color: var(--accent);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 13px;
}

.resource-list a:hover {
    text-decoration: underline;
}

/* API DOCS RESPONSIVE */
@media (max-width: 768px) {
    .hero { padding: 90px 0 50px; }
    .hero h1 { font-size: 28px; }
    .hero-sub { font-size: 14px; }
    .auth-callout { padding: 16px 20px; margin-top: 32px; }
    .endpoint-card { padding: 16px 20px; }
    .endpoint-url { font-size: 12px; word-break: break-all; }
    .param-name { min-width: 120px; font-size: 12px; }
    .param-desc { font-size: 12px; }
    .param-required { font-size: 10px; }
    .params-table-title { font-size: 11px; }
    .example-block h3 { font-size: 14px; }
    .code-inline pre { padding: 16px; font-size: 12px; }
    .section-header { margin-bottom: 32px; }
    .resource-list .param-name { min-width: 100px; font-size: 12px; }
    .resource-list .param-desc { font-size: 12px; }
}

@media (max-width: 480px) {
    .hero { padding: 70px 0 40px; }
    .hero h1 { font-size: 24px; }
    .hero-sub { font-size: 13px; }
    .hero .badge { font-size: 10px; padding: 4px 12px; margin-bottom: 16px; }
    .auth-callout { padding: 14px 16px; }
    .auth-callout h3 { font-size: 13px; }
    .auth-callout p { font-size: 12px; }
    .endpoint-card { padding: 14px 16px; }
    .endpoint-header { gap: 6px; }
    .method { padding: 3px 8px; font-size: 11px; min-width: 48px; }
    .endpoint-url { font-size: 11px; padding: 4px 8px; word-break: break-all; }
    .endpoint-desc { font-size: 12px; }
    .param-row { flex-wrap: wrap; gap: 8px; padding: 6px 0; }
    .param-name { min-width: 100%; font-size: 12px; margin-bottom: 2px; }
    .param-type { font-size: 11px; }
    .param-desc { width: 100%; margin-left: 0; }
    .param-required { margin-left: auto; }
    .code-inline { margin: 12px 0; }
    .code-inline pre { padding: 12px; font-size: 11px; line-height: 1.5; }
    .example-block { margin-bottom: 24px; }
    .example-block h3 { font-size: 14px; margin-bottom: 8px; }
    .section-title { font-size: 22px; }
    .section-sub { font-size: 13px; }
    .resource-list .param-row { flex-wrap: wrap; }
    .resource-list .param-name { min-width: 100%; font-size: 12px; }
    .resource-list .param-desc { font-size: 12px; }
}
