/* ═══════════════════════════════════════════════
   HDU Seat Helper — Sketch / Hand-drawn Theme
   Three-Column Dashboard Layout
   ═══════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg: #F5F5F0;
  --surface: #FFFFFF;
  --ink: #1a1a1a;
  --ink-soft: #555555;
  --ink-muted: #999999;
  --line: #d4d4d4;
  --line-light: #e8e8e8;
  --brand: #1a1a1a;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --green: #22c55e;
  --green-bg: #ecfdf5;
  --green-border: #86efac;
  --yellow-bg: #fef3c7;
  --yellow-ink: #92400e;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --available: #ffffff;
  --occupied: #ef4444;
  --closed: #d1d5db;
  --selected: #1a1a1a;
  --socket: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
  --font: "Inter", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --transition: 0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Three-Column Shell ── */
.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr 320px;
  min-height: 100vh;
  gap: 0;
}

/* ── Column Base ── */
.col {
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  gap: 12px;
}

.col-left {
  background: var(--surface);
  border-right: 2px solid var(--ink);
}

.col-center {
  background: var(--bg);
  padding: 24px;
  gap: 16px;
}

.col-right {
  background: var(--surface);
  border-left: 2px solid var(--ink);
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: white;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-text strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ── Status Pill ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: #16a34a;
  white-space: nowrap;
}

.status-pill.small {
  padding: 3px 8px;
  font-size: 11px;
}

