:root {
    --paper: #f1e9da;
    --paper-soft: #fbf8f0;
    --surface: #ffffff;
    --ink: #2e294e;
    --muted: #746f86;
    --purple: #541388;
    --magenta: #d90368;
    --yellow: #ffd400;
    --border: rgba(46, 41, 78, 0.12);
    --shadow: 0 20px 54px rgba(46, 41, 78, 0.13);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: light;
}

body {
    margin: 0;
    font-family: Inter, "Avenir Next", "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #fffdf8 0%, var(--paper) 100%);
    overflow-x: hidden;
}

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

button,
input,
textarea,
select {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.app-shell,
.site-shell {
    min-height: 100vh;
    padding: 16px 20px 40px;
}

.app-header {
    position: sticky;
    top: 12px;
    z-index: 50;
    max-width: 1180px;
    height: 74px;
    margin: 0 auto 28px;
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    align-items: center;
    border: 1px solid rgba(84, 19, 136, 0.13);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 44px rgba(46, 41, 78, 0.12);
    backdrop-filter: blur(18px);
}

.center-logo {
    justify-self: center;
}

.center-logo img {
    width: min(230px, 52vw);
    max-height: 56px;
    object-fit: contain;
}

.icon-button {
    width: 44px;
    height: 44px;
    margin: 0 auto;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--purple);
    cursor: pointer;
}

.back-button span,
.mini-back::before {
    content: "";
    width: 12px;
    height: 12px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.menu-toggle {
    display: none;
}

.hamburger {
    justify-self: center;
    gap: 4px;
}

.hamburger span,
.mini-menu span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.app-menu {
    position: absolute;
    top: 82px;
    right: 0;
    width: min(280px, calc(100vw - 40px));
    display: none;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.menu-toggle:checked ~ .app-menu {
    display: grid;
}

.app-menu a {
    padding: 12px 14px;
    border-radius: 6px;
    color: var(--ink);
    font-weight: 800;
}

.app-menu a:hover {
    background: var(--paper-soft);
}

.product-stage,
.sync-strip,
.feature-section,
.detail-preview {
    max-width: 1180px;
    margin: 0 auto;
}

.product-stage {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
    gap: 36px;
    align-items: center;
    padding: 8px 0 34px;
}

.stage-copy {
    max-width: 560px;
    min-width: 0;
}

.app-icon {
    width: 82px;
    height: 82px;
    border-radius: 8px;
    box-shadow: 0 18px 34px rgba(84, 19, 136, 0.16);
    margin-bottom: 24px;
}

.stage-copy h1,
.section-heading h2,
.detail-copy h2,
.admin-header h1,
.admin-auth-card h1,
.legal-shell h1,
.cta-panel h2,
.story-card h2,
.hero-copy h1 {
    margin: 0;
    font-size: clamp(2.55rem, 5.8vw, 5.4rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.stage-copy p,
.section-heading p,
.detail-copy p,
.endpoint-card p,
.legal-shell p,
.panel p,
.admin-subtitle,
.feature-card p,
.story-card p {
    color: var(--muted);
    line-height: 1.7;
}

.stage-actions,
.hero-actions,
.cta-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 900;
    font-size: 0.94rem;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--magenta));
    box-shadow: 0 14px 28px rgba(217, 3, 104, 0.22);
}

.button.secondary,
.button.ghost {
    color: var(--ink);
    background: #fff;
    border-color: var(--border);
}

.button.wide {
    width: 100%;
}

.phone-frame {
    min-width: 0;
    min-height: 720px;
    padding: 16px;
    border: 1px solid rgba(46, 41, 78, 0.14);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #fff8e0 100%);
    box-shadow: var(--shadow);
}

.phone-top,
.detail-header {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    align-items: center;
    gap: 12px;
}

.phone-top img {
    width: 180px;
    justify-self: center;
}

.mini-back,
.mini-menu {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(46, 41, 78, 0.12);
    border-radius: 8px;
    background: #fff;
    color: var(--purple);
}

.mini-menu {
    gap: 3px;
}

.mini-menu span {
    display: block;
    width: 15px;
}

.phone-search {
    margin: 18px 0;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-weight: 700;
}

.widget-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-bottom: 12px;
}

.widget-tile,
.endpoint-card,
.detail-panel,
.legal-shell,
.admin-auth-card,
.panel,
.stat-card,
.feature-card,
.story-card,
.detail-chip,
.cta-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(46, 41, 78, 0.09);
}

.widget-tile {
    min-height: 146px;
    padding: 14px;
}

.widget-tile.note,
.widget-tile.countdown {
    grid-column: span 2;
}

