:root {
    --ink: #171717;
    --muted: #6b7280;
    --paper: #fbfaf7;
    --panel: #ffffff;
    --line: #e6e1d8;
    --accent: #e43f5a;
    --accent-2: #0f8b8d;
    --gold: #d8a72f;
    --success: #147a4b;
    --danger: #b3261e;
    --shadow: 0 18px 48px rgba(23, 23, 23, .14);
    --radius: 8px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .primary, .secondary, .pill-link {
    border: 0;
    border-radius: var(--radius);
    min-height: 44px;
    padding: .75rem 1rem;
    cursor: pointer;
}
.primary { background: var(--accent); color: white; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.secondary { border: 1px solid var(--line); background: white; display: inline-flex; align-items: center; justify-content: center; }
.wide { width: 100%; }
.link-button { background: transparent; padding: 0; min-height: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .8rem clamp(1rem, 3vw, 2rem);
    background: rgba(251, 250, 247, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 900; font-size: 1.1rem; }
.topnav { display: flex; gap: .9rem; align-items: center; font-weight: 700; }
.topnav form { margin: 0; }
.pill-link { background: var(--ink); color: white; min-height: auto; padding: .45rem .75rem; }
.flash { margin: 1rem auto; max-width: 1100px; padding: .85rem 1rem; border-radius: var(--radius); }
.flash.success { background: #e9f8f1; color: var(--success); }
.flash.error { background: #fdecea; color: var(--danger); }

.home-screen { padding-bottom: 5rem; }
.hero {
    min-height: 72svh;
    display: grid;
    align-items: end;
    padding: clamp(1rem, 4vw, 4rem);
    color: white;
    background:
        linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.72)),
        url("https://images.unsplash.com/photo-1529634806980-85c3dd6d34ac?auto=format&fit=crop&w=1600&q=80") center/cover;
}
.hero-copy { max-width: 690px; padding-bottom: 6vh; }
.eyebrow { color: var(--accent-2); font-weight: 900; text-transform: uppercase; font-size: .78rem; }
.hero .eyebrow { color: #a7f3d0; }
.hero h1 { font-size: clamp(3rem, 10vw, 6.5rem); margin: .2rem 0; line-height: .95; }
.hero p { font-size: 1.08rem; max-width: 610px; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.2rem; }
.feature-grid, .stat-grid, .plan-grid, .mini-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    max-width: 1120px;
    margin: 1.25rem auto;
    padding: 0 1rem;
}
.feature-grid div, .stat-grid div, .panel-card, .plan-card, .list-cards article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
}
.feature-grid span, .stat-grid span, .list-cards span { display: block; color: var(--muted); }
.stat-grid strong { font-size: 1.6rem; }

.page, .register-page, .auth-card {
    max-width: 1120px;
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem) 1rem 6rem;
}
.narrow { max-width: 720px; }
.auth-bg { min-height: 100svh; display: grid; place-items: center; background: var(--paper); }
.auth-card {
    max-width: 430px;
    width: min(100%, 430px);
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stack-form, .compact-form { display: grid; gap: .85rem; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .9rem;
}
label { display: grid; gap: .35rem; font-weight: 800; font-size: .92rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .8rem;
    background: white;
    min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
.full { grid-column: 1 / -1; }
.type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    background: white;
    margin-bottom: 1rem;
}
.type-toggle legend { font-weight: 900; padding: 0 .4rem; }
.type-toggle label {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .9rem;
    min-height: 54px;
}
.matrimony-field { display: none; }
.register-form.is-matrimony .matrimony-field { display: block; }
.register-form.is-matrimony .form-grid .matrimony-field { display: grid; }
.register-form.is-dating .dating-field { display: grid; }
.register-form.is-matrimony .dating-field { display: none; }
.form-section { margin: 1rem 0; padding: 1rem; background: white; border: 1px solid var(--line); border-radius: var(--radius); }

.browse-stage {
    min-height: calc(100svh - 58px);
    padding: .5rem 0 5.8rem;
    display: grid;
    place-items: center;
}
.card-stack {
    width: min(100%, 460px);
    min-height: calc(100svh - 6.5rem);
    display: grid;
    place-items: center;
}
.profile-card {
    width: min(100%, 440px);
    border: 2px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow);
    transition: transform .28s ease, opacity .28s ease;
}
.profile-card.featured { border-color: var(--gold); }
.profile-card.premium { border-color: var(--accent-2); box-shadow: 0 20px 56px rgba(15, 139, 141, .22); }
.profile-card.pro { border-color: var(--accent); box-shadow: 0 22px 60px rgba(228, 63, 90, .24); }
.photo-frame {
    position: relative;
    min-height: min(78svh, 760px);
    background: linear-gradient(145deg, #263238, #6d4c41);
    background-position: center;
    background-size: cover;
    display: flex;
    align-items: flex-end;
}
.photo-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 8rem;
    color: white;
    background: linear-gradient(140deg, #0f8b8d, #e43f5a);
}
.photo-frame::after {
    content: "";
    position: absolute;
    inset: 35% 0 0;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.78));
}
.details-arrow {
    position: absolute;
    top: .7rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
}
.photo-tags {
    position: absolute;
    z-index: 3;
    top: .85rem;
    left: .85rem;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    max-width: calc(100% - 4rem);
}
.photo-tags span {
    background: rgba(255,255,255,.92);
    border-radius: 999px;
    padding: .28rem .55rem;
    font-size: .75rem;
    font-weight: 900;
}
.tag-warning { color: var(--danger); }
.tag-plan { color: var(--gold); }
.photo-actions {
    position: absolute;
    z-index: 3;
    right: .9rem;
    bottom: 6.2rem;
    display: grid;
    gap: .7rem;
}
.photo-actions button {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,.94);
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
    font-size: 1.6rem;
}
.identity {
    position: relative;
    z-index: 3;
    width: 100%;
    color: white;
    padding: 1.2rem;
}
.identity h2 { margin: 0; font-size: 1.7rem; }
.identity p { margin: .2rem 0 0; color: rgba(255,255,255,.86); }
.detail-sheet {
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease, padding .28s ease;
    padding: 0 1rem;
}
.profile-card.details-open .detail-sheet { max-height: 230px; padding: 1rem; }
.mini-profile-grid .profile-card { transform: none; }
.mini-profile-grid .photo-frame { min-height: 360px; }

