:root {
    --bg: #f6f2e8;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --ink: #172036;
    --muted: #5f6780;
    --line: #e8ddc8;
    --shadow: 0 24px 60px rgba(31, 45, 76, 0.12);
    --green: #89bb14;
    --green-soft: #eef7cc;
    --blue: #1583d8;
    --blue-soft: #dff2ff;
    --yellow: #ffc719;
    --yellow-soft: #fff3c6;
    --red: #ef3c32;
    --red-soft: #ffe0dc;
    --pink: #e4007e;
    --purple: #7e2a8d;
    --teal: #0ca7a6;
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --touch: 52px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Avenir Next", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 199, 25, 0.18), transparent 24%),
        radial-gradient(circle at right 20%, rgba(21, 131, 216, 0.15), transparent 22%),
        linear-gradient(180deg, #fff8ef 0%, var(--bg) 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-card {
    width: min(100%, 560px);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: 36px;
    box-shadow: var(--shadow);
    padding: 28px;
    display: grid;
    gap: 22px;
    position: relative;
    z-index: 2;
}

.auth-brand {
    margin: 0;
    justify-content: center;
    padding: 22px;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    border-radius: 0;
}

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

.login-mascot-corner {
    position: fixed;
    right: 22px;
    bottom: 18px;
    pointer-events: none;
    z-index: 1;
}

.login-mascot {
    width: min(28vw, 240px);
    height: auto;
}

.auth-submit {
    width: 100%;
}

.auth-error {
    padding: 14px 18px;
    border-radius: 16px;
    background: #ffe8e4;
    border: 1px solid #f0b0a8;
    color: #9b231b;
    font-weight: 700;
}

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

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

.app-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    display: flex;
    flex-direction: column;
    padding: 28px 22px;
    background:
        radial-gradient(circle at bottom, rgba(137, 187, 20, 0.22), transparent 36%),
        linear-gradient(180deg, #fffdf8 0%, #fff5e5 100%);
    border-right: 1px solid rgba(232, 221, 200, 0.8);
    position: relative;
    z-index: 30;
}

.sidebar-toggle,
.sidebar-close {
    display: none;
    border: 0;
    background: white;
    color: var(--ink);
    box-shadow: var(--shadow);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-toggle {
    position: fixed;
    left: 14px;
    top: 20px;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    z-index: 50;
}

.sidebar-toggle i,
.sidebar-close i {
    font-size: 1.35rem;
}

.sidebar-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
}

.sidebar-backdrop {
    display: none;
}

.brand-block,
.panel,
.sidebar-card,
.hero,
.metric-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
}

.brand-block {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.brand-mark {
    position: relative;
    width: 54px;
    height: 54px;
}

.brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex: 0 0 auto;
}

.sidebar-logo-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 18px;
}

.sidebar-logo-wrap .brand-logo {
    width: min(100%, 220px);
    height: auto;
    max-height: 120px;
}

.auth-logo {
    width: min(100%, 420px);
    height: auto;
    max-height: 180px;
}

.orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 5px solid transparent;
}

.orbit-a {
    border-top-color: var(--green);
    border-left-color: var(--green);
    transform: rotate(10deg);
}

.orbit-b {
    inset: 10px;
    border-right-color: var(--yellow);
    border-bottom-color: var(--yellow);
}

.orbit-c {
    inset: 19px;
    background: var(--pink);
}

.eyebrow,
.section-label,
.subtle,
.hero-copy,
.metric-card small,
.sidebar-card p,
.preview-notes p,
.badge-message p,
.badge-bottom span,
.mini-brand span {
    color: var(--muted);
}

.brand-block h1,
.hero h2,
.panel h3 {
    margin: 0;
}

.hero h2,
.panel h3 {
    font-weight: 800;
}

.brand-block p,
.hero p,
.panel p,
.tips-list {
    margin: 0;
}

.nav-tabs {
    display: grid;
    gap: 10px;
    margin: 24px 0;
}

