:root {
  --charcoal: #1c2020;
  --charcoal-2: #292e2d;
  --cream: #f7f1df;
  --paper: #fffdf7;
  --coral: #f47f67;
  --coral-deep: #d95f4b;
  --amber: #e8aa4d;
  --mint: #7fc7aa;
  --ink: #202524;
  --muted: #6c7471;
  --line: #ddd8c8;
  --danger: #b84035;
  --success: #267a58;
  --shadow: 0 18px 48px rgba(45, 41, 30, 0.08);
  font-family: "Instrument Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 22px; background: var(--charcoal); color: #fff; display: flex; flex-direction: column; gap: 34px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--cream); text-decoration: none; font-size: 25px; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; border: 5px solid var(--coral); border-bottom: 0; border-radius: 15px 15px 4px 4px; display: grid; align-items: end; justify-items: center; }
.brand-mark span { width: 12px; height: 13px; background: var(--cream); display: block; }
.venue-identity { display: grid; gap: 6px; }
.eyebrow { font: 600 10px/1.2 "JetBrains Mono", monospace; letter-spacing: .12em; color: #98a09e; }
.eyebrow.dark { color: var(--coral-deep); }
.venue-identity strong { font-size: 18px; }
.connection-pill { width: fit-content; margin-top: 6px; padding: 5px 8px; border: 1px solid #505755; border-radius: 99px; color: #cbd0ce; font-size: 11px; }
.connection-pill.connected { color: #baf0d6; border-color: #4c8e73; }
.nav-list { display: grid; gap: 7px; }
.nav-list button { padding: 12px 13px; border: 0; border-radius: 10px; color: #c5cac8; background: transparent; text-align: left; }
.nav-list button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-list button.active { background: rgba(244,127,103,.17); color: #ffa28f; font-weight: 600; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.sidebar-bottom p { margin: 0; color: #737a78; font: 10px "JetBrains Mono", monospace; }

.main-content { min-width: 0; padding: 42px clamp(22px, 4vw, 60px) 120px; }
.page-header { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; margin-bottom: 24px; }
h1 { margin: 7px 0 8px; font-size: clamp(34px, 4vw, 52px); letter-spacing: -.04em; }
.page-header p { margin: 0; max-width: 680px; color: var(--muted); font-size: 16px; }
.venue-select-wrap { display: grid; gap: 7px; min-width: 220px; }
.venue-select-wrap span { font-size: 12px; color: var(--muted); font-weight: 600; }

.preview-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; padding: 14px 17px; border: 1px solid #dbbb80; background: #fff5df; border-radius: 13px; }
.preview-banner div { display: grid; gap: 2px; }
.preview-banner span { color: #74603c; font-size: 13px; }
.preview-banner[hidden] { display: none; }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 22px; align-items: start; }
.card { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.span-full { grid-column: 1 / -1; }
.section-heading { margin-bottom: 25px; }
.section-heading > div { display: flex; align-items: flex-start; gap: 14px; }
.section-heading h2 { margin: 0 0 5px; font-size: 22px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.section-heading.compact { margin-bottom: 20px; }
.event-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.step-number { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(244,127,103,.16); color: var(--coral-deep); font: 600 12px "JetBrains Mono", monospace; }
.step-number.amber { background: rgba(232,170,77,.18); color: #a26d1d; }
.step-number.mint { background: rgba(127,199,170,.22); color: #36765d; }

.field-grid { display: grid; gap: 17px; }
.field-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.four-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { min-width: 0; display: grid; gap: 7px; }
.field > span, .access-fieldset legend { font-size: 12px; font-weight: 650; color: #4c5351; }
.field em { color: #929795; font-style: normal; font-weight: 400; }
.field input, .field select, .field textarea, .venue-select-wrap select { width: 100%; border: 1px solid #d7d3c5; border-radius: 10px; background: #fff; color: var(--ink); padding: 11px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .venue-select-wrap select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(244,127,103,.14); }
.field small { color: #858b88; font-size: 11px; }
.span-2 { grid-column: span 2; }
.access-fieldset { margin: 24px 0; padding: 0; border: 0; }
.access-fieldset legend { margin-bottom: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-card { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; padding: 15px; border: 1px solid #d7d3c5; border-radius: 13px; background: #fff; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card.selected { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(244,127,103,.12); background: #fff9f5; }
.choice-icon { grid-row: span 2; color: var(--coral-deep); font-size: 20px; }
.choice-card small { color: var(--muted); line-height: 1.35; }
.checkbox-field { align-content: end; }
.toggle-label { min-height: 43px; display: flex; align-items: center; gap: 9px; border: 1px solid #d7d3c5; border-radius: 10px; background: #fff; padding: 10px 12px; font-size: 13px !important; font-weight: 500 !important; }
.toggle-label input { width: auto; accent-color: var(--coral-deep); }
.brief-card { position: sticky; top: 26px; }
.brief-info { display: flex; gap: 10px; margin-top: 14px; padding: 12px; border-radius: 10px; background: #f6edd9; color: #6d5d3e; }
.brief-info p { margin: 0; font-size: 12px; line-height: 1.45; }

.event-list { display: grid; gap: 14px; }
.event-editor { padding: 20px; border: 1px solid #ded9ca; border-radius: 16px; background: #fff; }
.event-editor-top { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: start; margin-bottom: 18px; }
.event-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--charcoal); color: var(--cream); font: 600 12px "JetBrains Mono", monospace; }
.event-editor h3 { margin: 0 0 3px; font-size: 18px; }
.event-summary { margin: 0; color: var(--muted); font-size: 12px; }
.remove-event { border: 0; background: transparent; color: var(--danger); font-size: 12px; padding: 7px; }
.changeover-row { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 12px; margin: -3px 20px; padding: 8px 14px; border-left: 2px dashed var(--amber); color: #735721; }
.changeover-row span { font: 600 10px "JetBrains Mono", monospace; }
.changeover-row strong { font-size: 12px; }
.changeover-row small { color: #8a7958; }

.action-bar { position: fixed; z-index: 10; left: 260px; right: 0; bottom: 0; min-height: 78px; padding: 14px clamp(22px, 4vw, 60px); border-top: 1px solid #d5d0c1; background: rgba(247,241,223,.94); backdrop-filter: blur(16px); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.action-buttons { display: flex; gap: 10px; margin-left: auto; }
.primary-button, .secondary-button, .ghost-button, .text-button { border-radius: 10px; font-weight: 650; }
.primary-button { min-height: 43px; padding: 10px 17px; border: 1px solid var(--coral-deep); background: var(--coral); color: #2d1a16; box-shadow: 0 8px 20px rgba(217,95,75,.18); }
.primary-button:hover { background: #fb8a72; }
.secondary-button { min-height: 40px; padding: 9px 14px; border: 1px solid #c7c3b6; background: #fff; color: var(--ink); }
.ghost-button { min-height: 42px; padding: 9px 15px; border: 1px solid #767d7a; background: transparent; color: inherit; }
.main-content .ghost-button { color: var(--ink); border-color: #c7c3b6; background: rgba(255,255,255,.45); }
.text-button { border: 0; background: transparent; color: var(--coral-deep); padding: 7px; }
.full-width { width: 100%; }
.form-message { min-height: 20px; font-size: 13px; color: var(--muted); }
.form-message.error { color: var(--danger); }
.form-message.success { color: var(--success); font-weight: 600; }
.form-message.info { color: #6d5d3e; }

.login-dialog { width: min(450px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.login-dialog::backdrop { background: rgba(20,24,23,.66); backdrop-filter: blur(5px); }
.login-dialog form { position: relative; display: grid; gap: 17px; padding: 34px; }
.login-dialog h2 { margin: -6px 0 -10px; font-size: 28px; }
.login-dialog p { margin: 0 0 2px; color: var(--muted); }
.dialog-close { position: absolute; top: 13px; right: 14px; width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 25px; }

@media (max-width: 1050px) {
  .layout-grid { grid-template-columns: 1fr; }
  .brief-card { position: static; }
  .field-grid.four-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px; display: grid; grid-template-columns: 1fr auto; gap: 16px; }
  .brand { font-size: 21px; }
  .brand-mark { width: 29px; height: 29px; }
  .venue-identity { text-align: right; justify-items: end; }
  .nav-list, .sidebar-bottom { display: none; }
  .main-content { padding: 25px 15px 105px; }
  .page-header { display: grid; align-items: start; }
  .venue-select-wrap { min-width: 0; }
  .layout-grid { gap: 14px; }
  .card { padding: 19px 15px; border-radius: 16px; }
  .field-grid.two-cols, .field-grid.four-cols, .choice-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .event-heading { display: grid; }
  .event-editor-top { grid-template-columns: 34px 1fr auto; }
  .changeover-row { grid-template-columns: auto auto; margin-left: 8px; }
  .changeover-row small { grid-column: 1 / -1; }
  .action-bar { left: 0; min-height: 72px; padding: 11px 15px; }
  .action-bar .form-message { display: none; }
}