.status-pill .status-dot,
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* Session badge overrides (set by JS) */
.status-pill.good,
.badge.good { background: var(--green-bg); color: #16a34a; border-color: var(--green-border); }
.status-pill.warn,
.badge.warn { background: var(--yellow-bg); color: var(--yellow-ink); border-color: #fcd34d; }
.status-pill.bad,
.badge.bad { background: var(--red-bg); color: #b91c1c; border-color: #fca5a5; }
.status-pill.neutral,
.badge.neutral { background: #f5f5f5; color: #666; border-color: var(--line); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.login-msg {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.brand-actions {
  gap: 8px;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 2px solid var(--ink);
  margin: 4px 0;
}

/* ── Section ── */
.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-fill {
  flex: 1;
  min-height: 0;
}

.section-fill .room-list,
.section-fill .candidate-list {
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.section-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.col-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.meta {
  font-size: 12px;
  color: var(--ink-muted);
}

/* ── Fields ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: box-shadow var(--transition);
}

.input:focus {
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

.input-sm { height: 34px; font-size: 13px; }
.input-xs { width: 52px; height: 28px; padding: 0 6px; font-size: 12px; text-align: center; }

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--ink);
  color: white;
}

.btn-accent {
  background: var(--ink);
  color: white;
}

.btn-outline {
  background: transparent;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
  border-color: transparent;
}

.btn-block { width: 100%; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 11px; border-width: 1.5px; }

.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Room Search ── */
.room-search-row {
  display: flex;
  gap: 8px;
}

/* ── Room List ── */
.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-list.empty {
  color: var(--ink-muted);
  font-size: 13px;
  padding: 16px 0;
}

.room-card {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  text-align: left;
  width: 100%;
  font: inherit;
}

.room-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.room-card.active {
  background: var(--ink);
  color: white;
}

.room-card.active .room-meta {
  color: rgba(255,255,255,0.7);
}

.room-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.room-meta {
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ═══ Center Column: Map ═══ */
.map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.map-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.zoom-box {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.zoom-box input[type="range"] {
  width: 100px;
  accent-color: var(--ink);
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 6px 12px;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  color: var(--ink-muted);
}

.filter-search input {
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  width: 100%;
  color: var(--ink);
}

.filter-search input::placeholder {
  color: var(--ink-muted);
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: pointer;
}

.filter-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* ── Map Canvas ── */
.map-canvas-wrap {
  flex: 1;
  min-height: 500px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}

.map-canvas-wrap.empty {
  border-style: dashed;
}

.empty-state {
  text-align: center;
  max-width: 280px;
  color: var(--ink-muted);
}

.empty-state h4 {
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.map-stage {
  position: relative;
  transform-origin: top left;
}

.plan-image {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line-light);
  background: white;
}

/* ── Seat Markers ── */
.seat-marker {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  border: 1px solid var(--ink);
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.seat-marker.available { background: var(--available); color: var(--ink); }
.seat-marker.occupied  { background: var(--occupied); color: white; cursor: not-allowed; border-color: #dc2626; }
.seat-marker.closed    { background: var(--closed); color: #6b7280; cursor: not-allowed; border-color: #9ca3af; }
.seat-marker.selected  { background: var(--selected); color: white; animation: seat-pulse 1.6s ease-in-out infinite; }
.seat-marker.dimmed    { opacity: 0.15; }

.seat-marker:hover:not([disabled]) {
  transform: scale(1.15);
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
  z-index: 2;
}

.seat-marker.socket::after {
  content: "⚡";
  position: absolute;
  font-size: 7px;
  right: -5px;
  top: -5px;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--socket);
  border-radius: 50%;
  border: 1px solid white;
  line-height: 1;
}

/* ── Mobile: compact dot markers ── */
@media (max-width: 768px) {
  .seat-marker {
    font-size: 0;
    border-radius: 50%;
    border-width: 1px;
    min-width: 6px;
    min-height: 6px;
  }
  .seat-marker.selected,
  .seat-marker:active,
  .seat-marker:focus {
    font-size: 9px;
    border-radius: 3px;
    z-index: 10;
    transform: scale(1.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }
  .seat-marker.socket::after {
    width: 6px;
    height: 6px;
    font-size: 0;
    right: -3px;
    top: -3px;
  }
}

/* ── Legend ── */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-soft);
}

.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 5px;
  border: 2px solid var(--ink);
  vertical-align: -2px;
}

.dot.available { background: var(--available); }
.dot.occupied  { background: var(--occupied); border-color: #dc2626; }
.dot.closed    { background: var(--closed); border-color: #9ca3af; }
.dot.selected  { background: var(--selected); }
.dot.socket    { background: var(--available); border-color: var(--socket); }

/* ═══ Right Column ═══ */

/* ── Appointment List ── */
.appointment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.appointment-list.empty {
  font-size: 13px;
  color: var(--ink-muted);
  padding: 8px 0;
}

.appointment-item {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
}

.appointment-item h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.appointment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--ink-muted);
}

.appointment-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.appointment-title-row h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.appointment-status.status-active {
  background: var(--green-bg);
  color: #16a34a;
  border: 1px solid var(--green-border);
}

.appointment-status.status-pending {
  background: var(--yellow-bg);
  color: var(--yellow-ink);
  border: 1px solid #fcd34d;
}

.appointment-status.status-cancelled,
.appointment-status.status-ended {
  background: #f5f5f5;
  color: #888;
  border: 1px solid var(--line);
}

.appointment-item.cancelled {
  opacity: 0.55;
}

.appointment-item.cancelled .appointment-title-row h4 {
  text-decoration: line-through;
}

.appointment-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.appointment-detail-btn,
.appointment-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: all var(--transition);
}

.appointment-detail-btn:hover,
.appointment-link:hover {
  background: var(--ink);
  color: white;
}

.appointment-cancel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: 1.5px solid var(--red);
  border-radius: 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--red);
  transition: all var(--transition);
}

.appointment-cancel-btn:hover {
  background: var(--red);
  color: white;
}

/* ── Tags (Strategy Templates) ── */
.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: all var(--transition);
}

.tag:hover {
  background: var(--ink);
  color: white;
}

.template-count-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-muted);
}

/* ── Candidate List ── */
.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-list.empty {
  font-size: 13px;
  color: var(--ink-muted);
  padding: 8px 0;
}