.nav-tabs a,
.primary-button,
.ghost-button {
    min-height: var(--touch);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.hero-action {
    gap: 12px;
}

.hero-cta-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.button-side-mascot {
    width: 112px;
    height: 112px;
    object-fit: contain;
    flex: 0 0 auto;
}

.nav-tabs a {
    background: white;
    box-shadow: 0 12px 28px rgba(31, 45, 76, 0.08);
}

.nav-tabs a.active,
.primary-button {
    color: white;
    background: linear-gradient(135deg, #5f9d13, #9ddc39);
    box-shadow: 0 16px 30px rgba(95, 157, 19, 0.28);
}

.ghost-button {
    border: 1px solid var(--line);
    background: var(--surface-strong);
    gap: 10px;
}

.ghost-button.danger {
    color: var(--red);
}

.small {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.92rem;
}

.icon-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
}

.icon-button i {
    font-size: 1.15rem;
    line-height: 1;
}

.sidebar-card {
    padding: 18px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.logout-form {
    margin-top: 18px;
}

.logout-button {
    width: 100%;
    justify-content: center;
    color: white;
    border: 0;
    background: linear-gradient(135deg, var(--pink), #ff6b00);
    box-shadow: 0 16px 30px rgba(228, 0, 126, 0.25);
}

.sidebar-mascot-wrap {
    margin-top: auto;
    padding-top: 22px;
    display: flex;
    justify-content: center;
}

.sidebar-mascot {
    width: min(100%, 172px);
    height: auto;
}

.sidebar-stats {
    display: grid;
    gap: 14px;
}

.sidebar-stats div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.main-content {
    padding: 26px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.hero::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -80px;
    top: -120px;
    background: radial-gradient(circle, rgba(137, 187, 20, 0.18), transparent 68%);
}

.flash-message {
    margin-top: 18px;
    padding: 14px 18px;
    border-radius: 16px;
    background: #e9fff0;
    border: 1px solid #bde6ca;
    font-weight: 700;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.metric-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.metric-card span {
    display: block;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    margin: 10px 0 4px;
    font-size: clamp(1.9rem, 4vw, 2.4rem);
}

.theme-green { border-top: 8px solid #A4007C; }
.theme-blue { border-top: 8px solid #51A49D; }
.theme-yellow { border-top: 8px solid #A2BC31; }
.theme-red { border-top: 8px solid #C1230D; }

.workspace {
    display: block;
}

.workspace-main {
    display: grid;
    gap: 20px;
    align-content: start;
}

.panel {
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow);
}

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

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(160px, 1fr)) auto;
    gap: 12px;
    align-items: center;
}

.filters-wide {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(160px, 1fr)) auto;
}

.participant-form label {
    display: grid;
    gap: 8px;
}

.participant-form label > span {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
}

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

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.payments-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.payments-list {
    display: grid;
    gap: 14px;
}

.payment-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
}

.event-list {
    display: grid;
    gap: 14px;
}

.event-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: white;
}

.event-card strong,
.event-card small {
    display: block;
}

.event-card small {
    color: var(--muted);
    margin-top: 6px;
}

.field-span-2 {
    grid-column: span 2;
}

input,
select,
textarea {
    width: 100%;
    min-height: var(--touch);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffefc;
    padding: 14px 16px;
    color: var(--ink);
}

.participant-form input,
.participant-form select,
.participant-form textarea {
    font-size: 20px;
    font-weight: 600;
}

.participant-form input::placeholder,
.participant-form textarea::placeholder {
    font-size: 20px;
    color: #8188a1;
}

.panel .section-label {
    font-size: 18px;
    font-weight: 700;
}

.panel h3 {
    font-size: 2rem;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
    outline: 3px solid rgba(21, 131, 216, 0.25);
    outline-offset: 2px;
}

.form-actions,
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

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

.form-actions {
    margin-top: 22px;
}

.error-text {
    color: var(--red);
    font-weight: 700;
}

.table-wrap {
    overflow: auto;
    border-radius: 20px;
    border: 1px solid var(--line);
}

.participants-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: white;
}

.participants-table th,
.participants-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #f0e6d6;
    text-align: left;
    vertical-align: top;
}

.participants-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff6e8;
    font-size: 0.92rem;
}

.participants-table td small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    min-height: 34px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 0.84rem;
    font-weight: 800;
}

.status-paid {
    background: var(--green-soft);
    color: #436400;
}

.status-partial {
    background: var(--yellow-soft);
    color: #8d6400;
}

.status-pending {
    background: var(--red-soft);
    color: #9b231b;
}

.inline-form {
    margin: 0;
}

.empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 320px;
    border: 2px dashed var(--line);
    border-radius: 26px;
    padding: 20px;
}

.badge-preview {
    position: relative;
    min-height: 520px;
    overflow: hidden;
    border-radius: 42px;
    background: white;
    border: 18px solid var(--green);
    padding: 22px;
}

.badge-green { border-color: var(--green); }
.badge-blue { border-color: var(--blue); }
.badge-yellow { border-color: var(--yellow); }
.badge-red { border-color: var(--red); }

.badge-blue .badge-message,
.badge-blue .badge-bottom strong,
.badge-blue .badge-bottom span { color: var(--blue); }

