:root {
    --bg: #0b0b0f;
    --card: #16161d;
    --card-2: #1d1d26;
    --text: #ffffff;
    --muted: #a1a1aa;
    --accent: #8b5cf6;
    --accent-2: #c084fc;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --line: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 80% -10%, rgba(139, 92, 246, 0.15), transparent 32rem),
        var(--bg);
    color: var(--text);
    font-family: "DM Sans", sans-serif;
}

body.has-bottom-nav { padding-bottom: 6.5rem; }

h1, h2, h3, .brand, .display {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.035em;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
img { max-width: 100%; }

.ambient {
    position: fixed;
    z-index: -1;
    width: 20rem;
    height: 20rem;
    border-radius: 999px;
    filter: blur(100px);
    opacity: 0.08;
    pointer-events: none;
}
.ambient-one { top: 22%; left: -12rem; background: var(--accent); }
.ambient-two { right: -12rem; bottom: 8%; background: #2563eb; }

.app-shell, .public-shell, .admin-shell {
    width: min(calc(100% - 2rem), 72rem);
    margin: 0 auto;
}
.app-shell { padding: 1.5rem 0 2rem; }
.public-shell { width: min(calc(100% - 2rem), 76rem); }
.admin-shell { padding: 2rem 0 4rem; }

.app-header, .admin-header {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.75rem;
    padding: env(safe-area-inset-top) max(1rem, calc((100% - 72rem) / 2)) 0;
    border-bottom: 1px solid var(--line);
    background: rgba(11, 11, 15, 0.84);
    backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-weight: 700; }
.brand-mark {
    display: grid;
    width: 2.1rem;
    height: 2.1rem;
    place-items: center;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    font-size: 0.75rem;
    box-shadow: 0 0 28px rgba(139, 92, 246, 0.35);
}
.brand small { color: var(--accent-2); font-family: "DM Sans"; font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; }

.credit-pill, .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #e4e4e7;
    font-size: 0.78rem;
    font-weight: 700;
}
.credit-pill { padding: 0.55rem 0.8rem; }
.credit-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent); }

.page-heading { margin-bottom: 1.5rem; }
.eyebrow {
    display: inline-block;
    margin-bottom: 0.55rem;
    color: var(--accent-2);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.page-heading h1 { max-width: 42rem; margin: 0; font-size: clamp(2rem, 9vw, 3.7rem); line-height: 0.98; }
.page-heading p { max-width: 38rem; margin: 0.85rem 0 0; color: var(--muted); line-height: 1.65; }

.card {
    border: 1px solid var(--line);
    border-radius: 1.35rem;
    background: linear-gradient(145deg, rgba(29, 29, 38, 0.92), rgba(22, 22, 29, 0.96));
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);
}
.card-pad { padding: 1.2rem; }
.card-title { margin: 0; font-size: 1.1rem; }
.card-copy { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }

