:root {
    color-scheme: light;
    --ink: #1e2430;
    --muted: #667085;
    --line: #e7e1da;
    --paper: #fffaf5;
    --panel: #ffffff;
    --panel-2: #f7fbfb;
    --rose: #d84f65;
    --rose-dark: #a63f50;
    --teal: #168b89;
    --mustard: #d89535;
    --blue: #385f8f;
    --success: #147a4d;
    --warning: #a86c10;
    --danger: #b93838;
    --shadow: 0 18px 55px rgba(58, 42, 32, 0.12);
    --radius: 8px;
    --nav-height: 72px;
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Space Grotesk", "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, rgba(255, 250, 245, 0.94), rgba(246, 251, 251, 0.98)),
        radial-gradient(circle at 18% 18%, rgba(216, 79, 101, 0.08), transparent 28%),
        radial-gradient(circle at 82% 8%, rgba(22, 139, 137, 0.08), transparent 32%);
    color: var(--ink);
    letter-spacing: 0;
}

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

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--nav-height);
    padding: 14px clamp(16px, 3vw, 40px);
    border-bottom: 1px solid rgba(231, 225, 218, 0.85);
    background: rgba(255, 250, 245, 0.88);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-weight: 700;
}

.brand img {
    width: 142px;
    max-width: 45vw;
    height: auto;
    display: block;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-pill,
.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--muted);
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
}

.nav-pill:hover {
    border-color: rgba(216, 79, 101, 0.45);
    color: var(--rose-dark);
}

.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.chip,
.tab-button,
.icon-button {
    min-height: 42px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    padding: 0 16px;
    background: var(--panel);
    color: var(--ink);
    font-weight: 700;
}

.primary-button {
    background: var(--ink);
    color: #fff;
    box-shadow: 0 10px 26px rgba(30, 36, 48, 0.18);
}

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

.secondary-button {
    border-color: var(--line);
    background: var(--panel);
}

.ghost-button {
    border-color: rgba(30, 36, 48, 0.14);
    background: rgba(255, 255, 255, 0.55);
}

.danger-button {
    background: var(--danger);
    color: #fff;
}

.icon-button {
    width: 42px;
    padding: 0;
    border-color: var(--line);
}

.auth-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
    min-height: calc(100vh - var(--nav-height));
}

.auth-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(36px, 8vw, 96px);
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--teal);
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    max-width: 820px;
    font-family: "Romie", "DM Serif Display", Georgia, serif;
    font-size: clamp(3rem, 9vw, 7.8rem);
    line-height: 0.88;
    letter-spacing: 0;
}

.auth-copy .lede {
    max-width: 660px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: clamp(1.05rem, 1.6vw, 1.32rem);
    line-height: 1.55;
}

.auth-panel-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 5vw, 64px);
}

.auth-panel,
.modal-panel {
    width: min(100%, 460px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: clamp(22px, 4vw, 34px);
}

.auth-panel h2,
.pane-title h2,
.modal-panel h2 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.1;
}

.auth-panel p,
.pane-title p,
.empty-state,
.helper,
.field-help {
    color: var(--muted);
    line-height: 1.55;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.form-field {
    display: grid;
    gap: 7px;
}

.form-field label {
    color: #343c4a;
    font-size: 0.86rem;
    font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}

.form-field textarea {
    min-height: 100px;
    resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: rgba(22, 139, 137, 0.68);
    box-shadow: 0 0 0 3px rgba(22, 139, 137, 0.12);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(216, 149, 53, 0.35);
    background: rgba(216, 149, 53, 0.1);
    color: #573b0c;
    line-height: 1.45;
}

.notice.error {
    border-color: rgba(185, 56, 56, 0.28);
    background: rgba(185, 56, 56, 0.08);
    color: var(--danger);
}

.notice.success {
    border-color: rgba(20, 122, 77, 0.28);
    background: rgba(20, 122, 77, 0.08);
    color: var(--success);
}

.workspace {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: calc(100vh - var(--nav-height));
}

.side-nav {
    position: sticky;
    top: var(--nav-height);
    align-self: start;
    height: calc(100vh - var(--nav-height));
    padding: 24px 18px;
    border-right: 1px solid var(--line);
    background: rgba(255, 250, 245, 0.76);
}

.profile-mini {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.72);
}

.profile-mini strong {
    font-size: 1.05rem;
}

.side-links {
    display: grid;
    gap: 8px;
    margin-top: 20px;
}

.tab-button {
    justify-content: flex-start;
    width: 100%;
    border-color: transparent;
    background: transparent;
    text-align: left;
}

.tab-button.active {
    border-color: rgba(216, 79, 101, 0.28);
    background: rgba(216, 79, 101, 0.09);
    color: var(--rose-dark);
}

.main-view {
    min-width: 0;
    padding: clamp(18px, 3vw, 40px);
}

