:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687087;
  --line: #dfe4ec;
  --paper: #ffffff;
  --wash: #f3f6fa;
  --primary: #1f62e9;
  --primary-dark: #184db7;
  --success: #16824b;
  --danger: #c5362f;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--wash); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.kiosk-shell { width: min(920px, calc(100% - 28px)); margin: 0 auto; padding: 44px 0 28px; }
.hero { margin-bottom: 24px; }
.hero h1 { margin: 4px 0 8px; font-size: clamp(34px, 7vw, 58px); letter-spacing: -0.04em; }
.hero p { margin: 0; color: var(--muted); font-size: 18px; }
.eyebrow { color: var(--primary) !important; font-weight: 800; letter-spacing: .14em; }
.panel { padding: clamp(20px, 4vw, 38px); background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 36px rgba(26, 44, 78, .08); }
.step + .step { margin-top: 32px; }
.step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 22px; }
.step h2 span { display: grid; place-items: center; width: 32px; height: 32px; color: white; background: var(--primary); border-radius: 50%; font-size: 17px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.choice-button { min-height: 70px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: white; color: var(--ink); font-size: 20px; font-weight: 700; }
.choice-button:hover { border-color: #9eb8ef; }
.choice-button.selected { color: var(--primary-dark); border-color: var(--primary); background: #eef4ff; }
.people-grid .choice-button { min-height: 82px; font-size: 22px; }
.field-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 32px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 18px; font-weight: 750; }
.field small { color: var(--muted); line-height: 1.5; }
.field input, .field select { width: 100%; min-height: 58px; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; background: white; font-size: 20px; }
.field input:focus, .field select:focus { outline: 3px solid rgba(31, 98, 233, .15); border-color: var(--primary); }
.primary-button, .secondary-button { width: 100%; min-height: 64px; margin-top: 30px; border: 0; border-radius: 14px; font-size: 23px; font-weight: 800; }
.primary-button { color: white; background: var(--primary); }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { color: var(--primary); background: #eaf1ff; }
.message { min-height: 24px; margin: 14px 0 0; text-align: center; color: var(--danger); font-weight: 700; }
.success-panel { text-align: center; }
.success-mark { display: grid; place-items: center; width: 80px; height: 80px; margin: 0 auto 16px; border-radius: 50%; background: #e5f7ed; color: var(--success); font-size: 48px; font-weight: 900; }
.success-panel h2 { margin: 0 0 8px; font-size: 34px; }
.success-panel p { color: var(--muted); font-size: 18px; }
.result-code { margin-top: 22px; padding: 18px; border: 1px dashed #9eb8ef; border-radius: 12px; text-align: left; }
.result-code code { display: block; margin-top: 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
footer { padding: 22px 4px; text-align: center; }
footer a { color: var(--muted); }

.admin-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 30px 20px 22px; color: white; background: #15213a; }
.admin-sidebar .eyebrow { color: #8bb2ff !important; margin: 0 0 8px; }
.admin-sidebar h1 { margin: 0; font-size: 27px; }
.sidebar-caption { margin: 7px 0 0; color: #9eabc2; font-size: 14px; }
.admin-nav { display: grid; gap: 6px; margin-top: 38px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 9px; color: #c9d2e3; text-decoration: none; font-weight: 700; }
.admin-nav a span { color: #74829b; font-size: 12px; letter-spacing: .08em; }
.admin-nav a:hover, .admin-nav a.active { color: white; background: rgba(255, 255, 255, .1); }
.admin-nav a.active span { color: #8bb2ff; }
.sidebar-actions { display: grid; gap: 9px; margin-top: auto; }
.sidebar-actions .small-button { width: 100%; color: #d9e0ed; border-color: #3a4862; background: transparent; text-align: center; text-decoration: none; }
.sidebar-actions .small-button:hover { background: rgba(255, 255, 255, .08); }
.sidebar-actions .small-button.primary { color: white; border-color: var(--primary); background: var(--primary); }
.admin-main { min-width: 0; width: min(1180px, 100%); padding: 32px 32px 60px; }
.admin-header { margin-bottom: 14px; }
.admin-header h1 { margin: 2px 0 7px; font-size: 30px; }
.admin-header > div > p:last-child { margin: 0; color: var(--muted); }
.small-button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: white; font-weight: 700; }
.small-button.primary { color: white; border-color: var(--primary); background: var(--primary); }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.admin-card { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 15px; }
.admin-section { scroll-margin-top: 20px; }
.admin-card h2 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.admin-card label { display: grid; gap: 5px; color: var(--muted); font-size: 14px; }
.admin-card input, .admin-card select { min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.check-label { display: flex !important; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.check-label input { min-height: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 14px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #fafbfc; }
.status-on { color: var(--success); font-weight: 800; }
.status-off { color: var(--muted); }
.admin-message { min-height: 24px; color: var(--muted); }
.scene-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 18px 0 12px; }
.scene-search { flex: 1 1 280px; }
.scene-search input { width: 100%; }
.scene-list-details, .scene-edit-details { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.scene-list-details summary, .scene-edit-details summary { padding: 13px 15px; color: var(--ink); font-weight: 750; cursor: pointer; }
.scene-list-details[open] summary, .scene-edit-details[open] summary { border-bottom: 1px solid var(--line); }
.scene-list-details .table-wrap { max-height: 480px; margin: 0; overflow: auto; background: white; }
.scene-edit-details form { padding: 16px; }
.scene-check { width: 18px; height: 18px; min-height: 0 !important; accent-color: var(--primary); }
.scene-name-cell { min-width: 280px; }

@media (max-width: 720px) {
  .kiosk-shell { padding-top: 24px; }
  .field-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { display: block; }
  .admin-sidebar { position: static; height: auto; padding: 20px 16px 15px; }
  .sidebar-caption { display: none; }
  .admin-nav { grid-template-columns: repeat(5, max-content); margin-top: 18px; overflow-x: auto; padding-bottom: 4px; }
  .admin-nav a { padding: 10px 12px; white-space: nowrap; }
  .admin-nav a span { display: none; }
  .sidebar-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 15px; }
  .sidebar-actions .small-button { padding: 9px 6px; font-size: 12px; }
  .admin-main { padding: 22px 14px 44px; }
  .admin-header h1 { font-size: 25px; }
  .scene-toolbar .small-button { flex: 1 1 120px; }
}
