:root {
    --bg: #10141d;
    --bg-strong: #171d28;
    --text: #edf2ff;
    --muted: #98a7c2;
    --line: rgba(255, 255, 255, 0.08);
    --brand: #d2542d;
    --brand-dark: #8f2f1a;
    --accent: #169873;
    --danger: #c0392b;
    --panel-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    --radius: 24px;
}

body[data-theme="light"] {
    --bg: #f6f1e7;
    --bg-strong: #fffdf8;
    --text: #1f2430;
    --muted: #64748b;
    --line: rgba(31, 36, 48, 0.08);
    --panel-shadow: 0 24px 60px rgba(31, 36, 48, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(210, 84, 45, 0.18), transparent 30%),
        radial-gradient(circle at right 20%, rgba(22, 152, 115, 0.12), transparent 26%),
        linear-gradient(180deg, #0f1420 0%, #151d27 100%);
    min-height: 100vh;
}

body[data-theme="light"] {
    background:
        radial-gradient(circle at top left, rgba(210, 84, 45, 0.16), transparent 30%),
        radial-gradient(circle at right 20%, rgba(22, 152, 115, 0.12), transparent 26%),
        linear-gradient(180deg, #f8f2e8 0%, #f3efe8 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 32px 16px;
    overflow: hidden;
}

.auth-shell {
    width: min(100%, 460px);
    position: relative;
    z-index: 2;
}

.auth-card,
.panel {
    background: rgba(23, 29, 40, 0.92);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--panel-shadow);
}

body[data-theme="light"] .auth-card,
body[data-theme="light"] .panel {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.auth-card {
    padding: 32px;
}

.ambient-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.6;
}

.shape-one {
    inset: 8% auto auto 10%;
    width: 280px;
    height: 280px;
    background: rgba(210, 84, 45, 0.18);
}

.shape-two {
    inset: auto 8% 10% auto;
    width: 220px;
    height: 220px;
    background: rgba(22, 152, 115, 0.16);
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--brand);
    font-weight: 700;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

h2 {
    font-size: 1.35rem;
}

.muted {
    color: var(--muted);
}

.form-stack,
.inline-form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.95rem;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body[data-theme="light"] input {
    background: white;
}

input:focus {
    border-color: rgba(210, 84, 45, 0.45);
    box-shadow: 0 0 0 4px rgba(210, 84, 45, 0.12);
}

.button {
    border: none;
    border-radius: 999px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.button.primary {
    background: linear-gradient(135deg, var(--brand) 0%, #f08b34 100%);
    color: white;
}

.button.ghost {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
}

body[data-theme="light"] .button.ghost {
    background: rgba(255, 255, 255, 0.75);
}

.button.danger {
    background: rgba(192, 57, 43, 0.14);
    color: var(--danger);
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin: 18px 0;
}

.alert.error {
    background: rgba(192, 57, 43, 0.1);
    color: var(--danger);
}

.page-shell {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar,
.hero-grid,
.content-grid,
.metric-row,
.inline-actions,
.topbar-actions {
    display: grid;
    gap: 18px;
}

.topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    margin-bottom: 24px;
}

.topbar-actions {
    justify-self: end;
    grid-auto-flow: column;
    align-items: center;
}

.user-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 12px 16px;
    display: grid;
    gap: 2px;
}

body[data-theme="light"] .user-pill {
    background: rgba(255, 255, 255, 0.7);
}

.user-pill span {
    color: var(--muted);
    font-size: 0.85rem;
}

.hero-grid,
.content-grid {
    grid-template-columns: 1.55fr 1fr;
}

.panel {
    padding: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

.metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.metric-card {
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
}

body[data-theme="light"] .metric-card {
    background: rgba(255, 255, 255, 0.7);
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.metric-card strong {
    font-size: 1.65rem;
}

.status-chip {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.14);
    color: var(--muted);
    font-weight: 700;
}

.status-chip.active {
    background: rgba(22, 152, 115, 0.14);
    color: var(--accent);
}

.inline-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.grow {
    width: 100%;
}

.inline-actions {
    margin-top: 14px;
    align-items: center;
}

.steps {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    display: grid;
    gap: 12px;
}

.cards-grid,
.history-list {
    display: grid;
    gap: 14px;
}

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

.group-card,
.history-card {
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

body[data-theme="light"] .group-card,
body[data-theme="light"] .history-card {
    background: rgba(255, 255, 255, 0.78);
}

.group-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(210, 84, 45, 0.18), rgba(22, 152, 115, 0.2));
    object-fit: cover;
}

.group-body,
.history-card {
    padding: 18px;
}

.group-meta,
.history-meta {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.94rem;
}

.history-groups {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.history-group-item {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
}

body[data-theme="light"] .history-group-item {
    background: rgba(31, 36, 48, 0.04);
}

.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
}

body[data-theme="light"] .pill {
    background: rgba(31, 36, 48, 0.06);
}

.empty-state {
    min-height: 220px;
    place-items: center;
    text-align: center;
    color: var(--muted);
}

.wide-panel {
    min-height: 460px;
}

.theme-toggle {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 999px;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 600;
}

body[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.8);
}

.theme-toggle.floating {
    justify-self: end;
    margin-bottom: 12px;
}

.qr-card,
.qr-inline {
    display: grid;
    gap: 14px;
}

.qr-inline {
    grid-template-columns: 120px 1fr;
    align-items: center;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 18px;
}

body[data-theme="light"] .qr-inline {
    background: rgba(255, 255, 255, 0.7);
}

.qr-inline-copy {
    display: grid;
    gap: 6px;
}

.qr-image {
    width: min(100%, 220px);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 18px;
    padding: 10px;
    background: white;
}

.qr-image.small {
    width: 120px;
}

.compact {
    grid-auto-flow: column;
    justify-content: start;
}

@media (max-width: 960px) {
    .topbar,
    .hero-grid,
    .content-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .topbar-actions {
        justify-self: stretch;
        grid-auto-flow: row;
    }

    .metric-row {
        grid-template-columns: 1fr;
    }

    .qr-inline {
        grid-template-columns: 1fr;
    }
}
