:root {
  --bg: #0b1020;
  --panel: #131a2a;
  --panel-2: #182133;
  --text: #f8fafc;
  --muted: #9aa7bd;
  --line: #273247;
  --gold: #f4c95d;
  --gold-dark: #c89f35;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --info: #60a5fa;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: #0e1524; color: var(--text); border-radius: 12px; padding: 13px 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244,201,93,.12); }
textarea { resize: vertical; }
code { background: #0e1524; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; font-size: .74rem; font-weight: 800; letter-spacing: .14em; color: var(--gold); }
.small-link { display: inline-block; margin-top: 20px; font-size: .9rem; }
.stack-lg > * + * { margin-top: 16px; }
.stack-xl > * + * { margin-top: 22px; }
.spaced-top { margin-top: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 10px 15px; font-weight: 750; text-decoration: none!important; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-primary { background: var(--gold); color: #17120a; }
.btn-primary:hover { background: #ffd96f; }
.btn-secondary { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.btn-danger { background: rgba(251,113,133,.10); border-color: rgba(251,113,133,.35); color: #fecdd3; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-lg { padding: 14px 18px; min-height: 50px; }

.flash { position: fixed; top: 16px; left: 50%; z-index: 100; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; }
.flash-success { background: #073b2f; color: #a7f3d0; border: 1px solid #11614c; }
.flash-error { background: #4a1720; color: #fecdd3; border: 1px solid #7f1d2d; }
.flash-info { background: #172554; color: #bfdbfe; border: 1px solid #1e3a8a; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #1b2740 0, #0b1020 42%); }
.auth-card { width: min(430px, 100%); padding: 34px; background: rgba(19,26,42,.94); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); text-align: center; }
.auth-card h1 { margin: 4px 0 8px; font-size: 2rem; }
.auth-card .field { text-align: left; }
.brand-mark { width: 62px; height: 62px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--gold); color: #15110a; border-radius: 18px; font-size: 2rem; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .field legend { font-size: .9rem; font-weight: 700; color: #dce5f2; }
.field small { color: var(--muted); }
fieldset.field { border: 0; padding: 0; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-wide { grid-column: 1 / -1; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; border: 1px solid var(--line); background: #0e1524; border-radius: 12px; padding: 14px; text-align: center; font-weight: 800; }
.segmented input:checked + span { border-color: var(--gold); background: rgba(244,201,93,.12); color: var(--gold); }
.time-inputs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; }
.time-inputs label { display: grid; gap: 5px; }
.time-inputs small { text-align: center; }
.time-colon { padding-top: 10px; font-size: 1.6rem; font-weight: 800; }

.staff-shell { min-height: 100vh; background: linear-gradient(180deg, #0d1424 0, #0b1020 100%); }
.staff-topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px max(18px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: rgba(11,16,32,.94); backdrop-filter: blur(12px); }
.staff-topbar h1 { margin: 0; font-size: 1.45rem; }
.staff-content { width: min(760px, 100%); margin: 0 auto; padding: 22px 18px 48px; }
.capture-form { display: grid; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.photo-panel { padding: 10px; overflow: hidden; }
.photo-picker { display: block; min-height: 320px; border: 2px dashed #3b4961; border-radius: 14px; overflow: hidden; cursor: pointer; background: #0e1524; }
.photo-picker:hover { border-color: var(--gold); }
.photo-picker img { width: 100%; height: 360px; object-fit: cover; display: block; }
.photo-placeholder { min-height: 320px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); }
.photo-placeholder strong { color: var(--text); font-size: 1.2rem; }
.camera-icon { font-size: 3rem; }
.check-row { display: flex; align-items: flex-start; gap: 13px; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--gold); }
.check-row span { display: grid; gap: 4px; }
.check-row small { color: var(--muted); line-height: 1.45; }
.strong-check { padding: 4px 0; }
.inline-note { color: var(--muted); margin: 12px 0 0 35px; font-size: .86rem; }
.email-field { margin-top: 16px; }
.btn-submit { min-height: 58px; font-size: 1.08rem; }
.submit-note { margin: -8px 4px 0; text-align: center; color: var(--muted); font-size: .82rem; }
.warning-panel { border-color: rgba(251,191,36,.35); }

.result-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.result-card { width: min(680px, 100%); overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.result-photo { width: 100%; max-height: 430px; object-fit: cover; display: block; }
.result-body { padding: 26px; text-align: center; }
.result-body h1 { margin: 10px 0 4px; font-size: 2rem; }
.result-room { margin: 0; color: var(--muted); }
.result-badge { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: .75rem; font-weight: 900; letter-spacing: .1em; }
.result-badge.escaped { background: rgba(52,211,153,.12); color: #86efac; border: 1px solid rgba(52,211,153,.3); }
.result-badge.locked { background: rgba(251,113,133,.1); color: #fecdd3; border: 1px solid rgba(251,113,133,.3); }
.big-time { margin: 16px 0 20px; font-size: 3.4rem; font-weight: 900; letter-spacing: -.04em; color: var(--gold); }
.delivery-grid { display: grid; gap: 9px; margin: 22px 0; }
.delivery-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 14px; border-radius: 12px; background: #0e1524; border: 1px solid var(--line); }

.status { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 999px; font-size: .76rem; font-weight: 800; white-space: nowrap; }
.status-pending { color: #fde68a; background: rgba(251,191,36,.12); }
.status-sent, .status-posted { color: #a7f3d0; background: rgba(52,211,153,.12); }
.status-failed { color: #fecdd3; background: rgba(251,113,133,.12); }
.status-not_configured, .status-skipped, .status-not_requested { color: #cbd5e1; background: rgba(148,163,184,.12); }

.admin-shell { background: #0a0f1c; }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: #0f1626; border-right: 1px solid var(--line); }
.admin-brand { display: flex; align-items: center; gap: 10px; color: var(--text); margin: 0 8px 28px; text-decoration: none!important; }
.admin-brand > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--gold); color: #17120a; }
.admin-brand div { display: grid; }
.admin-brand small { color: var(--muted); }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar nav a { color: #cbd5e1; padding: 10px 12px; border-radius: 9px; text-decoration: none; }
.admin-sidebar nav a:hover { background: var(--panel-2); color: var(--white); }
.sidebar-logout { margin-top: auto; }
.sidebar-logout .btn { width: 100%; }
.admin-main { min-width: 0; padding: 34px; }
.mobile-admin-header { display: none; }
.mobile-admin-nav { display: flex; gap: 14px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; }
.mobile-admin-nav a { white-space: nowrap; font-size: .84rem; color: var(--muted); }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.stat-card span { display: block; color: var(--muted); font-size: .9rem; }
.stat-card strong { display: block; margin-top: 8px; font-size: 2.1rem; }
.admin-card { padding: 22px; margin-bottom: 22px; border-radius: 17px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.admin-card h2 { margin: 0 0 16px; font-size: 1.2rem; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-heading h2 { margin-bottom: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: .91rem; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.pill-success { color: #a7f3d0; background: rgba(52,211,153,.12); }
.pill-neutral { color: #cbd5e1; background: rgba(148,163,184,.12); }
.empty-state { padding: 34px; text-align: center; color: var(--muted); }
.inline-form { display: flex; gap: 12px; align-items: end; }
.grow { flex: 1; }
.small-field { width: 120px; }
.room-list { display: grid; gap: 10px; }
.room-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0e1524; }
.room-row small { display: block; color: var(--muted); margin-top: 3px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.settings-form { display: grid; gap: 17px; max-width: 900px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.integration-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.integration-heading h2 { margin-bottom: 5px; }
.integration-heading p { margin: 0; color: var(--muted); }
.copy-box { display: grid; gap: 7px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); background: #0e1524; border-radius: 11px; overflow-wrap: anywhere; }
.copy-box span { color: var(--muted); font-size: .8rem; }
.copy-box code { padding: 0; border: 0; background: none; }
.connected-as { color: #a7f3d0; }
.integration-actions { margin-top: 22px; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(300px,.8fr); gap: 22px; }
.admin-result-photo { width: 100%; max-height: 560px; object-fit: contain; border-radius: 12px; background: #0e1524; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.delivery-admin-list { display: grid; gap: 10px; }
.delivery-admin-list > div { display: grid; grid-template-columns: 120px auto 1fr; align-items: center; gap: 12px; padding: 12px; border-radius: 11px; background: #0e1524; border: 1px solid var(--line); }
.delivery-admin-list small { color: #fda4af; overflow-wrap: anywhere; }
.danger-zone { border-color: rgba(251,113,133,.25); }
.danger-zone p { color: var(--muted); }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; display: none; }
  .admin-main { padding: 18px; }
  .mobile-admin-header { display: block; margin: -18px -18px 20px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #0f1626; }
  .mobile-admin-header a { color: var(--text); font-weight: 800; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .auth-card { padding: 26px 20px; }
  .staff-topbar { padding: 14px 16px; }
  .staff-topbar h1 { font-size: 1.2rem; }
  .photo-picker, .photo-placeholder { min-height: 260px; }
  .photo-picker img { height: 300px; }
  .panel { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .small-field { width: 100%; }
  .room-row { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .integration-heading { flex-direction: column; }
  .delivery-admin-list > div { grid-template-columns: 1fr; }
  .big-time { font-size: 2.8rem; }
}

.room-edit-form { display: grid; grid-template-columns: minmax(220px,1fr) 90px auto; gap: 10px; align-items: end; }
.room-edit-row { grid-template-columns: minmax(0,1fr) auto auto; }
@media (max-width: 680px) { .room-edit-form { grid-template-columns: 1fr; } .room-edit-row { grid-template-columns: 1fr; } }
