:root {
    --text: #16181d;
    --muted: #5a6072;
    --border: #e6e8ec;
    --bg: #ffffff;
    --bg-alt: #fafafb;
    --accent: #16181d;
    --accent-contrast: #ffffff;
    --max-width: 1080px;
    --header-height: 72px;
    --sandbox-banner-height: 36px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: var(--header-height);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
}

a {
    color: inherit;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.container-fluid {
    width: 100%;
    padding: 0 24px;
}

/* Header */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.sandbox-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: var(--sandbox-banner-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    padding: 0 16px;
}

body.sandbox {
    padding-top: calc(var(--header-height) + var(--sandbox-banner-height));
}

body.sandbox .site-header {
    top: var(--sandbox-banner-height);
}

.site-header .container,
.site-header .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.4em;
    height: 1.4em;
    border-radius: 0.4em;
    background: var(--text);
    color: var(--bg);
    font-size: 0.8em;
    font-weight: 700;
    line-height: 1;
}

.logo-tld {
    font-weight: 500;
    color: var(--muted);
}

.logo-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

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

.nav-secondary {
    display: flex;
    align-items: center;
    gap: 32px;
}

.hamburger.nav-hamburger {
    display: none;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.95rem;
}

.nav-links a:not(.btn) {
    color: var(--muted);
}

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

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    opacity: 0.88;
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

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

/* Hero */

.hero {
    padding: 96px 0 88px;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}

.hero p.lede {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 640px;
    margin: 0 auto 36px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Admin page header (lighter-weight than the marketing hero) */

.page-header {
    padding: 40px 0 32px;
    text-align: left;
    border-top: none;
}

.page-header h1 {
    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}

.page-header p.lede {
    font-size: 1rem;
    color: var(--muted);
    margin: 0;
}

/* Sections */

section {
    padding: 72px 0;
    border-top: 1px solid var(--border);
}

section h2 {
    font-size: 1.75rem;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
    text-align: center;
}

section p.section-lede {
    color: var(--muted);
    text-align: center;
    max-width: 560px;
    margin: 0 auto 48px;
}

/* Feature grid */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

.feature {
    padding: 0;
}

.feature .step {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 1.05rem;
    margin: 0 0 8px;
}

.feature p {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0;
}

/* Code sample */

.code-section {
    background: var(--bg-alt);
}

.code-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.code-columns h2,
.code-columns p.section-lede {
    text-align: left;
    margin: 0;
}

.code-columns p.section-lede {
    margin-top: 12px;
    max-width: none;
}

pre.code-block {
    background: #16181d;
    color: #e6e8ec;
    border-radius: 8px;
    padding: 24px;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0;
}

/* CTA */

.cta,
#early-access {
    text-align: center;
}

.cta h2,
#early-access h2 {
    margin-bottom: 12px;
}

.cta p.section-lede,
#early-access p.section-lede {
    margin-bottom: 32px;
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
}

.site-footer .container,
.site-footer .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--muted);
}

.site-footer a {
    text-decoration: none;
    color: var(--muted);
    margin-left: 24px;
}

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

/* Login modal */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(22, 24, 29, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: var(--bg);
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(22, 24, 29, 0.2);
}

