:root {
  --bg: #0b1120;
  --surface: #131b2e;
  --surface-hover: #1a2540;
  --border: #1e2d4a;
  --text: #e2e8f0;
  --text-muted: #8694a9;
  --accent: #29B5E8;
  --accent-hover: #3dc5f5;
  --error: #ef4444;
  --radius: 8px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen[hidden] {
  display: none;
}

/* ───── Login Card ───── */

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.logo h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus {
  border-color: var(--accent);
}

.field input::placeholder {
  color: #4a5568;
}

.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

button[type="submit"]:hover {
  background: var(--accent-hover);
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ───── Spinner ───── */

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-large {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ───── Loading Card ───── */

.loading-card {
  text-align: center;
}

.loading-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-card p {
  color: var(--text-muted);
  font-size: 14px;
}

.link-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
}

.link-btn:hover {
  background: var(--accent-hover);
}

/* ───── Terminal Screen ───── */

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 48px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer {
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
}

.user-badge {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-end {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-end:hover {
  border-color: var(--error);
  color: var(--error);
}

.terminal-iframe {
  width: 100%;
  height: calc(100vh - 48px);
  border: none;
  background: #000;
}

#terminal-screen {
  display: flex;
  flex-direction: column;
}

#terminal-screen[hidden] {
  display: none;
}

/* ───── Admin Toggle ───── */

.admin-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 18px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ───── Admin Panel ───── */

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.admin-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.admin-section {
  margin-bottom: 28px;
}

.admin-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-section-header h3 {
  margin-bottom: 0;
}

.admin-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: nowrap;
}

.admin-row .field {
  margin-bottom: 0;
}

.admin-row .btn-admin {
  margin-bottom: 0;
  height: 42px;
  flex-shrink: 0;
}

.btn-admin {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-admin:hover {
  background: var(--accent-hover);
}

.btn-admin:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#prov-result {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  max-height: 200px;
  overflow-y: auto;
}

#prov-result .success {
  color: #22c55e;
}

#sessions-table-wrap {
  overflow-x: auto;
}

#sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#sessions-table th,
#sessions-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#sessions-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#sessions-table td {
  color: var(--text);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-available { background: rgba(34,197,94,0.15); color: #22c55e; }
.status-claimed { background: rgba(234,179,8,0.15); color: #eab308; }
.status-active { background: rgba(41,181,232,0.15); color: #29B5E8; }
.status-expired { background: rgba(239,68,68,0.15); color: #ef4444; }

.btn-delete-session {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-session:hover {
  border-color: var(--error);
  color: var(--error);
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
}
