:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --primary: #2f81f7;
  --primary-hover: #4493ff;
  --danger: #f85149;
  --success: #3fb950;
  --accent: #d29922;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', Consolas, monospace; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin-top: 10px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 14px; }

button, .btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s;
}
button:hover, .btn:hover { background: #2a323d; border-color: #3a4452; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.secondary { background: var(--surface-2); border-color: var(--border); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.lg { padding: 14px 24px; font-size: 16px; }
.btn.small { padding: 6px 12px; font-size: 13px; }

input[type="text"], input[type="password"] {
  font: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--primary); }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 28px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.auth-card input { width: 100%; }
.auth-card button { width: 100%; background: var(--primary); border-color: var(--primary); color: #fff; padding: 12px; }
.auth-card button:hover { background: var(--primary-hover); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.topbar-mid { color: var(--muted); display: flex; align-items: center; gap: 14px; }
.topbar-mid a { color: var(--muted); }
.topbar-mid a:hover { color: var(--text); }
.user-pill { display: flex; align-items: center; gap: 10px; }
.username { color: var(--muted); font-size: 14px; }

.lobby { max-width: 880px; margin: 24px auto; padding: 0 16px; }
.banner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.banner.info { border-left: 3px solid var(--primary); }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { width: 160px; text-transform: uppercase; letter-spacing: 2px; font-weight: 600; }

.tables h2 { font-size: 16px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
#tables-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.table-row {
  display: grid; grid-template-columns: 60px 1fr 60px auto;
  align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.table-row .t-id { color: var(--muted); font-family: 'SF Mono', Consolas, monospace; }
.table-row .t-host { font-weight: 500; }
.table-row .t-count { color: var(--accent); font-weight: 600; text-align: center; }
.empty { color: var(--muted); padding: 20px; text-align: center; background: var(--surface); border-radius: var(--radius); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; max-width: 420px; width: 90%; box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 14px; }
.modal-card button { margin-top: 14px; }
.code-pill { display: inline-block; padding: 8px 16px; background: var(--accent); color: #1a1300; font-weight: 700; font-size: 22px; letter-spacing: 4px; border-radius: 8px; user-select: all; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 200; max-width: 80%;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

.table-page main.table-wrap { max-width: 720px; margin: 32px auto; padding: 0 16px; }
.table-wrap h1 { font-size: 24px; margin: 0 0 8px; }
.badge { display: inline-block; padding: 2px 8px; background: var(--surface-2); border-radius: 6px; font-size: 12px; color: var(--muted); margin-left: 6px; }
.badge.host { background: var(--accent); color: #1a1300; }
.status-line { color: var(--muted); margin: 8px 0 24px; }
.seat-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.seat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; align-items: center; gap: 10px; }
.seat.empty { opacity: .55; border-style: dashed; }
.seat .seat-no { color: var(--muted); font-family: 'SF Mono', monospace; }
.seat .seat-name { font-weight: 500; }