.badge-yellow .badge-message,
.badge-yellow .badge-bottom strong,
.badge-yellow .badge-bottom span { color: #d99300; }

.badge-red .badge-message,
.badge-red .badge-bottom strong,
.badge-red .badge-bottom span { color: var(--red); }

.badge-green .badge-message,
.badge-green .badge-bottom strong,
.badge-green .badge-bottom span { color: #679300; }

.badge-handle {
    position: absolute;
    top: 18px;
    left: 50%;
    width: 78px;
    height: 22px;
    border-radius: 999px;
    background: white;
    transform: translateX(-50%);
}

.badge-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: start;
    margin-top: 22px;
}

.mini-brand {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mini-orbit {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 4px solid var(--green);
    border-right-color: transparent;
    transform: rotate(35deg);
}

.badge-title {
    text-align: right;
    line-height: 0.95;
}

.badge-title span {
    display: block;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: var(--pink);
}

.badge-title small {
    display: inline-block;
    margin-top: 6px;
    color: white;
    background: var(--purple);
    border-radius: 14px;
    padding: 8px 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.badge-message {
    margin-top: 30px;
    padding: 16px 20px 24px;
    width: min(100%, 420px);
    border: 3px solid currentColor;
    border-radius: 32px;
}

.badge-message span {
    display: block;
    font-size: 2.3rem;
    font-weight: 900;
}

.badge-message p {
    margin: 0 0 8px;
    font-size: 1.4rem;
    font-weight: 700;
}

.badge-message strong {
    display: block;
    min-height: 70px;
    padding-top: 12px;
    border-top: 2px dashed rgba(0, 0, 0, 0.15);
    font-size: 1.5rem;
    line-height: 1.2;
}

.badge-bottom {
    position: absolute;
    left: 22px;
    right: 190px;
    bottom: 28px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.badge-bottom strong {
    display: block;
    margin-top: 8px;
    font-size: 1.3rem;
}

.badge-mascot {
    position: absolute;
    right: 24px;
    bottom: 20px;
    width: 150px;
    height: 210px;
    border-radius: 50% 50% 38% 38%;
    background: radial-gradient(circle at 36% 34%, rgba(255, 255, 255, 0.28), transparent 18%), currentColor;
    color: var(--green);
}

.badge-blue .badge-mascot { color: var(--purple); }
.badge-yellow .badge-mascot { color: #ff931e; }
.badge-red .badge-mascot { color: #cb1c1c; }

.badge-mascot::before,
.badge-mascot::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 52px;
    background: currentColor;
    bottom: -22px;
    border-radius: 999px;
}

.badge-mascot::before { left: 38px; transform: rotate(8deg); }
.badge-mascot::after { right: 38px; transform: rotate(-8deg); }

.mascot-eye {
    position: absolute;
    top: 55px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
}

.eye-left { left: 38px; }
.eye-right { right: 38px; }

.mascot-eye::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: #1b1b1b;
}

.mascot-smile {
    position: absolute;
    left: 50%;
    bottom: 56px;
    width: 72px;
    height: 36px;
    border-bottom: 6px solid white;
    border-radius: 0 0 72px 72px;
    transform: translateX(-50%);
}

.badge-confetti {
    position: absolute;
    border-radius: 999px;
    opacity: 0.9;
}

.confetti-a {
    top: 86px;
    right: 86px;
    width: 18px;
    height: 18px;
    background: var(--yellow);
}

.confetti-b {
    top: 156px;
    right: 30px;
    width: 46px;
    height: 46px;
    border: 6px solid var(--teal);
    background: transparent;
}

.confetti-c {
    left: 40px;
    bottom: 110px;
    width: 20px;
    height: 20px;
    background: var(--pink);
}

.tips-list {
    padding-left: 20px;
    display: grid;
    gap: 10px;
}

.preview-notes {
    margin-top: 16px;
}

.nav-tabs a:hover,
.primary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(360px, calc(100vw - 36px));
        max-width: 100%;
        border-right: 1px solid rgba(232, 221, 200, 0.8);
        border-bottom: 0;
        transform: translateX(-105%);
        transition: transform 220ms ease;
        overflow-y: auto;
        padding-top: 72px;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle,
    .sidebar-close {
        display: inline-flex;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(23, 32, 54, 0.34);
        z-index: 25;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

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

    .sidebar-mascot {
        width: min(100%, 146px);
    }
}

@media (max-width: 860px) {
    .main-content,
    .sidebar {
        padding: 18px;
    }

    .sidebar {
        padding-top: 72px;
    }

    .hero,
    .panel {
        padding: 18px;
    }

    .hero,
    .panel-head,
    .form-actions,
    .section-row,
    .event-card {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-action {
        width: 100%;
    }

    .hero-cta-group {
        width: 100%;
        justify-content: space-between;
    }

    .metrics-grid,
    .field-grid,
    .filters,
    .filters-wide,
    .payment-row {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: span 1;
    }

    .badge-preview {
        min-height: 580px;
    }

    .badge-bottom {
        right: 22px;
        bottom: 170px;
    }

    .badge-mascot {
        width: 120px;
        height: 170px;
    }

    .login-mascot {
        width: min(34vw, 180px);
    }

    .login-mascot-corner {
        right: 10px;
        bottom: 10px;
    }
}
