:root {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1f242d;
  --border: #2a313c;
  --text: #e6e9ef;
  --muted: #8b95a5;
  --accent: #4f8cff;
  --accent-2: #3a6fd8;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --err: #ff5c5c;
}

* { box-sizing: border-box; }

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

.view { display: none; height: 100vh; flex-direction: column; }
.view.active { display: flex; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--err); min-height: 1.2em; margin: 6px 0 0; }
.spacer { flex: 1; }

/* Auth */
#view-auth { align-items: center; justify-content: center; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.card h1 { margin: 0 0 4px; font-size: 22px; }
.tabs { display: flex; gap: 6px; }
.tab {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}
.tab.active { color: var(--text); border-color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }

input[type="password"], input[type="email"], input[type="text"], select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  font: inherit;
}
input:focus, select:focus { border-color: var(--accent); }

/* Dashboard layout */
.dash-body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.panel-title { font-weight: 700; margin-bottom: 10px; }

.enroll-panel .key-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.enroll-panel code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  letter-spacing: 1px;
  user-select: all;
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
}

.team-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.team-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--panel-2); border-radius: 8px;
}
.team-add { display: flex; gap: 8px; flex-wrap: wrap; }
.team-add input { flex: 1; min-width: 160px; }

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: var(--accent-2); }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
button.ghost:hover { background: var(--panel-2); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* Kiosk grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.kiosk {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, transform .05s;
}
.kiosk:hover { border-color: var(--accent); }
.kiosk:active { transform: scale(.99); }
.kiosk .name { font-weight: 700; font-size: 15px; }
.kiosk .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.kiosk .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.kiosk.busy .dot { background: var(--warn); }
.kiosk.offline { opacity: .55; }
.kiosk.offline .dot { background: var(--muted); }

/* Session */
#screen-wrap {
  position: relative;
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#screen {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: none;
  outline: none;
}
#drop-hint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(79,140,255,.15);
  border: 3px dashed var(--accent);
  pointer-events: none;
}
#screen-wrap.dragover #drop-hint { display: flex; }

#transfers {
  padding: 0 14px;
  max-height: 120px;
  overflow: auto;
}
.transfer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.transfer .bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.transfer .bar > div { height: 100%; background: var(--accent); width: 0; }

/* Toasts */
#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  animation: slidein .2s ease;
}
.toast.error { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast.ok { border-left-color: var(--ok); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
