:root {
    color-scheme: dark;
    --black: #0d0b0a;
    --panel: #211811;
    --panel-2: #302116;
    --gold: #d7a83f;
    --gold-light: #f0cf73;
    --cream: #fbf5e8;
    --muted: #b9aa96;
    --red: #a82f2f;
    --blue: #256ca6;
    --gray: #696969;
    --line: rgba(215, 168, 63, .35);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--black); color: var(--cream); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 50% 15%, #50351e 0, #18110c 42%, #090807 100%); }
.auth-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: rgba(18, 13, 10, .94); box-shadow: 0 30px 90px #000; text-align: center; }
.auth-logo { width: 150px; height: 150px; object-fit: contain; }
.auth-card h1 { margin: 8px 0 10px; font-size: 28px; }
.eyebrow, .section-label { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.4; }
.form-stack { display: grid; gap: 14px; margin-top: 25px; text-align: left; }
label { display: grid; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 650; }
input, select { width: 100%; min-height: 42px; border: 1px solid #574431; border-radius: 7px; background: #f7f2e8; color: #15110e; padding: 9px 11px; outline: none; }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(215, 168, 63, .18); }

.button { min-height: 38px; padding: 8px 15px; border-radius: 6px; border: 1px solid var(--gold); background: var(--gold); color: #120e0a; font-weight: 800; }
.button:hover { filter: brightness(1.1); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: linear-gradient(135deg, #b77d1e, var(--gold-light)); }
.button.secondary { background: transparent; color: var(--gold-light); }
.button.ghost { background: transparent; color: var(--cream); border-color: #5d4a38; }
.button.danger { background: var(--red); border-color: #d66565; color: white; }
.button.compact { min-height: 34px; padding: 5px 11px; font-size: 12px; }
.button.full { width: 100%; margin-top: 8px; }
.link-button { background: transparent; border: 0; color: var(--gold-light); margin-top: 12px; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; background: #17110d; border-bottom: 1px solid #3d2d22; position: sticky; top: 0; z-index: 50; }
.brand, .operator-area { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 9px; }
.brand div { display: grid; }
.brand strong { color: var(--gold-light); }
.brand span { color: var(--muted); font-size: 12px; }
.operator-area { font-size: 13px; }
.sync-status { color: #84c787; }
.sync-status.error { color: #f08d8d; }

.workspace { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sales-panel { padding: 20px; background: #211811; border-right: 1px solid #44301f; overflow-y: auto; max-height: calc(100vh - 68px); position: sticky; top: 68px; }
.sales-panel section { margin-bottom: 23px; }
.section-label { display: block; margin-bottom: 9px; }
.option-grid { display: grid; gap: 8px; }
.option-grid label { grid-template-columns: 18px 1fr auto; align-items: center; gap: 7px; padding: 8px; border: 1px solid #4d392a; border-radius: 7px; color: var(--cream); }
.option-grid input { width: 16px; min-height: auto; box-shadow: none; }
.option-grid b { color: var(--gold-light); font-size: 12px; }
.inline-control { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.selection-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px; background: #17110d; }
.selected-seats { min-height: 42px; font-size: 13px; line-height: 1.55; color: var(--cream); }
.selection-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid #3f3023; margin-top: 9px; padding-top: 10px; }
.selection-total strong { font-size: 20px; color: var(--gold-light); }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.summary-grid div { padding: 9px; background: #17110d; border-radius: 7px; border: 1px solid #3d2d22; }
.summary-grid b { display: block; font-size: 19px; color: var(--gold-light); }
.summary-grid span { color: var(--muted); font-size: 11px; }
.occupancy { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; }
.legend .section-label { grid-column: 1 / -1; }
.legend span:not(.section-label) { display: flex; gap: 7px; align-items: center; }
.legend i { width: 19px; height: 14px; display: inline-block; border-radius: 3px; border: 1px solid #777; }
.legend .available { background: white; }
.legend .selected { background: var(--gold); }
.legend .sold { background: var(--red); }
.legend .courtesy { background: repeating-radial-gradient(circle, #1d5f92 0 1px, #b9ddfa 1px 3px); }
.legend .blocked { background: repeating-linear-gradient(45deg, #555 0 3px, #bbb 3px 6px); }

.map-area { min-width: 0; padding: 18px 18px 28px; background: #080706; }
.map-heading { display: flex; justify-content: space-between; align-items: end; margin: 0 auto 14px; max-width: 1500px; }
.map-heading h1 { margin: 3px 0 0; font-size: 26px; }
.map-heading p { margin: 0; }
.map-tools { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.map-tools input { min-height: 20px; width: 150px; box-shadow: none; padding: 0; accent-color: var(--gold); }
.map-viewport { overflow: auto; border: 1px solid #2d2118; border-radius: 13px; background: #050505; min-height: calc(100vh - 145px); }
.seat-map { --map-scale: 1; width: 1430px; min-height: 1000px; margin: 0 auto; padding: 20px 24px 26px; transform-origin: top center; zoom: var(--map-scale); background: #050505; }
.rear-label { text-align: center; color: var(--cream); font-size: 12px; font-weight: 800; margin: 3px 0 18px; }
.seat-rows { background: linear-gradient(180deg, #302116, #24180f); border: 2px solid var(--gold); border-radius: 15px; padding: 20px 18px 24px; }
.seat-row { display: grid; grid-template-columns: 185px 55px 1fr 55px 185px; align-items: center; min-height: 45px; }
.side-block { display: grid; grid-template-columns: repeat(4, 41px); gap: 5px; align-items: center; }
.side-block.left { justify-content: end; }
.side-block.right { justify-content: start; }
.center-block { display: grid; grid-template-columns: repeat(17, 41px); gap: 5px; justify-content: center; }
.aisle { height: 34px; margin: 0 8px; border-radius: 14px; background: #5b412d; color: var(--cream); display: grid; place-items: center; font-size: 13px; font-weight: 900; line-height: 1; }
.row-badge { position: absolute; color: var(--cream); font-size: 11px; font-weight: 800; }
.seat { width: 41px; height: 31px; border: 2px solid #c99437; border-radius: 5px 5px 8px 8px; background: #fff; color: #13110f; font-size: 9px; font-weight: 850; display: grid; place-items: center; padding: 0; box-shadow: inset 0 -4px 0 rgba(0,0,0,.09); position: relative; transition: transform .11s ease, box-shadow .11s ease; }
.seat:hover, .seat.focused { transform: scale(1.65); z-index: 15; box-shadow: 0 7px 22px #000, 0 0 0 2px var(--gold-light); }
.seat.wide { width: 87px; grid-column: span 2; }
.seat.selected { background: var(--gold-light); border-color: #ffedab; }
.seat.cancel-selected { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px #a82020; z-index: 10; }
.seat.sold { background: var(--red); color: white; border-color: #e56b62; }
.seat.courtesy { color: white; border-color: #89c8f5; background: repeating-radial-gradient(circle, #1d5f92 0 1px, #73aeda 1px 3px); }
.seat.blocked { color: white; border-color: #aaa; background: repeating-linear-gradient(45deg, #4b4b4b 0 4px, #8c8c8c 4px 8px); }
.seat:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.stage { height: 150px; margin: 10px 50px 0; display: grid; grid-template-columns: 1fr 180px 1fr; align-items: center; border: 2px solid var(--gold); border-radius: 10px; background: linear-gradient(110deg, #b8791d, #f0cf73); color: #080706; font-size: 28px; font-weight: 900; letter-spacing: .28em; text-align: center; }
.stage img { height: 135px; width: 180px; object-fit: contain; background: white; }
.print-heading { display: none; }
.toast { position: fixed; top: 82px; right: 18px; max-width: 420px; padding: 12px 16px; border-radius: 8px; background: #244f2b; color: white; box-shadow: 0 10px 30px #000; z-index: 200; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8c2929; }

.modal { width: min(560px, calc(100vw - 30px)); border: 1px solid var(--gold); border-radius: 13px; background: #1c1510; color: var(--cream); padding: 0; box-shadow: 0 20px 80px #000; }
.modal::backdrop { background: rgba(0, 0, 0, .78); }
.modal form { padding: 25px; display: grid; gap: 14px; }
.modal h2 { margin: 0; }
.modal .eyebrow { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.three-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.confirm-details { padding: 14px; border-radius: 8px; background: #0f0c09; line-height: 1.7; }
.wide-modal { width: min(760px, calc(100vw - 30px)); }
.operators-list { display: grid; gap: 7px; max-height: 310px; overflow: auto; }
.operator-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 10px; border: 1px solid #4d392a; border-radius: 7px; }
.operator-row small { display: block; color: var(--muted); }
.session-manager-row { grid-template-columns: minmax(0, 1fr) auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.operator-create { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 9px; padding-top: 12px; border-top: 1px solid #4d392a; }
.recovery-code { display: block; padding: 18px; border: 2px dashed var(--gold); border-radius: 8px; background: #0f0c09; color: var(--gold-light); text-align: center; font: 800 22px Consolas, monospace; letter-spacing: .08em; user-select: all; }

@media (max-width: 900px) {
    .workspace { grid-template-columns: 1fr; }
    .sales-panel { position: static; max-height: none; border-right: 0; }
    .map-viewport { min-height: 720px; }
    .operator-area .sync-status { display: none; }
}

@media print {
    @page { size: A3 landscape; margin: 8mm; }
    :root { color-scheme: light; }
    body { background: white; color: black; }
    .topbar, .sales-panel, .map-heading, .toast { display: none !important; }
    .workspace { display: block; }
    .map-area { padding: 0; background: white; }
    .print-heading { display: block; color: black; text-align: center; margin-bottom: 6mm; }
    .print-heading h1 { margin: 0 0 2mm; }
    .map-viewport { border: 0; overflow: visible; min-height: 0; background: white; }
    .seat-map { width: 100%; min-height: 0; padding: 0; background: white; zoom: .72; }
    .seat-rows { background: white; border-color: black; }
    .rear-label, .row-badge { color: black; }
    .aisle { background: #ddd; color: black; }
    .seat { print-color-adjust: exact; -webkit-print-color-adjust: exact; border-color: black; box-shadow: none; }
    .seat:hover, .seat.focused { transform: none; box-shadow: none; }
    .seat.sold { background: black; color: white; }
    .seat.courtesy { background: repeating-radial-gradient(circle, #555 0 1px, #ddd 1px 3px); color: black; }
    .seat.blocked { background: repeating-linear-gradient(45deg, #555 0 3px, #bbb 3px 6px); color: white; }
    .seat.selected { background: white; }
    .seat.cancel-selected { outline: none; box-shadow: none; }
    .stage { height: 95px; margin-top: 5mm; color: black; border-color: black; background: #eee; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .stage img { height: 90px; filter: grayscale(1); }
}
