:root {
    color-scheme: light;
    --ink: #211a32;
    --muted: #70697d;
    --surface: #ffffff;
    --surface-soft: #f8f6ff;
    --surface-warm: #fff7fb;
    --line: #e8e2f1;
    --primary: #6f3ff5;
    --primary-deep: #4d24ca;
    --primary-soft: #ede7ff;
    --rose: #d84c91;
    --rose-soft: #fde8f3;
    --success: #25745b;
    --warning: #8b5b12;
    --shadow: 0 18px 50px rgba(63, 38, 119, 0.10);
    --radius-large: 28px;
    --radius-medium: 18px;
    --shell: 1100px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--surface-soft);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 90% 0%, rgba(216, 76, 145, 0.10), transparent 30rem),
        radial-gradient(circle at 5% 20%, rgba(111, 63, 245, 0.09), transparent 28rem),
        var(--surface-soft);
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: var(--primary-deep);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid rgba(111, 63, 245, 0.38);
    outline-offset: 3px;
}

.shell {
    width: min(calc(100% - 32px), var(--shell));
    margin-inline: auto;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid rgba(232, 226, 241, 0.85);
    background: rgba(248, 246, 255, 0.88);
    backdrop-filter: blur(18px);
}

.topbar-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.wordmark-mark,
.brand-mark {
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #8e66ff, var(--primary-deep));
    box-shadow: 0 10px 24px rgba(79, 37, 205, 0.2);
}

.wordmark-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
}

.brand-mark {
    width: 58px;
    height: 58px;
    margin-bottom: 24px;
    border-radius: 18px;
    font-size: 1.55rem;
    font-weight: 850;
}

.account-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-actions form {
    margin: 0;
}

.account-name {
    max-width: 220px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-button {
    padding: 8px 12px;
    border: 0;
    color: var(--primary-deep);
    background: transparent;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.page-shell {
    min-height: calc(100vh - 154px);
    padding-block: 44px 72px;
}

.page-shell-authenticated {
    padding-bottom: 112px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 18ch;
    margin-bottom: 14px;
    font-size: clamp(2.15rem, 6vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.055em;
}

h2 {
    margin-bottom: 8px;
    font-size: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--primary-deep);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.hero-panel {
    position: relative;
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(28px, 6vw, 58px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-large);
    color: #fff;
    background: linear-gradient(125deg, #31205e 0%, #6033df 64%, #925ee9 100%);
    box-shadow: var(--shadow);
}

.hero-panel::after {
    position: absolute;
    width: 300px;
    height: 300px;
    right: -120px;
    bottom: -190px;
    border: 44px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    content: "";
}

.hero-panel .eyebrow {
    color: #d8cbff;
}

.hero-panel h1 {
    margin-bottom: 12px;
}

.hero-panel p:last-child {
    max-width: 50ch;
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.82);
}

.hero-orb {
    position: relative;
    z-index: 1;
    display: grid;
    flex: 0 0 auto;
    width: clamp(86px, 16vw, 150px);
    height: clamp(86px, 16vw, 150px);
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    font-size: clamp(2.4rem, 7vw, 4.5rem);
    backdrop-filter: blur(10px);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.action-card,
.panel,
.stat-card {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 36px rgba(59, 43, 92, 0.06);
}

.action-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    min-height: 188px;
    padding: 26px;
    border-radius: var(--radius-medium);
    color: var(--ink);
    text-decoration: none;
}

.action-card p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--muted);
}

.action-card-primary {
    background: linear-gradient(145deg, var(--surface), #f5f0ff);
}

.action-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 15px;
    color: #fff;
    background: var(--primary);
    font-size: 1.45rem;
}

.action-icon-soft {
    color: var(--rose);
    background: var(--rose-soft);
}

.coming-soon {
    position: absolute;
    right: 20px;
    bottom: 18px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 750;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.stat-card {
    display: flex;
    min-height: 128px;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    border-radius: var(--radius-medium);
}

.stat-card-highlight {
    border-color: #f4d3e4;
    background: var(--surface-warm);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 850;
    line-height: 1;
    letter-spacing: -0.06em;
}

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

.panel {
    padding: 28px;
    border-radius: var(--radius-medium);
}

.foundation-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 22px;
}

.foundation-panel p:last-child {
    max-width: 68ch;
    margin-bottom: 0;
    color: var(--muted);
}

.privacy-badge,
.status-pill,
.coming-soon {
    white-space: nowrap;
}

.privacy-badge {
    padding: 9px 13px;
    border-radius: 999px;
    color: var(--success);
    background: #e6f5ef;
    font-size: 0.78rem;
    font-weight: 800;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 230px);
    place-items: center;
    padding-block: 20px;
}

.auth-card {
    width: min(100%, 510px);
    padding: clamp(26px, 7vw, 48px);
    border: 1px solid rgba(232, 226, 241, 0.9);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: clamp(2rem, 8vw, 3.25rem);
}

