:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #232c38;
  --line: #2e3947;
  --text: #e6ebf2;
  --muted: #8b97a7;
  --accent: #3b82f6;
  --free: #22c55e;
  --reserved: #f59e0b;
  --seated: #ef4444;
  --grouped: #a855f7;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 28px; }
.topbar h1 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.topbar p { margin: 0; font-size: 12px; }

.legend { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot.free { background: var(--free); }
.dot.reserved { background: var(--reserved); }
.dot.seated { background: var(--seated); }
.dot.grouped { background: var(--grouped); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  padding: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- Toolbar ---------- */
.floor-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.selinfo { font-size: 14px; color: var(--muted); }
.selinfo strong { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); width: 100%; padding: 10px; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger:hover:not(:disabled) { border-color: var(--seated); color: #ffb4b4; }
.btn.ghost { background: transparent; }

/* ---------- Floor ---------- */
.floor {
  position: relative;
  width: 100%;
  height: 620px;
  background:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px) 0 0 / 40px 40px,
    #141b24;
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.room-label {
  position: absolute;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  border: 1px dashed var(--line);
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
}
.lbl-entrada { left: 12px; bottom: 12px; }
.lbl-bar { right: 12px; top: 12px; }
.lbl-cozinha { right: 12px; bottom: 12px; }
.lbl-wc { left: 12px; top: 12px; }

/* ---------- Tables ---------- */
.table {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--panel-2);
  border: 2px solid var(--free);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: transform .1s, box-shadow .15s, border-color .15s;
  border-radius: 10px;
}
.table.round { border-radius: 50%; }
.table:hover { transform: scale(1.04); z-index: 5; }
.table .t-num { font-weight: 700; font-size: 15px; line-height: 1; }
.table .t-seats { font-size: 10px; color: var(--muted); }
.table .t-name {
  font-size: 10px; margin-top: 2px; max-width: 90%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.table.free { border-color: var(--free); }
.table.reserved { border-color: var(--reserved); background: #2a2416; }
.table.seated { border-color: var(--seated); background: #2a1818; }

.table.grouped { box-shadow: 0 0 0 3px var(--grouped) inset; }
.table.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent), 0 6px 18px rgba(59,130,246,.4);
  z-index: 6;
}
.table .g-badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--grouped); color: #fff; font-size: 9px; font-weight: 700;
  padding: 2px 5px; border-radius: 20px; border: 2px solid var(--panel);
}

/* ---------- Sidebar ---------- */
.sidebar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.sidebar h2 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.badge { background: var(--panel-2); color: var(--muted); font-size: 11px; padding: 1px 8px; border-radius: 20px; }

.res-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.res-form input {
  width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 14px;
}
.res-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.res-section { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.assign-hint { background: rgba(59,130,246,.12); border: 1px solid var(--accent); padding: 8px; border-radius: 8px; }

.res-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.res-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-size: 13px;
}
.res-card .r-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.res-card .r-name { font-weight: 600; }
.res-card .r-meta { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.res-card .r-tables { color: var(--grouped); font-size: 11px; }
.res-card .r-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.res-card .btn { padding: 5px 9px; font-size: 12px; }
.res-card.seated { border-left: 3px solid var(--seated); }
.res-card.reserved { border-left: 3px solid var(--reserved); }

.empty { color: var(--muted); font-size: 12px; font-style: italic; padding: 6px 0; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 2px 0; line-height: 1.5; }
