:root {
    --bg-dark: #050604;
    --bg-darker: #020302;
    --text-main: #f7f3e8;
    --text-muted: #b9ad9a;
    --text-faint: #8a8071;
    --gold: #d8b76a;
    --gold-light: #f3dc9e;
    --honey: #e8a838;
    --amber: #d99338;
    --green: #9aab4f;
    --glass-bg: rgba(20, 18, 14, 0.72);
    --glass-bg-soft: rgba(20, 18, 14, 0.4);
    --glass-border: rgba(216, 183, 106, 0.2);
    --glass-border-strong: rgba(216, 183, 106, 0.4);
    --danger: #e07b7b;
    --danger-strong: #d64545;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-main: 'Outfit', 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.165, 0.84, 0.44, 1);
}

* { box-sizing: border-box; }

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

html { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-main);
    background:
        radial-gradient(circle at 15% -10%, rgba(232, 168, 56, 0.10), transparent 55%),
        radial-gradient(circle at 85% 0%, rgba(216, 183, 106, 0.06), transparent 50%),
        linear-gradient(160deg, var(--bg-darker) 0%, #0a0c08 55%, #000 100%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15.5px;
    padding: 2rem 1.2rem 4rem;
}

.wrap { max-width: 900px; margin: 0 auto; }
.wrap.narrow { max-width: 480px; }
.wrap.wide { max-width: 1220px; }

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--honey); }

:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Header / Brand bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.8rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--gold-light);
}
.brand img {
    height: 36px;
    width: 36px;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid var(--glass-border-strong);
}

/* ---------- Typography ---------- */

h1, h2, h3 { color: var(--text-main); line-height: 1.3; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; margin: 0 0 0.35rem; }
h2 {
    font-size: 1.05rem;
    margin: 0 0 1rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--glass-border), transparent);
}
.subtitle { color: var(--text-muted); margin: 0 0 1.8rem; font-size: 0.95rem; max-width: 60ch; }

/* ---------- Cards ---------- */

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.8rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
}
.card + .card { margin-top: -0.4rem; }
.card-form { max-width: 640px; }

/* ---------- Forms ---------- */

fieldset { border: none; padding: 0; margin: 0 0 1.6rem; }
fieldset:last-of-type { margin-bottom: 0; }

label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold-light);
    margin: 1.1rem 0 0.4rem;
}
label:first-child { margin-top: 0; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0 1rem;
}
.field-row > div > label { margin-top: 1.1rem; }
.field-row > div:first-child > label,
.field-row > div > label:first-child { margin-top: 1.1rem; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="password"], input[type="date"], select, textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { min-height: 90px; resize: vertical; }

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23d8b76a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.4rem;
    cursor: pointer;
}

input:hover, select:hover, textarea:hover { border-color: var(--glass-border-strong); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold-light);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(216, 183, 106, 0.16);
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 19px;
    height: 19px;
    min-width: 19px;
    border-radius: 5px;
    border: 1px solid var(--glass-border-strong);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
    vertical-align: middle;
}
input[type="checkbox"]::before {
    content: '';
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: transform 0.12s var(--ease);
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    background: #080603;
}
input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--amber), var(--gold), var(--honey));
    border-color: var(--gold-light);
}
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus-visible { outline-offset: 2px; }

label.checkbox-line, .checkbox-line {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-main);
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    margin: 1.1rem 0 0;
}
.checkbox-line label,
.checkbox-line span { margin: 0; text-transform: none; letter-spacing: normal; font-weight: 500; color: var(--text-main); }

.hint { font-size: 0.8rem; color: var(--text-faint); margin-top: 0.35rem; }

.info-box {
    background: var(--glass-bg-soft);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    margin: 1.2rem 0 1.6rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
}
.info-box strong { color: var(--gold-light); }
.info-box a { color: var(--gold-light); text-decoration: underline; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.82rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease), opacity 0.18s var(--ease);
    white-space: nowrap;
}
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: linear-gradient(135deg, var(--amber), var(--gold), var(--honey));
    background-size: 160% 160%;
    color: #080603;
    box-shadow: 0 4px 18px rgba(216, 183, 106, 0.28);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(232, 168, 56, 0.4);
    background-position: 100% 0;
    color: #080603;
}
.btn-outline {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--glass-border-strong);
    color: var(--gold-light);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(216, 183, 106, 0.1);
    border-color: var(--gold-light);
    color: var(--gold-light);
}
.btn-danger {
    background: rgba(217, 106, 106, 0.12);
    border-color: rgba(217, 106, 106, 0.4);
    color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: var(--danger-strong);
    border-color: var(--danger-strong);
    color: #1a0505;
}
.btn-sm { padding: 0.44rem 1rem; font-size: 0.72rem; }