.auth-intro,
.auth-note {
    color: var(--muted);
}

.auth-intro {
    margin-bottom: 28px;
}

.auth-note {
    margin: 24px 0 0;
    font-size: 0.86rem;
    text-align: center;
}

.stack-form {
    display: grid;
    gap: 9px;
}

label {
    margin-top: 9px;
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 750;
}

input:not([type="checkbox"]) {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #dcd4e8;
    border-radius: 13px;
    color: var(--ink);
    background: #fff;
}

select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dcd4e8;
    border-radius: 13px;
    color: var(--ink);
    background: #fff;
}

select {
    min-height: 50px;
}

textarea {
    resize: vertical;
}

input:not([type="checkbox"]):focus {
    border-color: var(--primary);
    outline: 3px solid rgba(111, 63, 245, 0.12);
}

.check-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    margin-block: 8px 4px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 500;
}

.check-row input {
    width: 19px;
    height: 19px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    border: 0;
    border-radius: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    box-shadow: 0 10px 22px rgba(77, 36, 202, 0.18);
}

.button-secondary {
    border: 1px solid var(--line);
    color: var(--primary-deep);
    background: #fff;
}

.button-danger {
    border: 1px solid #f0bed0;
    color: #a82d57;
    background: #fff5f8;
}

.button-wide {
    width: 100%;
    margin-top: 10px;
}

.field-error,
.validation-summary {
    color: #a82d57;
    font-size: 0.82rem;
}

.validation-summary:empty,
.field-error:empty {
    display: none;
}

.validation-summary ul {
    margin: 0 0 8px;
    padding-left: 20px;
}

.notice {
    display: grid;
    gap: 4px;
    margin-bottom: 24px;
    padding: 16px;
    border-radius: 13px;
}

.notice-warning {
    color: var(--warning);
    background: #fff3db;
}

.page-heading {
    margin-bottom: 24px;
}

.page-heading-actions {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.page-heading-actions h1,
.compact-heading h1 {
    margin-bottom: 10px;
}

.compact-heading {
    max-width: 720px;
}

.page-heading p:last-child {
    color: var(--muted);
}

.compact-panel,
.invitation-result {
    margin-bottom: 18px;
}

.invitation-result {
    border-color: #d9cfff;
    background: linear-gradient(145deg, #fff, #f7f3ff);
}

.copy-field,
.inline-form {
    display: flex;
    gap: 12px;
    align-items: end;
}

.copy-field input,
.inline-form > div {
    flex: 1;
}

.inline-form label {
    display: block;
    margin-top: 0;
    margin-bottom: 7px;
}

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

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

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

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

.status-pill {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: #f1eef5;
    font-size: 0.72rem;
    font-weight: 800;
}

.status-ready {
    color: var(--success);
    background: #e6f5ef;
}

.empty-state {
    margin-bottom: 0;
    color: var(--muted);
}

.back-link {
    display: inline-block;
    margin-bottom: 24px;
    font-size: 0.88rem;
    font-weight: 750;
    text-decoration: none;
}

.wardrobe-empty {
    display: grid;
    min-height: 360px;
    place-items: center;
    align-content: center;
    text-align: center;
}

.wardrobe-empty p:not(.eyebrow) {
    max-width: 46ch;
    color: var(--muted);
}

.empty-icon {
    display: grid;
    width: 62px;
    height: 62px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 20px;
    color: var(--primary-deep);
    background: var(--primary-soft);
    font-size: 2rem;
}

.wardrobe-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.wardrobe-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-medium);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 36px rgba(59, 43, 92, 0.06);
    text-decoration: none;
}

.wardrobe-card-image {
    display: grid;
    aspect-ratio: 4 / 5;
    place-items: center;
    overflow: hidden;
    background: #f0ecf7;
}

.wardrobe-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wardrobe-card-image .empty-icon {
    margin: 0;
}

.wardrobe-card-copy {
    display: grid;
    gap: 2px;
    padding: 15px 16px 17px;
}

.wardrobe-card-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wardrobe-card-copy span {
    color: var(--muted);
    font-size: 0.8rem;
}

.wardrobe-card > .status-pill {
    position: absolute;
    top: 12px;
    right: 12px;
}

.catalogue-form {
    display: grid;
    gap: 18px;
}

.photo-field > label {
    display: block;
    margin: 0 0 10px;
}

.photo-picker {
    position: relative;
    display: grid;
    min-height: 330px;
    place-items: center;
    overflow: hidden;
    border: 2px dashed #cfc3e2;
    border-radius: var(--radius-medium);
    background: #faf8fe;
}

