:root {
    --bg: #0b0b0b;
    --panel: #171717;
    --panel-2: #202020;
    --accent: #5a1e2c;
    --gold: #c9a86a;
    --text: #ffffff;
    --muted: #b9b1ad;
    --line: rgba(255, 255, 255, 0.1);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(90, 30, 44, 0.22), transparent 34rem),
        linear-gradient(135deg, #0b0b0b 0%, #111 46%, #0b0b0b 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
    display: grid;
    grid-template-columns: 17rem minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem;
    border-right: 1px solid var(--line);
    background: rgba(11, 11, 11, 0.82);
    backdrop-filter: blur(24px);
}

.brand {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 0.85rem;
    align-items: center;
    margin-bottom: 2rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid rgba(201, 168, 106, 0.55);
    background: linear-gradient(145deg, #221216, var(--accent));
    color: var(--gold);
    font-weight: 800;
}

.brand small, .feature-card p, .metric-card p, .item-card span, .lede, label, .empty-state {
    color: var(--muted);
}

.brand strong, .brand small { display: block; }
.brand small { margin-top: 0.1rem; font-size: 0.78rem; }

.nav-list {
    display: grid;
    gap: 0.45rem;
}

.nav-list a, .mobile-tabbar a {
    padding: 0.8rem 0.95rem;
    border: 1px solid transparent;
    color: var(--muted);
}

body[data-page="dashboard"] [data-nav="dashboard"],
body[data-page="wardrobe"] [data-nav="wardrobe"],
body[data-page="outfit"] [data-nav="outfit"],
body[data-page="weather"] [data-nav="weather"],
body[data-page="travel"] [data-nav="travel"],
body[data-page="tryon"] [data-nav="tryon"] {
    border-color: rgba(201, 168, 106, 0.35);
    background: rgba(90, 30, 44, 0.42);
    color: #fff;
}

.main-stage {
    width: min(100%, 1220px);
    padding: 2rem;
    margin: 0 auto;
}

.hero {
    min-height: 21rem;
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: flex-end;
    padding: clamp(1.25rem, 4vw, 3rem);
    border: 1px solid var(--line);
    background:
        linear-gradient(rgba(11, 11, 11, 0.15), rgba(11, 11, 11, 0.72)),
        linear-gradient(115deg, rgba(90, 30, 44, 0.72), rgba(23, 23, 23, 0.7)),
        url("../images/closet-hero.png") center/cover;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 0.55rem;
    color: var(--gold);
    text-transform: uppercase;
    font-size: 0.73rem;
    font-weight: 800;
}

h1, h2 {
    margin: 0;
    line-height: 1.02;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

h1 { font-size: clamp(2.5rem, 7vw, 5.7rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.lede { max-width: 42rem; font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.65; }

.primary-action, button.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(201, 168, 106, 0.6);
    background: linear-gradient(135deg, var(--gold), #8f6f35);
    color: #120d08;
    font-weight: 800;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.metric-card, .feature-card, .panel {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,0.035), transparent), var(--panel);
    box-shadow: 0 16px 46px rgba(0,0,0,0.25);
}

.metric-card, .feature-card {
    min-height: 10rem;
    padding: 1rem;
}

.metric-card span, .feature-card span {
    color: var(--gold);
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 800;
}

.metric-card strong, .feature-card strong {
    display: block;
    margin-top: 1rem;
    font-size: 2rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin: 2rem 0 1rem;
}

.section-head a { color: var(--gold); font-weight: 700; }

.closet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 1rem;
}

.closet-grid.compact { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }

.item-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--panel);
}

.item-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #101010;
}

.item-card div { padding: 0.8rem; }
.item-card strong, .item-card span { display: block; }
.item-card span { margin-top: 0.2rem; font-size: 0.85rem; }

.favorite-dot {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 2.2rem;
    height: 2.2rem;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.58);
    z-index: 2;
}

.favorite-dot.on { color: var(--gold); border-color: var(--gold); }

.workbench {
    display: grid;
    grid-template-columns: minmax(18rem, 25rem) 1fr;
    gap: 1rem;
}

.workbench.two { grid-template-columns: minmax(18rem, 28rem) 1fr; }
.panel { padding: 1rem; }