/* ---------- Tables ---------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; min-width: 560px; }
th, td { text-align: left; padding: 0.75rem 0.9rem; }
thead th {
    color: var(--gold-light);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    font-weight: 800;
    background: rgba(216, 183, 106, 0.06);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
}
tbody tr { border-bottom: 1px solid rgba(216, 183, 106, 0.1); transition: background 0.15s var(--ease); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(216, 183, 106, 0.05); }
tbody td { color: var(--text-muted); }
tbody td:first-child { color: var(--text-main); font-weight: 600; }
tbody td a { font-weight: 700; }

/* Bare table (no wrapper needed, e.g. inside a card that's already scroll-safe) */
.table-wrap table { border: none; }

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.75rem;
    border-radius: 50px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-pending { background: rgba(217, 147, 56, 0.14); color: var(--honey); border-color: rgba(217, 147, 56, 0.3); }
.badge-rejected { background: rgba(217, 106, 106, 0.14); color: var(--danger); border-color: rgba(217, 106, 106, 0.3); }
.badge-issued { background: rgba(154, 171, 79, 0.14); color: var(--green); border-color: rgba(154, 171, 79, 0.3); }
.badge-completed { background: rgba(216, 183, 106, 0.18); color: var(--gold-light); border-color: rgba(216, 183, 106, 0.35); }

/* ---------- Flash messages ---------- */

.flash {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    border: 1px solid;
    line-height: 1.5;
}
.flash::before {
    content: '';
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 0.1rem;
    background-repeat: no-repeat;
    background-position: center;
}
.flash-success {
    background: rgba(154, 171, 79, 0.1);
    border-color: rgba(154, 171, 79, 0.35);
    color: var(--text-main);
}
.flash-success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aab4f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.flash-error {
    background: rgba(217, 106, 106, 0.1);
    border-color: rgba(217, 106, 106, 0.35);
    color: var(--text-main);
}
.flash-error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e07b7b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E");
}

/* ---------- Participant rows ---------- */

.participant-row {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1fr auto;
    gap: 0.7rem;
    align-items: end;
    padding: 0.9rem;
    margin-bottom: 0.6rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}
.participant-row label { margin-top: 0; }
.row-actions { display: flex; gap: 0.7rem; margin-top: 1.2rem; flex-wrap: wrap; }

/* ---------- Menu options ---------- */

.menu-option {
    position: relative;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem 1rem 3rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
    background: rgba(255, 255, 255, 0.015);
}
.menu-option:hover { border-color: var(--glass-border-strong); background: rgba(216, 183, 106, 0.04); }
.menu-option input { position: absolute; left: 1.1rem; top: 1.15rem; margin: 0; }
.menu-option .name { font-weight: 700; color: var(--gold-light); }
.menu-option .desc { color: var(--text-muted); font-size: 0.87rem; margin-top: 0.3rem; white-space: pre-line; line-height: 1.6; }

/* ---------- Price tag ---------- */

.price-tag {
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--gold-light);
    letter-spacing: -0.02em;
}
.price-tag small { font-size: 1rem; color: var(--text-muted); font-weight: 600; letter-spacing: normal; }

/* ---------- Admin nav ---------- */

nav.admin-nav {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1.8rem;
    font-size: 0.82rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0.35rem;
}
nav.admin-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
nav.admin-nav a:hover { color: var(--gold-light); background: rgba(216, 183, 106, 0.08); }
nav.admin-nav a.active {
    color: #080603;
    background: linear-gradient(135deg, var(--amber), var(--gold), var(--honey));
}

/* ---------- Filters ---------- */