.bottom-dock {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: .75rem;
    transform: translateX(-50%);
    width: min(calc(100% - 1rem), 720px);
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .2rem;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .45rem;
    box-shadow: var(--shadow);
}
.bottom-dock a {
    display: grid;
    place-items: center;
    min-width: 0;
    color: var(--ink);
    font-weight: 900;
    font-size: 1rem;
}
.bottom-dock span { font-size: .63rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.panel-button {
    position: fixed;
    top: 4.5rem;
    z-index: 45;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--line);
}
.panel-button.left { left: .7rem; }
.panel-button.right { right: .7rem; }
.side-panel {
    position: fixed;
    z-index: 60;
    top: 0;
    bottom: 0;
    width: min(86vw, 320px);
    background: white;
    border: 1px solid var(--line);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: grid;
    align-content: start;
    gap: .8rem;
    transition: transform .28s ease;
}
.side-left { left: 0; transform: translateX(-105%); }
.side-right { right: 0; transform: translateX(105%); }
.side-panel.open { transform: translateX(0); }
.panel-close { justify-self: end; width: 40px; height: 40px; border-radius: 50%; }

.dashboard-head, .admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.search-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .7rem;
    margin: 1rem 0;
}
.list-cards { display: grid; gap: .75rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { border-bottom: 1px solid var(--line); padding: .75rem; text-align: left; vertical-align: top; }
th { background: #f5f1e8; }
.inline-form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.inline-form select { width: auto; min-width: 130px; }

.messages-page {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 1rem;
    max-width: 1100px;
    margin: auto;
    padding: 1rem 1rem 6rem;
}
.conversation-list, .chat-panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
}
.conversation-list { display: grid; align-content: start; gap: .5rem; }
.chat-log { display: grid; gap: .6rem; max-height: 55svh; overflow: auto; }
.bubble { max-width: 78%; padding: .7rem .85rem; background: #f2eee6; border-radius: 8px; }
.bubble.mine { justify-self: end; background: #ffe4ea; }
.bubble p { margin: 0; }
.bubble span { display: block; font-size: .72rem; color: var(--muted); margin-top: .25rem; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-top: 1rem; }

.admin-shell { min-height: 100svh; display: grid; grid-template-columns: 245px 1fr; }
.admin-sidebar {
    background: #191919;
    color: white;
    padding: 1rem;
    display: grid;
    gap: .45rem;
    align-content: start;
    position: sticky;
    top: 0;
    height: 100svh;
}
.admin-sidebar a, .admin-logout { padding: .65rem .75rem; border-radius: var(--radius); background: rgba(255,255,255,.08); color: white; text-align: left; }
.admin-main { min-width: 0; padding: 1rem; }
.gateway-list { display: grid; gap: 1rem; }

.empty-state {
    background: white;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    color: var(--muted);
}
.muted-text { color: var(--muted); }
code { background: #f2eee6; padding: .12rem .28rem; border-radius: 4px; }

@media (min-width: 900px) {
    .browse-stage { grid-template-columns: 280px minmax(360px, 460px) 280px; gap: 1rem; }
    .side-panel {
        position: sticky;
        top: 70px;
        transform: none;
        height: calc(100svh - 90px);
        box-shadow: none;
        z-index: 5;
    }
    .side-left { grid-column: 1; }
    .side-right { grid-column: 3; }
    .card-stack { grid-column: 2; }
    .panel-button, .panel-close { display: none; }
}

@media (max-width: 720px) {
    .topnav a:not(.pill-link), .topnav form { display: none; }
    .type-toggle { grid-template-columns: 1fr; }
    .photo-frame { min-height: calc(100svh - 7.4rem); }
    .messages-page { grid-template-columns: 1fr; }
    .admin-shell { display: block; }
    .admin-sidebar {
        position: static;
        height: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .admin-sidebar .brand, .admin-sidebar form { grid-column: 1 / -1; }
    .bottom-dock { bottom: .35rem; }
}