.form-panel, .inline-form {
    display: grid;
    gap: 0.85rem;
    align-content: start;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

label { display: grid; gap: 0.4rem; font-size: 0.86rem; }

input, select, textarea {
    width: 100%;
    min-height: 2.65rem;
    border: 1px solid rgba(255,255,255,0.14);
    background: #0f0f0f;
    color: var(--text);
    padding: 0.75rem;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(201, 168, 106, 0.7);
    box-shadow: 0 0 0 3px rgba(201, 168, 106, 0.12);
}

.checkline { display: flex; align-items: center; gap: 0.5rem; }
.checkline input { width: auto; min-height: auto; }
.toolbar { display: grid; grid-template-columns: 1fr 13rem; gap: 0.75rem; margin-bottom: 1rem; }
.form-status { min-height: 1.3rem; color: var(--gold); margin: 0; }
.empty-state { padding: 2rem; border: 1px dashed rgba(255,255,255,0.18); text-align: center; }

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0,0,0,0.94);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.gallery-modal[hidden] { display: none; }
.gallery-modal figure { display: grid; grid-template-columns: minmax(0, 64vh) minmax(16rem, 24rem); gap: 1rem; align-items: center; width: min(100%, 76rem); }
.gallery-modal img { width: 100%; max-height: 86vh; object-fit: contain; background: #111; }
.gallery-modal figcaption { display: grid; gap: 0.7rem; }
.gallery-modal figcaption strong { font-size: 2rem; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.modal-actions button, .icon-close, .gallery-nav {
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    min-height: 2.5rem;
    padding: 0.55rem 0.8rem;
}

.icon-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    font-size: 1.5rem;
}

.gallery-nav {
    position: fixed;
    top: 50%;
    width: 3rem;
    height: 4rem;
    font-size: 2rem;
}

.gallery-nav.prev { left: 1rem; }
.gallery-nav.next { right: 1rem; }
pre[data-analysis] { white-space: pre-wrap; color: var(--muted); font-size: 0.85rem; }

.outfit-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.outfit-slot {
    padding: 1rem;
    border: 1px solid var(--line);
    background: var(--panel);
}

.outfit-slot img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; margin: 0.75rem 0; }
.outfit-slot span { color: var(--gold); text-transform: uppercase; font-size: 0.75rem; font-weight: 800; }

.weather-detail {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.weather-tile {
    padding: 1rem;
    border: 1px solid var(--line);
    background: #101010;
}

.weather-tile strong { display: block; font-size: 1.6rem; margin-top: 0.5rem; }
.weather-recommendation { grid-column: 1 / -1; color: var(--gold); }
.travel-results ul { margin: 1rem 0 0; padding-left: 1.2rem; color: var(--muted); line-height: 1.7; }

.tryon-preview {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 30rem;
    overflow: hidden;
    background: #101010;
}

.tryon-preview .person { width: 100%; height: 100%; object-fit: contain; max-height: 34rem; }
.tryon-preview .garment {
    position: absolute;
    width: min(44%, 16rem);
    top: 28%;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 18px 24px rgba(0,0,0,0.45));
}

.mobile-tabbar { display: none; }

@media (max-width: 1040px) {
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workbench, .workbench.two { grid-template-columns: 1fr; }
    .outfit-board, .weather-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .app-shell { display: block; padding-bottom: 4.5rem; }
    .sidebar { display: none; }
    .main-stage { padding: 1rem; }
    .hero { min-height: 27rem; align-items: start; flex-direction: column; }
    .dashboard-grid, .outfit-board, .weather-detail, .form-row, .toolbar { grid-template-columns: 1fr; }
    .section-head { align-items: start; flex-direction: column; }
    .gallery-modal figure { grid-template-columns: 1fr; }
    .gallery-nav { bottom: 1rem; top: auto; }
    .mobile-tabbar {
        position: fixed;
        z-index: 15;
        bottom: 0;
        left: 0;
        right: 0;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        border-top: 1px solid var(--line);
        background: rgba(11, 11, 11, 0.92);
        backdrop-filter: blur(24px);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .mobile-tabbar a { text-align: center; font-size: 0.8rem; padding: 0.85rem 0.4rem; }
}