.pane-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.pane-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 20px;
    align-items: start;
}

.section-band,
.match-card,
.chat-list,
.chat-panel,
.profile-card,
.subscription-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 28px rgba(58, 42, 32, 0.07);
}

.section-band {
    padding: clamp(18px, 3vw, 28px);
}

.section-band + .section-band {
    margin-top: 18px;
}

.section-band h3,
.match-card h3,
.profile-card h3 {
    margin: 0 0 12px;
    font-size: 1.18rem;
}

.chip-grid,
.photo-grid,
.match-grid,
.stats-grid {
    display: grid;
    gap: 10px;
}

.chip-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.chip {
    border-color: var(--line);
    background: #fff;
    color: #374151;
    text-align: center;
}

.chip.selected {
    border-color: rgba(22, 139, 137, 0.62);
    background: rgba(22, 139, 137, 0.1);
    color: #0f615f;
}

.chip.disabled {
    opacity: 0.45;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

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

.match-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.match-card,
.profile-card,
.subscription-panel {
    overflow: hidden;
}

.match-photo,
.profile-photo-strip {
    background: #efe9e2;
}

.match-photo {
    aspect-ratio: 4 / 5;
    width: 100%;
    object-fit: cover;
    display: block;
}

.placeholder-photo {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 5;
    background: linear-gradient(135deg, #f6e9e1, #dceeee);
    color: var(--muted);
    font-weight: 800;
}

.match-body,
.profile-body,
.subscription-body {
    padding: 18px;
}

.meta-row,
.button-row,
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(56, 95, 143, 0.1);
    color: #2e4c73;
    font-size: 0.85rem;
    font-weight: 700;
}

.tag.warn {
    background: rgba(216, 149, 53, 0.13);
    color: #765011;
}

.tag.success {
    background: rgba(20, 122, 77, 0.1);
    color: #12613f;
}

.photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
}

.photo-tile {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f1ede8;
    aspect-ratio: 4 / 5;
}

.photo-tile img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.photo-tile button {
    position: absolute;
    right: 7px;
    top: 7px;
    width: 30px;
    min-height: 30px;
    border: none;
    border-radius: 999px;
    background: rgba(30, 36, 48, 0.76);
    color: #fff;
}

.question-card {
    display: grid;
    gap: 16px;
}

.progress-track {
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: #eadfd6;
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--rose), var(--teal));
    transition: width 0.25s ease;
}

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

.scale-button {
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font-weight: 800;
}

.scale-button.selected {
    border-color: var(--teal);
    background: rgba(22, 139, 137, 0.1);
    color: #0f615f;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.86rem;
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
    min-height: min(720px, calc(100vh - 180px));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.chat-list {
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    overflow: auto;
}

.chat-item {
    display: grid;
    gap: 6px;
    width: 100%;
    padding: 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-align: left;
}

.chat-item.active {
    background: rgba(22, 139, 137, 0.08);
}

.chat-panel {
    display: grid;
    grid-template-rows: auto 1fr auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
}

.chat-header,
.chat-composer {
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.chat-composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding: 18px;
    background: var(--panel-2);
}

.message {
    max-width: min(78%, 560px);
    padding: 10px 12px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--line);
    line-height: 1.42;
}

.message.mine {
    align-self: flex-end;
    background: #eaf6f4;
    border-color: rgba(22, 139, 137, 0.2);
}

.message small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.74rem;
}

.profile-photo-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
}

.profile-photo-strip img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(17, 24, 39, 0.42);
}

.modal-panel {
    max-height: min(760px, 92vh);
    overflow: auto;
    padding: 22px;
}

.loading-screen {
    display: grid;
    min-height: calc(100vh - var(--nav-height));
    place-items: center;
    padding: 32px;
    color: var(--muted);
}

.spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(30, 36, 48, 0.14);
    border-top-color: var(--teal);
    border-radius: 999px;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .auth-wrap,
    .workspace,
    .dashboard-grid,
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .side-nav {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 14px 16px;
    }

    .side-links {
        display: flex;
        overflow-x: auto;
        margin-top: 12px;
        padding-bottom: 4px;
    }

    .tab-button {
        justify-content: center;
        min-width: max-content;
    }

    .chat-list {
        max-height: 260px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 680px) {
    :root {
        --nav-height: 64px;
    }

    .topbar {
        padding: 12px 14px;
    }

    .status-pill,
    .nav-pill {
        display: none;
    }

    .auth-copy,
    .auth-panel-wrap,
    .main-view {
        padding: 20px 14px;
    }

    .form-grid.two,
    .scale-options {
        grid-template-columns: 1fr;
    }

    .pane-title {
        display: grid;
    }

    .pane-actions {
        justify-content: flex-start;
    }

    .chat-composer {
        grid-template-columns: 1fr;
    }

    .message {
        max-width: 92%;
    }
}
