:root {
    --bg: #fff7f4;
    --bg-accent:
        linear-gradient(90deg, #f8cad7 0 34%, #cfe9ff 34% 68%, #fff2e6 68% 100%);
    --card: #fff2e8;
    --card-strong: #ffffff;
    --block-pink: #f7c6d4;
    --block-blue: #cfeaff;
    --block-cream: #fff0df;
    --block-white: #ffffff;
    --text: #000000;
    --text-muted: #1f1f1f;
    --line: #000000;
    --accent: #000000;
    --accent-strong: #000000;
    --accent-soft: #f7c6d4;
    --secondary: #000000;
    --secondary-soft: #cfeaff;
    --shadow: 10px 10px 0 #000000;
    --radius: 18px;
    --radius-sm: 14px;
    --max-width: 1180px;
    --font: "Segoe UI", "Aptos", "Helvetica Neue", sans-serif;
}

html[data-theme="dark"] {
    --bg: #0f1320;
    --bg-accent:
        linear-gradient(90deg, #2b1d35 0 34%, #18283f 34% 68%, #121722 68% 100%);
    --card: #171c28;
    --card-strong: #1f2432;
    --block-pink: #4c2d3f;
    --block-blue: #213a5a;
    --block-cream: #262a38;
    --block-white: #1b2130;
    --text: #f3f0eb;
    --text-muted: #d5d2cb;
    --line: #f3f0eb;
    --accent: #f3f0eb;
    --accent-strong: #f3f0eb;
    --accent-soft: #4c2d3f;
    --secondary: #f3f0eb;
    --secondary-soft: #213a5a;
    --shadow: 10px 10px 0 #05070d;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-accent);
}

body {
    line-height: 1.5;
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-shell {
    min-height: 100vh;
    width: min(calc(100% - 32px), var(--max-width));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.site-header,
.site-footer,
.site-nav,
.button-row,
.table-toolbar,
.toolbar-actions,
.toggle-row,
.result-url-row,
.stats-grid,
.grid-section,
.dashboard-grid {
    display: flex;
    gap: 16px;
}

.site-header,
.site-footer,
.table-toolbar,
.result-url-row {
    justify-content: space-between;
    align-items: center;
}

.site-header {
    padding: 18px 22px;
    margin-bottom: 32px;
    border: 2px solid var(--line);
    background: var(--block-white);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.brand {
    font-weight: 800;
    letter-spacing: -0.04em;
    font-size: 1.3rem;
}

.site-nav {
    align-items: center;
    flex-wrap: wrap;
}

.site-nav a,
.nav-button,
.theme-toggle {
    padding: 10px 14px;
    border-radius: 999px;
    border: 2px solid transparent;
    color: var(--text);
    background: transparent;
}

.site-nav a:hover,
.nav-button:hover,
.theme-toggle:hover {
    border-color: var(--line);
    background: var(--block-blue);
}

.nav-cta,
.primary-button,
.secondary-button,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-cta,
.primary-button {
    background: var(--block-pink);
    color: var(--text);
    border: 2px solid var(--line);
}

.primary-button,
.secondary-button,
.link-button {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 700;
}

.secondary-button {
    border: 2px solid var(--line);
    background: var(--block-blue);
    color: var(--text);
}

.primary-button:hover,
.secondary-button:hover,
.link-button:hover,
.nav-cta:hover {
    transform: translate(2px, 2px);
    box-shadow: 6px 6px 0 var(--line);
}

.page-content {
    display: grid;
    gap: 28px;
}

.hero,
.dashboard-grid,
.grid-section {
    display: grid;
    gap: 24px;
}

.hero {
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
}

.hero-copy {
    padding: 32px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 28px;
    border-radius: var(--radius);
    background: var(--card);
    border: 2px solid var(--line);
    box-shadow: var(--shadow);
}

.tool-card {
    background: var(--block-blue);
}

.prose-card {
    max-width: 860px;
}

.centered-card {
    text-align: center;
    margin: 5vh auto 0;
}

.hero-copy h1,
.auth-card h1,
.card h1,
.card h2 {
    margin: 0 0 10px;
    letter-spacing: -0.04em;
}

.hero-copy h1 {
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    line-height: 0.95;
}

.hero-copy .lede,
.muted {
    color: var(--text-muted);
}

.eyebrow {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--secondary);
}

.stack-form,
.stack-list {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

small {
    color: var(--text-muted);
}

input,
textarea,
select {
    width: 100%;
    border: 2px solid var(--line);
    background: var(--block-white);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background: #101622;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid transparent;
    box-shadow: 0 0 0 3px var(--block-blue);
    border-color: var(--line);
}

input[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-row {
    align-items: center;
}

.toggle-row input {
    width: auto;
}

.result-card {
    margin-top: 20px;
    padding: 18px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 2px solid var(--line);
    box-shadow: 6px 6px 0 var(--line);
}

.result-label {
    margin: 0 0 6px;
    font-weight: 700;
}

.result-url-row {
    gap: 20px;
    flex-wrap: wrap;
}

.result-url-row a {
    font-weight: 700;
    word-break: break-all;
}

.faq-section .section-heading {
    margin-bottom: 18px;
}

.faq-card-list {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.faq-card {
    padding: 20px;
    border-radius: var(--radius-sm);
    background: var(--block-white);
    border: 2px solid var(--line);
    box-shadow: 6px 6px 0 var(--line);
}

.faq-card:nth-child(2n) {
    background: var(--block-blue);
}

.faq-card:nth-child(3n) {
    background: var(--block-pink);
}

.faq-card h3 {
    margin-top: 0;
}

.dashboard-grid {
    grid-template-columns: 1.2fr 0.8fr;
}

.table-shell {
    width: 100%;
    overflow-x: auto;
}

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

th,
td {
    padding: 14px 10px;
    border-bottom: 2px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--secondary-soft);
    color: var(--text);
    border: 2px solid var(--line);
    font-size: 0.84rem;
    font-weight: 700;
}

.pill.inactive {
    background: var(--accent-soft);
    color: var(--text);
}

.toolbar-actions {
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-actions input {
    min-width: 260px;
}

.simple-list {
    margin: 0;
    padding-left: 18px;
}

.simple-list li {
    margin-bottom: 10px;
}

.stats-grid {
    flex-wrap: wrap;
    margin-top: 22px;
}

.stat-card {
    flex: 1 1 200px;
    padding: 18px;
    border-radius: var(--radius-sm);
    background: var(--block-blue);
    border: 2px solid var(--line);
    box-shadow: 6px 6px 0 var(--line);
}

.stat-card:nth-child(2n) {
    background: var(--block-pink);
}

.stat-card span {
    display: block;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.auth-layout {
    display: flex;
    justify-content: center;
}

.auth-card {
    width: min(100%, 520px);
}

.analytics-card {
    min-height: 100%;
}

.analytics-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-metric {
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--line);
    background: var(--block-white);
    box-shadow: 6px 6px 0 var(--line);
}

.analytics-metric strong {
    display: block;
    font-size: 1.6rem;
    margin-top: 8px;
}

.stack-list {
    gap: 18px;
}

.report-card {
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--line);
    background: var(--block-pink);
    box-shadow: 6px 6px 0 var(--line);
}

.qr-placeholder {
    min-height: 240px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 2px dashed var(--line);
    background: var(--secondary-soft);
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
}

.hidden {
    display: none !important;
}

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

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(360px, calc(100vw - 36px));
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--block-pink);
    color: var(--text);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 50;
    border: 2px solid var(--line);
    box-shadow: 6px 6px 0 var(--line);
}

html[data-theme="dark"] .toast {
    background: var(--block-blue);
    color: var(--text);
}

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

.site-footer {
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 24px;
    padding: 18px 22px;
    color: var(--text);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--block-white);
    box-shadow: var(--shadow);
}

.hero-copy,
.auth-card,
.prose-card,
.analytics-card {
    background: var(--block-pink);
}

.grid-section > .card:nth-child(2n),
.dashboard-grid > .card:nth-child(2n) {
    background: var(--block-blue);
}

@media (max-width: 980px) {
    .hero,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .site-header,
    .table-toolbar,
    .result-url-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(calc(100% - 20px), var(--max-width));
        padding-top: 14px;
    }

    .card,
    .site-header {
        padding: 20px;
        border-radius: 20px;
    }

    .hero-copy h1 {
        font-size: clamp(2.4rem, 11vw, 3.6rem);
    }

    .toolbar-actions input {
        min-width: 0;
    }

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