.btn {
    display: inline-flex;
    min-height: 3.35rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 1rem;
    cursor: pointer;
    font-weight: 800;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #6d28d9); color: white; box-shadow: 0 12px 30px rgba(139, 92, 246, 0.24); }
.btn-secondary { border-color: var(--line); background: rgba(255, 255, 255, 0.055); color: white; }
.btn-danger { border-color: rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
.btn-small { min-height: 2.5rem; padding: 0.55rem 0.8rem; border-radius: 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.form-card { padding: 1.25rem; }
.form-grid { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.5rem; }
.field label, .label { color: #e4e4e7; font-size: 0.85rem; font-weight: 700; }
.field-help { color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.input, .textarea, .select {
    width: 100%;
    min-height: 3.2rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    outline: none;
    border-radius: 0.9rem;
    background: #101016;
    color: white;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.textarea { min-height: 8rem; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14); }
.input::placeholder, .textarea::placeholder { color: #65656f; }
.file-input { padding: 0.75rem; }
.file-input::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 0;
    border-radius: 0.65rem;
    background: rgba(139, 92, 246, 0.18);
    color: #ddd6fe;
    font-weight: 700;
}

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
.choice-card { position: relative; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; }
.choice-content {
    display: flex;
    min-height: 4.2rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color 160ms ease, background 160ms ease;
}
.choice-card input:checked + .choice-content { border-color: var(--accent); background: rgba(139, 92, 246, 0.12); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-content strong { display: block; font-size: 0.86rem; }
.choice-content small { color: var(--muted); font-size: 0.72rem; }
.style-swatch { width: 2.4rem; height: 2.4rem; flex: 0 0 auto; border-radius: 0.75rem; background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.choice-card:nth-child(3n+2) .style-swatch { background: linear-gradient(135deg, #06b6d4, #2563eb); }
.choice-card:nth-child(3n+3) .style-swatch { background: linear-gradient(135deg, #f59e0b, #ef4444); }

.stats-grid, .dashboard-grid, .design-grid, .admin-grid { display: grid; gap: 1rem; }
.stats-grid { grid-template-columns: repeat(2, 1fr); }
.stat { padding: 1.1rem; }
.stat-value { display: block; margin-top: 0.25rem; font-family: "Space Grotesk"; font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.hero-action {
    position: relative;
    overflow: hidden;
    padding: 1.4rem;
    background: linear-gradient(135deg, #4c1d95, #7c3aed 60%, #a855f7);
}
.hero-action::after {
    position: absolute;
    right: -2rem;
    bottom: -4rem;
    width: 11rem;
    height: 11rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    box-shadow: 0 0 0 2rem rgba(255, 255, 255, 0.04), 0 0 0 4rem rgba(255, 255, 255, 0.025);
    content: "";
}
.hero-action h2 { position: relative; z-index: 1; max-width: 18rem; margin: 0 0 0.55rem; font-size: 1.7rem; line-height: 1.05; }
.hero-action p { position: relative; z-index: 1; max-width: 24rem; margin: 0 0 1rem; color: #ede9fe; font-size: 0.9rem; }
.hero-action .btn { position: relative; z-index: 1; background: white; color: #4c1d95; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 0.85rem; }
.section-head h2 { margin: 0; font-size: 1.15rem; }
.text-link { color: #c4b5fd; font-size: 0.82rem; font-weight: 700; }
.muted { color: var(--muted); }

.design-card { overflow: hidden; }
.design-thumb { position: relative; display: grid; aspect-ratio: 1 / 1; place-items: center; overflow: hidden; background: #ededed; }
.design-thumb img { width: 80%; height: 80%; object-fit: contain; transition: transform 240ms ease; }
.design-card:hover .design-thumb img { transform: scale(1.04); }
.design-info { padding: 0.9rem; }
.design-info h3 { margin: 0; font-size: 0.95rem; }
.design-meta { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; color: var(--muted); font-size: 0.72rem; }

.badge { padding: 0.35rem 0.55rem; font-size: 0.68rem; text-transform: capitalize; }
.badge-success { border-color: rgba(34, 197, 94, 0.18); background: rgba(34, 197, 94, 0.1); color: #86efac; }
.badge-warning { border-color: rgba(245, 158, 11, 0.18); background: rgba(245, 158, 11, 0.1); color: #fcd34d; }
.badge-muted { color: #d4d4d8; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 1rem; }
.data-table { width: 100%; min-width: 45rem; border-collapse: collapse; background: rgba(22, 22, 29, 0.8); }
.data-table th, .data-table td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 0.82rem; }
.data-table th { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table a:not(.btn) { color: #c4b5fd; font-weight: 700; }

.bottom-nav {
    position: fixed;
    z-index: 40;
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: 0.75rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    max-width: 34rem;
    margin: auto;
    padding: 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    background: rgba(22, 22, 29, 0.94);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
}
.bottom-nav a {
    display: grid;
    min-height: 3.4rem;
    place-items: center;
    align-content: center;
    gap: 0.15rem;
    border-radius: 0.9rem;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
}
.bottom-nav a.active { background: rgba(139, 92, 246, 0.15); color: #ddd6fe; }
.nav-icon { font-size: 1.15rem; line-height: 1; }

.flash {
    position: fixed;
    z-index: 80;
    top: 5.25rem;
    right: 1rem;
    left: 1rem;
    display: flex;
    max-width: 26rem;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: #202029;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
}
.flash-success { border-color: rgba(34, 197, 94, 0.25); }
.flash-error { border-color: rgba(239, 68, 68, 0.3); }
.flash-icon { display: grid; width: 1.5rem; height: 1.5rem; flex: 0 0 auto; place-items: center; border-radius: 50%; background: rgba(139, 92, 246, 0.18); font-weight: 800; }
.flash button { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.25rem; }

.empty-state { display: grid; justify-items: center; padding: 2.5rem 1.25rem; text-align: center; }
.empty-icon { display: grid; width: 3.5rem; height: 3.5rem; place-items: center; border-radius: 1.1rem; background: rgba(139, 92, 246, 0.15); color: #c4b5fd; font-size: 1.5rem; }
.empty-state h2 { margin: 1rem 0 0.4rem; }
.empty-state p { max-width: 26rem; margin: 0 0 1.25rem; color: var(--muted); }

.auth-page { display: grid; min-height: 100vh; align-items: center; padding: 2rem 0; }
.auth-wrap { width: min(calc(100% - 2rem), 28rem); margin: auto; }
.auth-brand { margin-bottom: 2rem; }
.auth-card { padding: 1.4rem; }
.auth-card h1 { margin: 0; font-size: 2rem; }
.auth-card > p { margin: 0.5rem 0 1.4rem; color: var(--muted); }
.auth-footer { margin-top: 1.25rem; color: var(--muted); text-align: center; font-size: 0.85rem; }
.auth-footer a { color: #c4b5fd; font-weight: 700; }

.admin-header { padding-right: max(1rem, calc((100% - 72rem) / 2)); padding-left: max(1rem, calc((100% - 72rem) / 2)); }
.admin-menu-button { padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--card); color: white; }
.admin-nav { position: absolute; top: 4.8rem; right: 1rem; display: none; min-width: 13rem; padding: 0.5rem; border: 1px solid var(--line); border-radius: 1rem; background: #18181f; box-shadow: 0 20px 40px rgba(0,0,0,.4); }
.admin-nav.open { display: grid; }
.admin-nav a { padding: 0.7rem 0.8rem; border-radius: 0.65rem; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.admin-nav a.active, .admin-nav a:hover { background: rgba(139, 92, 246, 0.12); color: white; }

.preview-stage { position: relative; display: grid; min-height: 27rem; place-items: center; overflow: hidden; border-radius: 1.35rem; background: radial-gradient(circle, #2b2b37, #111117 70%); }
.preview-shirt { width: min(92%, 28rem); filter: drop-shadow(0 30px 35px rgba(0, 0, 0, 0.35)); }
.preview-design { position: absolute; top: 28%; left: 50%; width: 30%; height: 35%; transform: translateX(-50%); object-fit: contain; }
.order-summary { display: grid; gap: 0.8rem; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); }
.summary-row strong { color: white; }
.summary-total { padding-top: 0.9rem; border-top: 1px solid var(--line); font-size: 1.1rem; }

@media (min-width: 640px) {
    .choice-grid { grid-template-columns: repeat(3, 1fr); }
    .design-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .form-grid.two { grid-template-columns: repeat(2, 1fr); }
    .card-pad, .form-card { padding: 1.5rem; }
}

@media (min-width: 900px) {
    .dashboard-grid { grid-template-columns: 1.15fr 0.85fr; }
    .design-grid { grid-template-columns: repeat(4, 1fr); }
    .admin-grid { grid-template-columns: repeat(4, 1fr); }
    .builder-grid, .checkout-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr); gap: 1.25rem; align-items: start; }
    .admin-menu-button { display: none; }
    .admin-nav { position: static; display: flex; align-items: center; padding: 0; border: 0; background: transparent; box-shadow: none; }
    .admin-nav a { padding: 0.6rem 0.7rem; }
}
