:root {
  --bg: #0e1220;
  --panel: #171d31;
  --panel2: #1d2440;
  --line: #2a3354;
  --text: #e6e9f5;
  --muted: #8b94b5;
  --accent: #5b8cff;
  --accent2: #3f6ee0;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --bad: #e74c3c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1, h2, h3 { margin: 0 0 12px; font-weight: 650; }
h2 { font-size: 17px; }
button { font: inherit; cursor: pointer; }
input, select {
  width: 100%; padding: 9px 11px; margin-top: 4px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label b { color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

/* buttons */
.btn {
  display: inline-block; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel2); color: var(--text); padding: 8px 14px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: #263060; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.big { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.tiny.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.next { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.next.me { background: var(--ok); border-color: var(--ok); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: rgba(231,76,60,.12); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 420px; max-width: 100%; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.brand h1 { margin: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
}
.brand.small { margin: 0; }
.brand.small .brand-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }

.login-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.login-tabs button {
  flex: 1; padding: 9px; border: 1px solid var(--line); background: var(--panel2);
  color: var(--muted); border-radius: 9px;
}
.login-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.form { display: block; }
.modal-inline { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; margin: 0; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.tabs { display: flex; gap: 6px; flex: 1; }
.tabs button {
  padding: 8px 16px; border: none; background: transparent;
  color: var(--muted); border-radius: 8px; font-weight: 550;
}
.tabs button.active { background: var(--panel2); color: var(--text); }
.userbox { display: flex; align-items: center; gap: 10px; }
.pill { background: var(--panel2); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; font-size: 13px; }

main { padding: 20px; max-width: 1200px; margin: 0 auto; }

/* inlet */
.inlet-grid { display: grid; grid-template-columns: minmax(320px, 460px) 1fr; gap: 20px; }
.ticket-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ticket-big {
  font-size: 88px; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding: 10px 0;
}

/* queue board */
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.stat-cards { display: flex; gap: 10px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 16px; min-width: 90px;
}
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 12px; color: var(--muted); }

.board { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 20px; align-items: start; }
.queue-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.queue-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  cursor: grab;
}
.queue-item.dragging { opacity: .4; }
.num {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 18px;
}
.num.big { width: 56px; height: 56px; font-size: 26px; }
.qi-info { flex: 1; display: flex; flex-direction: column; }
.qi-info b { font-size: 14px; }
.qi-info span { font-size: 12px; }

.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.provider-col { min-height: 150px; }
.provider-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.provider-head b { font-size: 15px; }
.current { border-radius: 10px; padding: 14px; min-height: 110px; border: 1px dashed var(--line); }
.current.idle { display: flex; align-items: center; justify-content: center; text-align: center; }
.current.busy { border-style: solid; border-color: var(--ok); background: rgba(46,204,113,.07); }
.cur-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.cur-actions { display: flex; gap: 8px; margin-top: 6px; }

/* stats */
.stats-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range input { width: 150px; margin: 0; }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th, .stats-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.stats-table th { color: var(--muted); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stats-table tfoot td { font-weight: 650; border-top: 2px solid var(--line); }
.stats-table.small td { font-size: 13px; }

/* presentation display (big screen) */
.display {
  min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 800px at 50% -10%, var(--panel2), var(--bg));
}
.disp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 44px; border-bottom: 1px solid var(--line);
}
.disp-head h1 { font-size: 30px; margin: 0; }
.disp-counts { display: flex; gap: 18px; font-size: 20px; color: var(--muted); }
.disp-counts b { color: var(--text); }
.disp-body {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 40px; padding: 40px; text-align: center;
}
.disp-label {
  margin: 0 0 16px; color: var(--muted); font-size: 20px;
  text-transform: uppercase; letter-spacing: .18em;
}
.disp-numbers { display: flex; gap: 32px; justify-content: center; flex-wrap: wrap; }
.disp-number {
  padding: 28px 60px; border-radius: 24px;
  background: var(--panel); border: 2px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.disp-number.multi { padding: 22px 44px; }
.disp-ticket {
  font-size: 150px; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.disp-number.multi .disp-ticket { font-size: 110px; }
.disp-ticket.muted { color: var(--muted); background: none; -webkit-background-clip: initial; background-clip: initial; }
.disp-name { font-size: 26px; }
.disp-next .disp-nextnum {
  font-size: 88px; font-weight: 700; line-height: 1;
  color: var(--ok);
}
.disp-nextname { font-size: 22px; color: var(--muted); margin: 8px 0 0; }

.disp-soundgate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14, 18, 32, .72); backdrop-filter: blur(3px);
  cursor: pointer;
}
.disp-soundgate-box { text-align: center; padding: 24px; }

/* staff management */
.stats-table input.inline, .stats-table select {
  width: 100%; max-width: 150px; margin: 0; padding: 6px 8px;
}
.staff-actions { white-space: nowrap; }
.pw {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; color: var(--warn); letter-spacing: .06em;
}
.staff-actions input.inline { max-width: 120px; }
.staff-add {
  display: grid; gap: 0 16px; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.staff-add label { margin-bottom: 0; }
.staff-add .btn { grid-column: 1 / -1; justify-self: start; margin-top: 12px; }
.disp-provider { font-size: 18px; color: var(--muted); }

@media (max-width: 860px) {
  .board, .inlet-grid { grid-template-columns: 1fr; }
  .disp-ticket { font-size: 90px; }
  .disp-number.multi .disp-ticket { font-size: 70px; }
  .disp-head { padding: 18px 20px; }
  .disp-head h1 { font-size: 20px; }
  .disp-counts { font-size: 15px; }
}