.photo-picker input[type="file"] {
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.photo-picker-prompt {
    display: grid;
    max-width: 300px;
    place-items: center;
    gap: 6px;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.photo-picker-prompt strong {
    color: var(--ink);
}

.photo-picker-prompt span:last-child,
.field-help {
    font-size: 0.8rem;
}

.photo-picker-icon {
    display: grid;
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    background: var(--primary);
    font-size: 1.7rem;
}

.photo-picker img {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
}

.field-help {
    margin: 10px 0 0;
    color: var(--muted);
}

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

.choice-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.choice-group legend {
    margin-bottom: 9px;
    font-size: 0.86rem;
    font-weight: 750;
}

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

.choice-grid label {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    font-weight: 650;
}

.choice-grid input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.field-group {
    display: grid;
    align-content: start;
    gap: 7px;
}

.field-group label {
    margin: 0;
}

.field-group-wide {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.wardrobe-details {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: clamp(28px, 6vw, 72px);
    align-items: start;
}

.wardrobe-details-image {
    display: grid;
    min-height: 520px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: #f0ecf7;
    box-shadow: var(--shadow);
}

.wardrobe-details-image img {
    width: 100%;
    max-height: 760px;
    object-fit: contain;
}

.wardrobe-details-image .empty-icon {
    margin: 0;
}

.wardrobe-details-copy {
    padding-top: 20px;
}

.wardrobe-details-copy h1 {
    font-size: clamp(2.3rem, 5vw, 3.8rem);
}

.details-title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
}

.details-title-row h1 {
    margin-bottom: 14px;
}

.analysis-note {
    display: grid;
    gap: 2px;
    margin: 22px 0;
    padding: 14px 16px;
    border-radius: 14px;
    color: var(--muted);
    background: #f1eef5;
    font-size: 0.86rem;
}

.analysis-note strong {
    color: var(--ink);
}

.analysis-note-ready {
    color: var(--success);
    background: #e6f5ef;
}

.analysis-note-ready strong {
    color: var(--success);
}

.analysis-note-warning {
    color: var(--warning);
    background: #fff3db;
}

.analysis-note-warning strong {
    color: var(--warning);
}

.details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.details-actions form {
    margin: 0;
}

.item-description {
    color: var(--muted);
    white-space: pre-line;
}

.item-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 30px 0;
}

.item-facts div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
}

.item-facts dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.item-facts dd {
    margin: 4px 0 0;
    font-weight: 750;
}

.prose-page {
    width: min(100%, 760px);
    padding: clamp(25px, 6vw, 50px);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.prose-page h1 {
    font-size: clamp(2.1rem, 6vw, 3.5rem);
}

.prose-page h2 {
    margin-top: 32px;
}

.prose-page p {
    color: var(--muted);
}

.bottom-nav {
    position: fixed;
    z-index: 30;
    right: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: none;
    width: min(calc(100% - 24px), 520px);
    min-height: 68px;
    padding: 7px;
    transform: translateX(50%);
    border: 1px solid rgba(224, 216, 238, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 44px rgba(43, 27, 77, 0.17);
    backdrop-filter: blur(18px);
}

.bottom-nav-item {
    display: grid;
    flex: 1;
    place-items: center;
    align-content: center;
    gap: 2px;
    border-radius: 16px;
    color: var(--muted);
    font-size: 0.69rem;
    font-weight: 750;
    text-decoration: none;
}

.bottom-nav-item > span:first-child {
    font-size: 1.25rem;
    line-height: 1;
}

.bottom-nav-primary {
    color: var(--primary-deep);
    background: var(--primary-soft);
}

.is-disabled {
    opacity: 0.55;
}

.site-footer {
    padding: 22px 0 calc(22px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8rem;
}

.site-footer .shell {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

@media (max-width: 700px) {
    .shell {
        width: min(calc(100% - 24px), var(--shell));
    }

    .topbar-inner {
        min-height: 60px;
    }

    .account-name {
        display: none;
    }

    .page-shell {
        padding-top: 22px;
    }

    .hero-panel {
        min-height: 225px;
        align-items: flex-end;
    }

    .hero-orb {
        position: absolute;
        top: 24px;
        right: 24px;
        width: 64px;
        height: 64px;
        font-size: 2rem;
    }

    .quick-actions,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-card {
        min-height: 172px;
    }

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

    .stat-card {
        min-height: 108px;
        padding: 16px 12px;
    }

    .stat-value {
        font-size: 1.9rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    .foundation-panel,
    .inline-form,
    .copy-field {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading-actions .button {
        width: 100%;
    }

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

    .wardrobe-card-copy {
        padding: 12px;
    }

    .photo-field,
    .form-panel {
        padding: 18px;
    }

    .photo-picker {
        min-height: 290px;
    }

    .form-grid,
    .wardrobe-details {
        grid-template-columns: 1fr;
    }

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

    .details-title-row {
        align-items: start;
    }

    .field-group-wide {
        grid-column: auto;
    }

    .form-actions .button {
        flex: 1;
    }

    .wardrobe-details {
        gap: 24px;
    }

    .wardrobe-details-image {
        min-height: 390px;
    }

    .wardrobe-details-copy {
        padding-top: 0;
    }

    .bottom-nav {
        display: flex;
    }

    .site-footer {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