.modal h2 {
    margin: 0 0 24px;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    text-align: left;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

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

.modal form {
    display: flex;
    flex-direction: column;
}

.modal label {
    margin-top: 16px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal input {
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.modal input:focus {
    outline: none;
    border-color: var(--text);
}

.modal-submit {
    width: 100%;
    margin-top: 28px;
    text-align: center;
    cursor: pointer;
}

.modal-error {
    margin: 16px 0 0;
    font-size: 0.85rem;
    color: #b3261e;
}

.modal-error[hidden] {
    display: none;
}

/* Hamburger + admin drawer */

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(22, 24, 29, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
}

.drawer-overlay[hidden] {
    display: none;
}

.drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 300px;
    height: 100%;
    background: var(--bg);
    box-shadow: -20px 0 60px rgba(22, 24, 29, 0.2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.drawer-overlay.is-open .drawer {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: flex-end;
    padding: 12px;
}

.drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

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

.drawer-links {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0 24px;
}

.drawer-links a {
    padding: 14px 0;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.drawer-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
}

.drawer-signout {
    width: 100%;
    text-align: center;
    cursor: pointer;
    color: #b3261e;
    border-color: #b3261e;
}

.drawer-signout:hover {
    background: #b3261e;
    color: var(--accent-contrast);
}

/* Dashboard */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover {
    color: var(--text);
}

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

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    background: var(--bg-alt);
    color: var(--muted);
}

.status-badge.status-paid {
    background: #e3f5e9;
    color: #1c7a3d;
}

.status-badge.status-approved {
    background: #e6edfb;
    color: #2952e3;
}

.status-badge.status-rejected {
    background: #fbe7e6;
    color: #b3261e;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-tabs a {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--muted);
}

.filter-tabs a:hover {
    color: var(--text);
}

.filter-tabs a.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--accent-contrast);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    font-size: 0.9rem;
}

.pagination a {
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
}

.pagination a:hover {
    text-decoration: underline;
}

.pagination-disabled {
    font-weight: 600;
    color: var(--border);
}

.pagination-info {
    color: var(--muted);
}

/* Settings */

.settings-single {
    max-width: 480px;
}

.settings-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.settings-card h2 {
    margin: 0 0 20px;
    font-size: 1.1rem;
    text-align: left;
}

.settings-card label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.settings-card label:first-of-type {
    margin-top: 0;
}

.settings-card input,
.settings-card select {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.settings-card input:focus,
.settings-card select:focus {
    outline: none;
    border-color: var(--text);
}

.settings-submit {
    margin-top: 24px;
    cursor: pointer;
}

.settings-success {
    margin: 16px 0 0;
    font-size: 0.85rem;
    color: #1c7a3d;
}

.settings-success[hidden] {
    display: none;
}

.settings-field-label {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.settings-hint {
    margin: 16px 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.api-key-display {
    display: block;
    padding: 10px 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    word-break: break-all;
}

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

    .hamburger.nav-hamburger {
        display: flex;
    }

    .nav-invite {
        display: none;
    }
}

.drawer-cta {
    display: block;
    width: 100%;
    text-align: center;
}

@media (max-width: 860px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .code-columns h2,
    .code-columns p.section-lede {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 560px) {
    .hero h1 {
        font-size: 2.1rem;
    }

    .hero-actions {
        flex-direction: column;
    }

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

    .site-footer .container,
    .site-footer .container-fluid {
        flex-direction: column;
        gap: 12px;
    }

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

/* Docs */

.docs-llm-note {
    max-width: 760px;
    margin: 0 0 40px;
    padding: 12px 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.docs-llm-note code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
}

.markdown-body {
    max-width: 760px;
}

.markdown-body h1 {
    font-size: 1.75rem;
    letter-spacing: -0.01em;
    margin: 0 0 16px;
}

.markdown-body h2 {
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    text-align: left;
    margin: 48px 0 16px;
}

.markdown-body h3 {
    font-size: 1.1rem;
    margin: 32px 0 12px;
}

.markdown-body p {
    margin: 0 0 16px;
}

.markdown-body ul,
.markdown-body ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.markdown-body li {
    margin-bottom: 6px;
}

.markdown-body li > p {
    margin: 0 0 8px;
}

.markdown-body a {
    color: var(--text);
    text-decoration: underline;
}

.markdown-body strong {
    font-weight: 600;
}

.markdown-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--bg-alt);
    padding: 2px 6px;
    border-radius: 4px;
}

.markdown-body pre {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 0 0 20px;
    overflow-x: auto;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px;
    font-size: 0.9rem;
}

.markdown-body th,
.markdown-body td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.markdown-body th {
    color: var(--muted);
    font-weight: 600;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* Cookie banner */

.cookie-banner {
    position: fixed;
    left: 24px;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(22, 24, 29, 0.15);
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner p {
    flex: 1;
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

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

@media (max-width: 560px) {
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .cookie-banner-actions {
        justify-content: flex-end;
    }
}
