:root {
  --accent: #1d4f91;
  --accent-soft: #e8eef7;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #dde3ea;
  --bg: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.layout { display: flex; height: 100%; }

.sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow: hidden;
}

.sidebar h1 { font-size: 1.25rem; margin: 0 0 12px; }

.day-toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.day-toggle button {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.day-toggle button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

#search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.count { color: var(--muted); font-size: 0.85rem; margin: 8px 0; }

.exhibitor-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.exhibitor-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}
.exhibitor-list li:hover { background: var(--accent-soft); }
.exhibitor-list img { width: 48px; height: 28px; object-fit: contain; flex-shrink: 0; }
.exhibitor-list .logo-placeholder { width: 48px; height: 28px; flex-shrink: 0; }
.exhibitor-list .name { flex: 1; font-size: 0.95rem; }
.exhibitor-list .booth { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.map-wrap { position: relative; flex: 1; }
#map { position: absolute; inset: 0; }

.editor {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 240px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.editor p { margin: 6px 0 10px; color: var(--muted); }
.editor label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.editor label.stacked { flex-direction: column; align-items: stretch; }
.editor input { width: 80px; }
.editor select,
.editor label.stacked input { width: 100%; }
.editor button { width: 100%; margin-top: 6px; padding: 6px; cursor: pointer; }
.editor button.primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; border-radius: 4px; }
.editor button.danger { color: #b42318; }
.editor-selected { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 0; margin: 10px 0 4px; }
.editor-status { margin: 8px 0 0; font-size: 0.8rem; }
.editor { max-height: calc(100% - 24px); overflow-y: auto; }
.editor input[type="color"] { padding: 0; height: 26px; }
.editor .tools { display: flex; gap: 4px; margin-top: 8px; }
.editor .tools button { margin: 0; border: 1px solid var(--border); background: var(--bg); border-radius: 4px; }
.editor .tools button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.editor .undo-row { display: flex; gap: 6px; }
.editor .undo-row button:disabled { opacity: 0.4; cursor: default; }

.exhibitor-list li.unplaced .booth { color: #b54708; }
body.assigning .exhibitor-list li:hover { background: #fdf0d5; }
body.editing .exhibitor-list li { cursor: grab; }

.filters { margin-top: 10px; }
.filter-group { margin-bottom: 6px; }
.filter-group .group-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.filter-group .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 10px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: 0.6; margin-left: 4px; }
.count .link { border: none; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; margin-left: 6px; text-decoration: underline; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: #1f2933;
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
  z-index: 5;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal[hidden] { display: none; }
.modal-content {
  position: relative;
  background: var(--bg);
  color: #000;
  border-radius: 10px;
  width: min(640px, calc(100% - 32px));
  max-height: calc(100% - 64px);
  overflow-y: auto;
  padding: 24px;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: none;
  font-size: 1.6rem;
  cursor: pointer;
}

.login-card { width: min(360px, calc(100% - 32px)); }
.login-card h2 { margin: 0 0 16px; font-size: 1.15rem; }
.login-card label { display: block; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); }
.login-card input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  color: var(--text);
}
.login-card button.primary {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; cursor: default; }
.login-error { min-height: 1.2em; margin: 0 0 8px; color: #b42318; font-size: 0.85rem; }
.login-cancel { display: block; margin-top: 12px; text-align: center; font-size: 0.85rem; color: var(--muted); }

.editor .account { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); }
.editor .account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor .account button.link { width: auto; margin: 0; padding: 0; border: none; background: none; color: var(--accent); text-decoration: underline; }

.fallback-card img { max-width: 200px; max-height: 80px; object-fit: contain; }
.fallback-card h2 { margin: 12px 0 4px; }
.fallback-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.fallback-card .tags span { background: var(--accent-soft); border-radius: 4px; padding: 2px 8px; font-size: 0.8rem; }
.fallback-card .about { white-space: pre-line; }
.fallback-card .links a { margin-right: 12px; }

@media (max-width: 720px) {
  .layout { flex-direction: column-reverse; }
  .sidebar { width: 100%; height: 40%; border-right: none; border-top: 1px solid var(--border); }
  .map-wrap { height: 60%; }
}