.candidate-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
}

.candidate-main { flex: 1; }

.candidate-main h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}

.candidate-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.candidate-reorder {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.candidate-move {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.candidate-move:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.candidate-move:not(:disabled):hover {
  border-color: var(--ink);
  color: var(--ink);
  background: #f8fafc;
}

.candidate-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  transition: all var(--transition);
}

.candidate-remove:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.candidate-order {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

/* ── Seat Detail ── */
.seat-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seat-detail.empty {
  font-size: 13px;
  color: var(--ink-muted);
}

.detail-card {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.detail-card h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-muted);
  align-items: center;
}

.detail-grid strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  max-width: 480px;
  text-align: center;
  animation: toast-in 0.3s ease;
}

.toast.error { background: #991b1b; }
.toast.hidden { display: none; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes seat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26, 26, 26, 0.24); }
  50% { box-shadow: 0 0 0 10px rgba(26, 26, 26, 0); }
}

/* ── Responsive ── */
@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .col-left, .col-right {
    border: none;
    border-bottom: 2px solid var(--ink);
  }
  .col-right {
    border-bottom: none;
    border-top: 2px solid var(--ink);
  }
  .map-canvas-wrap {
    min-height: 400px;
  }
}

/* ── Scrollbar ── */
.col::-webkit-scrollbar { width: 5px; }
.col::-webkit-scrollbar-track { background: transparent; }
.col::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.col::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* ── Template Grid (legacy compat) ── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

/* ── Appointments Section (legacy compat) ── */
.appointments-section h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Legacy button compat */
.button { /* fallback if JS creates .button elements */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: all var(--transition);
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.button.primary { background: var(--ink); color: white; }
.button.accent  { background: var(--ink); color: white; }
.button.ghost   { border-color: transparent; background: transparent; }


.compact-field {
  gap: 4px;
}


.mobile-action-bar {
  display: none;
}

@media (max-width: 960px) {
  body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .col {
    padding: 14px;
    gap: 10px;
  }

  .section-fill {
    flex: none;
    min-height: auto;
  }

  .section-fill .room-list,
  .section-fill .candidate-list {
    flex: none;
    min-height: 0;
  }

  .brand {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .map-header {
    flex-direction: column;
    gap: 10px;
  }

  .map-title {
    font-size: 19px;
  }

  .zoom-box {
    width: 100%;
    flex-wrap: wrap;
  }

  .zoom-box input[type="range"] {
    flex: 1 0 100%;
    width: 100%;
    order: 3;
  }

  .filter-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  }

  .filter-search {
    flex: 1 0 100%;
    min-height: 38px;
  }

  .filter-check {
    min-height: 36px;
    padding: 0 10px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
  }

  .filter-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .filter-bar .btn-xs {
    height: 36px;
    padding: 0 14px;
  }

  .room-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 82vw);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .room-card {
    min-height: 86px;
    scroll-snap-align: start;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  }

  .room-card.active {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  }

  .map-canvas-wrap {
    min-height: calc(100vh - 320px);
    padding: 10px;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .legend {
    gap: 10px;
    font-size: 12px;
    padding-bottom: 6px;
  }

  .btn-row {
    flex-wrap: wrap;
  }

  .btn-row > * {
    flex: 1;
    min-width: 0;
  }

  .appointment-actions {
    flex-wrap: wrap;
  }

  .mobile-action-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 2px solid var(--ink);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    z-index: 80;
  }

  .mobile-action-bar.hidden {
    display: none;
  }

  .mobile-action-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mobile-action-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
  }

  #mobileActionSummary {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-action-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .mobile-action-actions .btn {
    height: 40px;
    padding: 0 12px;
  }
}