.widget-tile.note { background: #fff6bf; }
.widget-tile.grocery { background: #f7fff2; }
.widget-tile.counter { background: #f4e9ff; }
.widget-tile.countdown { background: #fff3f7; }
.widget-tile.timer { background: #f1f7ff; }
.widget-tile.streak { background: #fff9df; }

.tile-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--purple);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.tile-top small {
    color: var(--magenta);
    font-size: inherit;
}

.widget-tile h2 {
    margin: 20px 0 8px;
    font-size: 1.18rem;
}

.widget-tile p {
    margin: 0;
    color: var(--ink);
    font-weight: 750;
}

.bottom-quick-menu {
    position: static;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 36px rgba(46, 41, 78, 0.14);
    backdrop-filter: blur(16px);
}

.bottom-quick-menu a {
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 6px;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 900;
}

.bottom-quick-menu a:first-child {
    background: var(--yellow);
}

.bottom-quick-menu span,
.endpoint-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--purple);
    color: #fff;
    font-weight: 950;
}

.sync-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px 0 34px;
}

.sync-strip div {
    padding: 18px;
    border-left: 4px solid var(--yellow);
    border-radius: 8px;
    background: #fff;
}

.sync-strip strong,
.sync-strip span {
    display: block;
}

.sync-strip span {
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.5;
}

.feature-section {
    padding: 30px 0;
}

.section-heading {
    max-width: 710px;
    margin-bottom: 22px;
}

.section-heading h2,
.detail-copy h2 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

.endpoint-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.endpoint-card {
    min-height: 214px;
    padding: 18px;
}

.endpoint-card h3 {
    margin: 18px 0 8px;
}

.endpoint-card p {
    margin: 0;
    font-size: 0.94rem;
}

.detail-preview {
    display: grid;
    grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 24px 0 60px;
}

.detail-panel {
    padding: 18px;
    background: #fff;
}

.detail-header strong {
    text-align: center;
}

.checklist-preview {
    display: grid;
    gap: 12px;
    padding: 0;
    margin: 24px 0;
    list-style: none;
}

.checklist-preview li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background: var(--paper-soft);
    font-weight: 800;
}

.checklist-preview span {
    width: 20px;
    height: 20px;
    border: 2px solid var(--purple);
    border-radius: 6px;
}

.checklist-preview .checked {
    background: var(--yellow);
}

.attachment-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.attachment-row div {
    padding: 12px;
    border-radius: 8px;
    background: #fff3f7;
    color: var(--magenta);
    font-size: 0.8rem;
    font-weight: 900;
    text-align: center;
}

.legal-shell {
    width: min(880px, calc(100% - 32px));
    margin: 28px auto;
    padding: 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 900;
}

.brand.dark {
    color: var(--ink);
}

.brand img,
.brand.compact img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.legal-shell h1 {
    margin-top: 24px;
    font-size: clamp(2.2rem, 5vw, 4rem);
}

.legal-shell h2 {
    margin-top: 26px;
}

.admin-auth-page,
.admin-page,
.theme-brand {
    background: linear-gradient(180deg, #fffdf8 0%, var(--paper) 100%);
}

.admin-auth-shell,
.admin-shell,
.legal-shell {
    min-height: 100vh;
}

.admin-auth-shell {
    display: grid;
    place-items: center;
    padding: 20px;
}

.admin-auth-card {
    width: min(460px, 100%);
    padding: 28px;
}

.admin-form {
    display: grid;
    gap: 14px;
}

.admin-form label {
    display: grid;
    gap: 8px;
    font-weight: 850;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 13px;
    background: #fff;
    color: var(--ink);
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
}

.admin-sidebar {
    padding: 26px 22px;
    border-right: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.64);
}

.admin-main {
    padding: 26px;
}

.admin-header {
    margin-bottom: 22px;
}

.admin-header h1 {
    max-width: 760px;
    font-size: clamp(2rem, 4vw, 3.2rem);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--magenta);
    font-size: 0.76rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card,
.panel,
.feature-card,
.story-card,
.detail-chip,
.cta-panel {
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
}

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

.data-table {
    overflow-x: auto;
}

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

th,
td {
    padding: 11px 8px;
    border-bottom: 1px solid rgba(46, 41, 78, 0.1);
    text-align: left;
    font-size: 0.92rem;
}

th {
    color: var(--muted);
}

.flash {
    border-radius: 8px;
    padding: 13px 14px;
    margin-bottom: 18px;
    font-weight: 850;
}

.flash.success {
    background: rgba(34, 197, 94, 0.13);
    color: #116035;
}

.flash.error {
    background: rgba(217, 3, 104, 0.12);
    color: #8d0645;
}

@media (max-width: 1020px) {
    .product-stage,
    .detail-preview,
    .admin-shell,
    .admin-panels {
        grid-template-columns: 1fr;
    }

    .endpoint-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sync-strip,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 680px) {
    .app-shell,
    .site-shell {
        padding: 10px 12px 28px;
    }

    .app-header {
        height: 66px;
        grid-template-columns: 48px 1fr 48px;
    }

    .icon-button {
        width: 38px;
        height: 38px;
    }

    .product-stage {
        width: 100%;
        max-width: calc(100vw - 24px);
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .stage-copy,
    .phone-frame,
    .detail-panel,
    .detail-copy {
        width: 100%;
        max-width: calc(100vw - 24px);
    }

    .stage-copy h1 {
        max-width: 100%;
        font-size: 2rem;
        line-height: 1.08;
        overflow-wrap: normal;
    }

    .stage-copy p {
        overflow-wrap: anywhere;
    }

    .phone-frame {
        min-height: 0;
        padding: 12px;
    }

    .widget-board,
    .endpoint-grid,
    .attachment-row {
        grid-template-columns: 1fr;
    }

    .widget-tile.note,
    .widget-tile.countdown {
        grid-column: span 1;
    }

    .bottom-quick-menu {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .bottom-quick-menu a {
        font-size: 0.66rem;
    }
}
