:root {
    --maroon: #6B1F35;
    --maroon-dark: #4A1324;
    --gold: #C8963E;
    --gold-dark: #8A6420;
    --cream: #F3E3C3;
    --bg: #FBF5F6;
    --surface: #FFFFFF;
    --text: #2A1A1F;
    --muted: #6B5960;
    --border: #EADDE1;
    --success: #2F6B3F;
    --success-bg: #E3F0E6;
    --danger: #A3302A;
    --danger-bg: #F8E1DF;
    --warn: #8A6420;
    --warn-bg: #F7EBD3;
    --radius: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Hind', 'Noto Sans', system-ui, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }
a { color: var(--maroon); }
a:hover { color: var(--maroon-dark); }
h1, h2, h3 { margin: 0; }
h1 { font-family: 'Rozha One', Georgia, serif; font-weight: 400; font-size: 28px; color: var(--maroon-dark); }
h2 { font-size: 18px; font-weight: 600; }
input, select, textarea, button { font: inherit; }

/* Layout */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--maroon-dark); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 10px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent; }
.brand, .brand:hover, .mobile-brand, .mobile-brand:hover { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--maroon); border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-family: 'Rozha One', Georgia, serif; font-size: 18px; line-height: 1.1; }
.brand-name small { display: block; font-family: 'Hind', sans-serif; font-size: 12px; color: #D9BBC4; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #C9A3AE; padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: #F4E7EA; text-decoration: none; font-weight: 500; font-size: 14.5px; line-height: 1.3; }
.nav-link .icon { flex-shrink: 0; opacity: 0.8; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link.active { background: var(--maroon); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-link.active .icon { opacity: 1; color: var(--cream); }
.nav-link .tag { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: var(--maroon-dark); font-size: 12px; font-weight: 700; text-align: center; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.12); padding: 10px 12px 14px; }
.signed-in { display: block; padding: 2px 10px 6px; font-size: 12px; color: #C9A3AE; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.logout { width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }
.nav-link.logout:hover { background: rgba(255,255,255,0.08); }
.sidebar a:focus-visible, .sidebar button:focus-visible, .menu-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mobile-bar, .menu-close, .sidebar-backdrop { display: none; }
.main { padding: 24px 32px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar p { margin: 4px 0 0; color: var(--muted); }

/* Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card + .grid, .grid + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--maroon-dark); }
.stat .label { font-size: 13px; color: var(--muted); margin-top: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--maroon); background: var(--maroon); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--maroon-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--maroon); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--maroon-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2A0E18; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; color: #F4E7EA; width: 100%; justify-content: flex-start; }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-vip { background: var(--maroon-dark); color: var(--gold); border-color: var(--gold); }
.badge-featured { background: var(--cream); color: var(--gold-dark); border-color: transparent; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: #E9D3D9; color: var(--maroon); display: flex; align-items: center; justify-content: center; font-family: 'Rozha One', Georgia, serif; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; border-radius: 44px; font-size: 30px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; }
.input, select.input, textarea.input { border: 1.5px solid var(--border); border-radius: 10px; background: #fff; min-height: 40px; padding: 0 12px; color: var(--text); width: 100%; }
textarea.input { padding: 10px 12px; min-height: 100px; resize: vertical; }
.input:focus { outline: 2px solid var(--maroon); outline-offset: 1px; border-color: var(--maroon); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.error { color: var(--danger); font-size: 13px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--success-bg); color: var(--success); font-weight: 500; }
.alert-danger { background: var(--danger-bg); color: var(--danger); }

dl.details { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dl.details dt { color: var(--muted); font-size: 14px; }
dl.details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.photos { display: flex; gap: 12px; flex-wrap: wrap; }
.photo { width: 140px; display: flex; flex-direction: column; gap: 6px; }
.photo img { width: 140px; height: 180px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); background: #fff; text-decoration: none; font-size: 14px; }
.pagination .current { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.pagination .disabled { color: var(--muted); }

/* Login */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--maroon-dark); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 18px; border-top: 6px solid var(--gold); }

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    /* Phones and tablets: a top bar with a menu button; the sidebar slides in from the left. */
    .shell { grid-template-columns: minmax(0, 1fr); }
    .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--maroon-dark); color: #fff; padding: 10px 12px; box-shadow: 0 2px 10px rgba(42, 26, 31, 0.18); }
    .menu-toggle, .menu-close { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 0; border-radius: 10px; background: rgba(255,255,255,0.08); color: #fff; cursor: pointer; }
    .mobile-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: 'Rozha One', Georgia, serif; font-size: 18px; }
    .mobile-brand small { font-family: 'Hind', sans-serif; font-size: 13px; color: #D9BBC4; }
    .mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 86vw); height: 100%; transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: 4px 0 24px rgba(0,0,0,0.25); }
    .menu-open .sidebar { transform: none; }
    .menu-open { overflow: hidden; }
    .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(30, 12, 18, 0.5); }
    .sidebar-backdrop[hidden] { display: none; }
    .main { padding: 16px; }
}
@media (max-width: 760px) {
    .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
    dl.details { grid-template-columns: minmax(0, 1fr); }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