@media (max-width: 768px) {
  .seat-marker {
    font-size: 0;
    border-radius: 50%;
    border-width: 1.5px;
    min-width: 13px;
    min-height: 13px;
  }

  .seat-marker.selected,
  .seat-marker:active,
  .seat-marker:focus {
    min-width: 20px;
    min-height: 20px;
    font-size: 10px;
    border-radius: 4px;
    z-index: 10;
    transform: scale(1.22);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  }

  .seat-marker.socket::after {
    width: 9px;
    height: 9px;
    font-size: 0;
    right: -4px;
    top: -4px;
    border-width: 1.5px;
  }

  .detail-grid {
    grid-template-columns: 56px 1fr;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    transform: none;
    max-width: none;
  }

  @keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}


.mobile-sheet-backdrop,
.mobile-sheet {
  display: none;
}

body.sheet-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .mobile-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    z-index: 88;
    display: block;
  }

  .mobile-sheet-backdrop.hidden {
    display: none;
  }

  .mobile-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 89;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(72vh, 640px);
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    border: 2px solid var(--ink);
    border-bottom: none;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.14);
    overflow: hidden;
  }

  .mobile-sheet.hidden {
    display: none;
  }

  .mobile-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-sheet-header strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
  }

  .mobile-sheet-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-sheet-tab {
    height: 38px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
  }

  .mobile-sheet-tab.active {
    border-color: var(--ink);
    background: var(--ink);
    color: white;
  }

  .mobile-sheet-content {
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
  }

  .mobile-sheet-empty {
    padding: 18px 8px 8px;
    color: var(--ink-muted);
    font-size: 13px;
    line-height: 1.6;
  }
}


.mobile-quick-nav {
  display: none;
}

@media (max-width: 960px) {
  body {
    padding-top: calc(58px + env(safe-area-inset-top, 0px));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .col-center {
    order: 1;
  }

  .col-left {
    order: 2;
  }

  .col-right {
    order: 3;
  }

  #mapSection,
  #controlColumn,
  #roomSection,
  #candidateSection,
  #scheduleSection {
    scroll-margin-top: calc(74px + env(safe-area-inset-top, 0px));
  }

  .mobile-quick-nav {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 12px;
    right: 12px;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 2px solid var(--ink);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  }

  .mobile-quick-btn {
    height: 32px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }

  .mobile-quick-btn.active {
    border-color: var(--ink);
    background: var(--ink);
    color: white;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
  }

  .mobile-quick-btn:active {
    transform: scale(0.98);
  }
}


@media (max-width: 960px) {
  .mobile-confirm-sheet {
    max-height: none;
    min-height: 0;
    gap: 12px;
  }

  .mobile-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-confirm-actions .btn {
    height: 42px;
  }

  .mobile-confirm-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 4px 4px;
  }

  .mobile-confirm-summary strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
  }

  .mobile-confirm-summary span {
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-muted);
  }
}


.mobile-panel-backdrop,
.mobile-panel-topbar {
  display: none;
}

body.panel-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .mobile-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 84;
    display: block;
  }

  .mobile-panel-backdrop.hidden {
    display: none;
  }

  .mobile-panel-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
    padding-bottom: 8px;
  }

  .mobile-panel-topbar strong {
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
  }

  .col-left,
  .col-right {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: calc(env(safe-area-inset-top, 0px) + 64px);
    z-index: 85;
    background: var(--surface);
    transform: translateY(105%);
    transition: transform 0.22s ease;
    border: none;
    box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
  }

  .col-left.mobile-panel-open,
  .col-right.mobile-panel-open {
    transform: translateY(0);
  }

  .col-right {
    border-top: 2px solid var(--ink);
  }
}


.mobile-room-strip {
  display: none;
}

@media (max-width: 960px) {
  .mobile-room-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .mobile-room-strip.hidden {
    display: none;
  }

  .mobile-room-chip {
    height: 34px;
    padding: 0 12px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }

  .mobile-room-chip.active {
    border-color: var(--ink);
    background: var(--ink);
    color: white;
  }
}
