:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --line: #d8e1eb;
  --text: #122033;
  --muted: #64748b;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  z-index: 20;
}

.brand {
  min-width: 220px;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 850;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  min-height: 36px;
  padding: 0 12px;
  background: #e2e8f0;
  color: #233044;
}

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

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

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

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

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

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 1fr 340px;
}

.sidebar,
.inspector {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.panel-title {
  font-size: 15px;
  font-weight: 850;
  margin: 0 0 12px;
}

.component-grid,
.stack {
  display: grid;
  gap: 10px;
}

.component {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  color: var(--text);
}

.component strong {
  display: block;
}

.component span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #edf2f7;
}

.canvas {
  position: relative;
  width: 1320px;
  height: 900px;
  margin: 40px;
  background-color: #f8fafc;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}

.element {
  position: absolute;
  border-radius: 8px;
  user-select: none;
}

.element.selected {
  outline: 3px solid #38bdf8;
  outline-offset: 3px;
}

.element-label {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.seat-area {
  border: 2px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.seat-grid {
  display: grid;
  gap: 8px;
}

.seat {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: white;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  overflow: hidden;
  padding: 2px;
  border: 2px solid transparent;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.16);
}

.seat.assigned {
  background: #10b981 !important;
}

.seat.locked {
  opacity: 0.48;
}

.seat.highlight {
  background: #f59e0b !important;
  color: #111827;
  border-color: #7c2d12;
  animation: pulse-seat 1.2s ease-in-out infinite;
}

@keyframes pulse-seat {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 9px rgba(245, 158, 11, 0.18);
  }
}

.round-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: #92400e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
}

.stage,
.aisle,
.exit {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
}

.stage {
  border: 2px solid #f59e0b;
  color: #92400e;
  font-size: 22px;
}

.aisle {
  color: #64748b;
}

.exit {
  color: #dc2626;
}

.form-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.form-row label {
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 10px;
  background: white;
  color: var(--text);
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.person-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.person-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.person-card strong {
  display: block;
}

.person-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.notice {
  border: 1px solid #bae6fd;
  background: #ecfeff;
  color: #155e75;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.query-shell {
  max-width: 980px;
  margin: 0 auto;
}

.query-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  padding: 14px 14px 12px;
  backdrop-filter: blur(10px);
}

.query-title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
}

.query-desc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.search-bar {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.search-bar input {
  height: 46px;
  flex: 1;
  min-width: 0;
  font-size: 16px;
}

.query-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}

.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 20px;
}

.stat span {
  color: var(--muted);
  font-size: 11px;
}

.results {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.result-card {
  background: white;
  border: 1px solid #bae6fd;
  border-left: 4px solid var(--cyan);
  border-radius: 8px;
  padding: 10px 12px;
}

.result-card strong {
  display: block;
}

.result-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.result-card em {
  display: block;
  color: #047857;
  font-style: normal;
  font-weight: 800;
  margin-top: 5px;
}

.query-map-wrap {
  height: calc(100vh - 250px);
  min-height: 420px;
  overflow: auto;
  margin: 0 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f7;
}

.query-canvas {
  position: relative;
  width: 1320px;
  height: 900px;
  transform-origin: 0 0;
  background-color: #f8fafc;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

@media (max-width: 980px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .inspector {
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .canvas-wrap {
    min-height: 560px;
  }
}