.filters { display: flex; gap: 0.5rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.filters a {
    padding: 0.42rem 1.05rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.filters a:hover { border-color: var(--glass-border-strong); color: var(--text-main); }
.filters a.active { border-color: var(--gold-light); color: var(--gold-light); background: rgba(216, 183, 106, 0.08); }

/* ---------- Summary grid ---------- */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.7rem 1.6rem;
    margin-bottom: 0.5rem;
}
.summary-grid dt { color: var(--text-faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.summary-grid dd { margin: 0.2rem 0 0.9rem; color: var(--text-main); }

/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-faint);
}
.empty-state svg { opacity: 0.4; margin-bottom: 0.8rem; }

/* ---------- Misc utility ---------- */

.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.divider { height: 1px; background: var(--glass-border); margin: 1.6rem 0; border: none; }
.review-confirmation {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-right: 0.6rem;
    color: var(--gold-light);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.review-confirmation input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--gold-light);
}
.invoice-entry-code {
    display: grid;
    gap: 0.35rem;
    margin: 1.5rem 0;
    padding: 1rem 1.2rem;
    border: 1px solid var(--gold-light);
    background: rgba(216, 183, 106, 0.08);
    text-align: center;
}
.invoice-entry-code span {
    color: var(--gold-light);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.invoice-entry-code strong { font-size: 1.15rem; }
.invoice-entry-code small { color: var(--text-muted); }
.invoice-action-form,
.invoice-cancel-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    margin: 0.35rem 0;
}
.invoice-cancel-form select {
    min-width: 165px;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
}
.invoice-cancel-reason {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
}
.registration-cancel-form {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 1.4rem 0;
    padding: 1rem;
    border: 1px solid rgba(220, 90, 90, 0.35);
    background: rgba(160, 30, 30, 0.07);
}
.registration-cancel-form input[type="text"] {
    flex: 1;
    min-width: 240px;
}
.invoice-document-preview {
    overflow: auto;
    margin: 1rem 0 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--glass-border-strong);
    background: #fff;
    color: #1a1a1a;
    border-radius: 4px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}
.invoice-document-preview h1,
.invoice-document-preview h2,
.invoice-document-preview h3,
.invoice-document-preview p,
.invoice-document-preview td,
.invoice-document-preview th,
.invoice-document-preview strong {
    color: #1a1a1a;
}
.invoice-review-panel {
    min-width: 310px;
    margin-bottom: 0.7rem;
}
.invoice-review-panel summary {
    color: var(--gold-light);
    font-weight: 800;
    cursor: pointer;
}
.invoice-review-panel[open] {
    position: relative;
    z-index: 2;
}
.invoice-review-panel .invoice-document-preview {
    width: min(720px, 80vw);
    max-height: 720px;
}
.invoice-manual-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.7rem 0;
}
.invoice-manual-sent-form {
    margin: 0.6rem 0;
}
.invoice-html-copy-panel {
    margin: 0.7rem 0;
    padding: 0.7rem;
    border: 1px solid var(--glass-border-strong);
    border-radius: 4px;
}
.invoice-html-copy-panel summary {
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
}
.invoice-html-source {
    display: block;
    width: 100%;
    min-height: 190px;
    margin: 0.7rem 0;
    padding: 0.75rem;
    resize: vertical;
    background: #080808;
    color: #f5f1e8;
    border: 1px solid var(--glass-border-strong);
    font-family: Consolas, Monaco, monospace;
    font-size: 0.76rem;
    line-height: 1.45;
}
.invoice-copy-status {
    margin-left: 0.55rem;
    color: var(--gold-light);
    font-weight: 700;
}
.guest-count-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.guest-count-form input[type="number"] {
    width: 82px;
    min-width: 82px;
    padding: 0.45rem 0.55rem;
}
.invoice-person-row {
    grid-template-columns: minmax(240px, 2fr) 0.6fr 0.9fr auto;
    align-items: end;
}
.free-participant-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--gold-light);
    font-weight: 800;
    cursor: pointer;
}
.free-participant-toggle input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--gold-light); }
.free-participant-toggle small { color: var(--text-muted); font-weight: 600; }

@media (max-width: 700px) {
    body { padding: 1.2rem 0.9rem 3rem; font-size: 15px; }
    .card { padding: 1.4rem 1.3rem; }
    .participant-row { grid-template-columns: 1fr; }
    nav.admin-nav { border-radius: var(--radius-md); }
    .price-tag { font-size: 2.1rem; }
}
