/* ══════════════════════════════════════════════════════════════
   TibiaBook Pro — Design System
   Dark theme inspired by the Figma/React prototype
   ══════════════════════════════════════════════════════════════ */

:root {
  /* ── New design tokens ── */
  --background:   #08080f;
  --foreground:   #f1f5f9;
  --card:         #0f0f1c;
  --popover:      #141428;
  --primary:      #6366f1;
  --primary-fg:   #ffffff;
  --secondary:    #1b1b38;
  --muted:        #141428;
  --muted-fg:     #94a3b8;
  --accent:       #1b1b38;
  --destructive:  #f87171;
  --border:       rgba(255,255,255,.07);
  --ring:         #6366f1;

  --tb-surface-2: #141428;
  --tb-surface-3: #1b1b38;
  --tb-surface-h: #222242;
  --tb-gold:      #f59e0b;
  --tb-success:   #22c55e;
  --tb-text-2:    #94a3b8;
  --tb-text-3:    #3d4458;

  /* ── Legacy aliases (for admin.html backward compat) ── */
  --bg:           var(--background);
  --surface:      var(--card);
  --surface-2:    var(--tb-surface-2);
  --surface-3:    var(--tb-surface-3);
  --surface-h:    var(--tb-surface-h);
  --text:         var(--foreground);
  --text-2:       var(--tb-text-2);
  --text-3:       var(--tb-text-3);
  --primary-h:    #7c7ff5;
  --primary-glow: rgba(99,102,241,.22);
  --gold:         var(--tb-gold);
  --gold-glow:    rgba(245,158,11,.18);
  --success:      var(--tb-success);
  --success-bg:   rgba(34,197,94,.1);
  --danger:       var(--destructive);
  --danger-bg:    rgba(248,113,113,.1);
  --border-2:     rgba(255,255,255,.13);
  --r:            12px;
  --r-sm:         8px;
  --r-xs:         5px;
  --t:            .16s ease;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--foreground);
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--tb-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */

@keyframes tb-gradient-shift {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

@keyframes tb-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

@keyframes tb-pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,.3); }
  50%       { box-shadow: 0 0 40px rgba(99,102,241,.6); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

.tb-animated-bg {
  background: linear-gradient(135deg, #08080f 0%, #0a0a18 25%, #0d0d20 50%, #0a0a18 75%, #08080f 100%);
  background-size: 400% 400%;
  animation: tb-gradient-shift 12s ease infinite;
}

.tb-card-glow  { animation: tb-pulse-glow 3s ease-in-out infinite; }
.tb-float      { animation: tb-float 4s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════
   INPUTS / SELECTS / TEXTAREA
   ══════════════════════════════════════════════════════════════ */

input, select, textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--tb-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--foreground);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color var(--t), box-shadow var(--t);
}

input::placeholder, textarea::placeholder { color: var(--tb-text-3); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

select { cursor: pointer; }
select option { background: var(--tb-surface-2); }
select:disabled { opacity: .45; cursor: not-allowed; }

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="date"],
input[type="time"] { cursor: pointer; }

input.font-mono { font-family: ui-monospace, 'Cascadia Code', monospace; letter-spacing: .05em; }

/* ══════════════════════════════════════════════════════════════
   SWITCH TOGGLE
   ══════════════════════════════════════════════════════════════ */

.tb-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.tb-switch-input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.tb-switch-slider {
  position: absolute;
  inset: 0;
  background: var(--tb-text-3);
  border-radius: 11px;
  transition: background 160ms ease;
}

.tb-switch-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 160ms ease;
}

.tb-switch-input:checked + .tb-switch-slider { background: var(--primary); }
.tb-switch-input:checked + .tb-switch-slider::before { transform: translateX(18px); }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: var(--tb-surface-3);
  color: var(--tb-text-2);
  transition: all var(--t);
  white-space: nowrap;
  user-select: none;
  min-height: 36px;
}

.btn:hover    { background: var(--tb-surface-h); color: var(--foreground); }
.btn:active   { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.btn.primary:hover { background: var(--primary-h); box-shadow: 0 4px 18px var(--primary-glow); }

.btn.gold {
  background: var(--tb-gold);
  color: #000;
  font-weight: 600;
}
.btn.gold:hover { background: #f0930a; }

.btn.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,.2);
}
.btn.danger:hover { background: var(--danger); color: #fff; border-color: transparent; }

.btn.outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--tb-text-2);
}
.btn.outline:hover { border-color: var(--border-2); color: var(--foreground); background: var(--tb-surface-2); }

.btn.small { padding: 5px 12px; font-size: 12px; min-height: 28px; }

/* ── Icon buttons ───────────────────────────────────────────── */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: none; border-radius: 6px; cursor: pointer;
  font-size: 13px; background: var(--tb-surface-3); color: var(--tb-text-2);
  transition: all var(--t); flex-shrink: 0;
}
.icon-btn:hover           { background: var(--tb-surface-h); color: var(--foreground); }
.icon-btn.primary:hover   { background: var(--primary);      color: #fff; }
.icon-btn.danger:hover    { background: var(--danger);       color: #fff; }

/* ══════════════════════════════════════════════════════════════
   NAVBAR
   ══════════════════════════════════════════════════════════════ */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.25);
  color: var(--primary);
  flex-shrink: 0;
}

.nav-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -.3px;
}

/* ── Monospace clock ─────────────────────────────────────────── */
.nav-clock {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--tb-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: ui-monospace, 'Cascadia Code', monospace;
  user-select: none;
}

#clock-hms {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}

.clock-dot-ms {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

@media (max-width: 600px) {
  .nav-clock { display: none; }
}

/* ── Nav user ────────────────────────────────────────────────── */
.nav-user { display: flex; align-items: center; gap: 10px; }

.nav-user-badge {
  display: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--tb-surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--tb-text-2);
}

@media (min-width: 480px) { .nav-user-badge { display: block; } }

.nav-logout-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  min-height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--tb-text-2);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 160ms ease;
}
.nav-logout-btn:hover { border-color: var(--destructive); color: var(--destructive); }
.nav-logout-text { display: none; }
@media (min-width: 480px) { .nav-logout-text { display: inline; } }

/* ── Admin nav badge ─────────────────────────────────────────── */
.nav-admin-badge {
  font-size: 10px;
  background: rgba(245,158,11,.12);
  color: var(--tb-gold);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 4px;
}

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.login-orb-1 {
  top: 25%; left: 25%;
  width: 24rem; height: 24rem;
  background: radial-gradient(circle, rgba(99,102,241,.12) 0%, transparent 70%);
  filter: blur(40px);
}

.login-orb-2 {
  bottom: 25%; right: 25%;
  width: 20rem; height: 20rem;
  background: radial-gradient(circle, rgba(245,158,11,.08) 0%, transparent 70%);
  filter: blur(40px);
}

.login-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 10;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.login-icon-box {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  border-radius: 16px;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.3);
  color: var(--primary);
  margin-bottom: 1rem;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--foreground);
}

.login-subtitle {
  color: var(--tb-text-2);
  font-size: 0.9rem;
  margin-top: 4px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0,0,0,.5);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1.25rem;
}

.form-field:last-child { margin-bottom: 0; }

.form-field label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--foreground);
}

.field-error {
  font-size: 12px;
  color: var(--destructive);
}

.field-hint {
  font-size: 11.5px;
  color: var(--tb-text-2);
  line-height: 1.5;
}

/* ── Password field wrapper ──────────────────────────────────── */
.pw-wrap { position: relative; }

.pw-wrap input { padding-right: 2.75rem; }

.pw-toggle-btn {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer;
  color: var(--tb-text-2);
  line-height: 0;
  padding: 4px;
}

.pw-toggle-btn:hover { color: var(--foreground); }

/* ── Submit button ───────────────────────────────────────────── */
.btn-full {
  width: 100%;
  min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all 160ms ease;
}

.btn-full.indigo {
  background: var(--primary);
  color: #fff;
}

.btn-full.indigo:hover { background: var(--primary-h); }
.btn-full.indigo:disabled { opacity: .6; cursor: not-allowed; }

.btn-full.gold-btn {
  background: var(--tb-gold);
  color: #000;
}

.btn-full.gold-btn:hover { background: #f0930a; }
.btn-full.gold-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.login-admin-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 12.5px;
  color: var(--tb-text-2);
}

.login-admin-link a {
  color: var(--primary);
  text-decoration: none;
}

.login-admin-link a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════════════════════════════ */

.dashboard-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Section ─────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
}

.section-actions { display: flex; align-items: center; gap: 8px; }

/* ── Stat cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 160ms ease;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-label {
  font-size: 12px;
  color: var(--tb-text-2);
  font-weight: 500;
}

.stat-card-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
}

/* ── Skeleton loading ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--tb-surface-2) 25%, var(--tb-surface-3) 50%, var(--tb-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s ease infinite;
  border-radius: 8px;
}

@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Panel card ──────────────────────────────────────────────── */
.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

/* ── Discord status ──────────────────────────────────────────── */
.discord-status {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 1rem;
  font-size: 13.5px;
}

.discord-status.ok    { color: var(--tb-success); }
.discord-status.err   { color: var(--destructive); }

/* ── Token hint ──────────────────────────────────────────────── */
.token-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--tb-text-2);
  line-height: 1.7;
}

ol.token-hint {
  padding-left: 1.25rem;
}

ol.token-hint li { margin-bottom: 2px; }

.token-code {
  display: block;
  background: var(--tb-surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 36px 8px 10px;
  font-size: 11px;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  color: var(--primary);
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.5;
}

.token-copy-btn {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--tb-surface-h);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--tb-text-2);
  padding: 4px 6px;
  line-height: 0;
  transition: color 160ms ease, background 160ms ease;
}

.token-copy-btn:hover { color: var(--foreground); background: var(--tb-surface-2); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-icon { color: var(--tb-text-3); }
.empty-state-text { font-size: 14px; color: var(--tb-text-2); }

/* ══════════════════════════════════════════════════════════════
   BOOKING CARDS
   ══════════════════════════════════════════════════════════════ */

.bookings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booking-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  transition: border-color 160ms ease, opacity 160ms ease;
}

.booking-card.active { border-color: rgba(99,102,241,.25); }
.booking-card.inactive { opacity: .7; }

/* Header */
.bc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.bc-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.bc-char { color: var(--foreground); }
.bc-at   { color: var(--tb-text-2); }
.bc-spot { color: var(--primary); }

.bc-sub {
  font-size: 12px;
  color: var(--tb-text-2);
  margin-top: 2px;
}

.bc-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bc-badge {
  display: inline-flex; align-items: center;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.bc-badge.recurring {
  background: rgba(34,197,94,.12);
  color: var(--tb-success);
  border: 1px solid rgba(34,197,94,.25);
}

.bc-badge.once {
  background: rgba(245,158,11,.12);
  color: var(--tb-gold);
  border: 1px solid rgba(245,158,11,.25);
}

/* Details */
.bc-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
  margin-bottom: 0.75rem;
}

@media (min-width: 500px) {
  .bc-details { grid-template-columns: repeat(3, 1fr); }
}

.bc-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tb-text-2);
}

.bc-detail svg { flex-shrink: 0; }
.bc-detail code { color: var(--foreground); font-family: monospace; }

/* Error row */
.bc-error {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 0.75rem;
  font-size: 12px;
  color: var(--destructive);
}

/* Actions */
.bc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bc-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 160ms ease;
}

.bc-btn-edit {
  background: var(--tb-surface-2);
  border: 1px solid var(--border);
  color: var(--tb-text-2);
}
.bc-btn-edit:hover { color: var(--foreground); border-color: rgba(99,102,241,.4); }

.bc-btn-test {
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.25);
  color: var(--tb-success);
}
.bc-btn-test:hover { background: rgba(34,197,94,.18); }

.bc-btn-delete {
  background: rgba(248,113,113,.08);
  border: 1px solid rgba(248,113,113,.2);
  color: var(--destructive);
}
.bc-btn-delete:hover { background: rgba(248,113,113,.15); }

/* ══════════════════════════════════════════════════════════════
   HISTORY
   ══════════════════════════════════════════════════════════════ */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hr-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 160ms ease;
}

.hr-row:hover { border-color: var(--border-2); }

.hr-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.hr-icon { flex-shrink: 0; }
.hr-icon.ok  { color: var(--tb-success); }
.hr-icon.err { color: var(--destructive); }

.hr-content { flex: 1; min-width: 0; }

.hr-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hr-at   { color: var(--tb-text-2); }
.hr-meta {
  font-size: 12px;
  color: var(--tb-text-2);
  margin-left: 6px;
}

.hr-time {
  font-size: 11px;
  color: var(--tb-text-2);
  flex-shrink: 0;
  white-space: nowrap;
  text-align: right;
}

.hr-expand-btn {
  background: none; border: none; cursor: pointer;
  color: var(--tb-text-2); padding: 2px; line-height: 0;
  flex-shrink: 0;
  transition: color 160ms ease;
}

.hr-expand-btn:hover { color: var(--foreground); }

.hr-detail {
  padding: 0 14px 10px;
}

.hr-detail-inner {
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
}

.hr-detail-inner.ok {
  background: rgba(34,197,94,.06);
  border: 1px solid rgba(34,197,94,.15);
  color: var(--tb-success);
}

.hr-detail-inner.err {
  background: rgba(248,113,113,.06);
  border: 1px solid rgba(248,113,113,.2);
  color: var(--destructive);
}

/* ══════════════════════════════════════════════════════════════
   LICENSE ACTIVATION BANNER
   ══════════════════════════════════════════════════════════════ */

.license-banner {
  background: var(--card);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: 12px;
  padding: 1.5rem;
}

.license-banner-title {
  display: flex; align-items: center; gap: 8px;
  color: var(--foreground);
  font-weight: 500;
  margin-bottom: 1rem;
}

/* ══════════════════════════════════════════════════════════════
   BOOKING MODAL
   ══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fade-in 160ms ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,.7);
  animation: modal-slide-in 200ms ease;
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 16px; font-weight: 600; color: var(--foreground); }

.modal-close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--tb-text-2); font-size: 18px; line-height: 1;
  padding: 4px; border-radius: 4px;
  transition: color 160ms ease;
}
.modal-close-btn:hover { color: var(--foreground); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-section {
  background: var(--tb-surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}

.toggle-row:first-child { padding-top: 0; }
.toggle-row:last-child  { padding-bottom: 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--border); }

.toggle-label {
  font-size: 14px;
  color: var(--foreground);
  font-weight: 500;
}

.toggle-desc {
  font-size: 12px;
  color: var(--tb-text-2);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13.5px;
  color: var(--foreground);
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 250ms ease, transform 250ms ease;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(34,197,94,.3); }
.toast.error   { border-color: rgba(248,113,113,.3); color: var(--destructive); }
.toast.loading { border-color: rgba(99,102,241,.3); }

/* ══════════════════════════════════════════════════════════════
   ADMIN PAGE — (new design)
   ══════════════════════════════════════════════════════════════ */

.admin-login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(0,0,0,.5);
}

.admin-icon-box {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.3);
  color: var(--tb-gold);
}

/* ── Tabs ────────────────────────────────────────────────────── */
.admin-tabs-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 90;
  overflow-x: auto;
}

.admin-tabs {
  display: flex;
  padding: 0 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-tab {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--tb-text-2);
  cursor: pointer; font-size: 13px; font-weight: 500;
  padding: 14px 16px 12px;
  transition: color 160ms ease, border-color 160ms ease;
  white-space: nowrap; font-family: inherit;
  min-height: 44px;
  margin-bottom: -1px;
}

.admin-tab:hover { color: var(--foreground); }

.admin-tab.active {
  border-bottom-color: var(--primary);
  color: var(--foreground);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Admin content area ──────────────────────────────────────── */
.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ── Data tables ─────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: middle;
}

.data-table th {
  color: var(--tb-text-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--tb-surface-2);
}

.data-table tbody tr:hover { background: var(--tb-surface-2); }

.data-table code {
  background: var(--tb-surface-2);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

/* ── Admin card wrapper ──────────────────────────────────────── */
.admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.admin-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
}

.admin-card-body { padding: 1.25rem 1.5rem; }

/* ── Badges ──────────────────────────────────────────────────── */
.true-badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 20px; padding: 2px 8px;
  font-size: 11px; font-weight: 500;
}

.true-badge.yes {
  background: rgba(34,197,94,.1);
  color: var(--tb-success);
  border: 1px solid rgba(34,197,94,.2);
}

.true-badge.no {
  background: rgba(248,113,113,.1);
  color: var(--destructive);
  border: 1px solid rgba(248,113,113,.2);
}

/* ── Log cells ───────────────────────────────────────────────── */
.log-response-ok   { color: var(--tb-success); font-size: 12px; }
.log-response-err  { color: var(--destructive); font-size: 12px; }
.log-response-none { color: var(--tb-text-3); font-size: 12px; }

.log-expand-btn {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 11px; padding: 0;
  text-decoration: underline; font-family: inherit;
}

.log-response-full {
  display: none;
  margin-top: 4px;
  background: var(--tb-surface-3);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 11px;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: 340px;
}

.log-response-full.visible { display: block; }

/* ── Live dot ────────────────────────────────────────────────── */
.live-dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--tb-success);
  margin-right: 5px; animation: pulse 1.5s ease-in-out infinite;
}

/* ── Calculator result grid ──────────────────────────────────── */
.calc-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.calc-result-cell {
  text-align: center;
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 8px;
  padding: 14px 8px;
}

.calc-result-label {
  font-size: 11px;
  color: var(--tb-text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.calc-result-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  font-family: ui-monospace, monospace;
  line-height: 1;
}

/* ── Calc latency info ───────────────────────────────────────── */
.calc-latency-info {
  background: var(--tb-surface-3);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  margin-top: 8px;
}

/* ── Admin actions row ───────────────────────────────────────── */
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-select {
  background: var(--tb-surface-2);
  border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  min-height: 38px;
}

/* ── New licenses display ────────────────────────────────────── */
.new-licenses {
  background: var(--tb-surface-2);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.new-licenses h4 { margin-bottom: 10px; color: var(--tb-text-2); font-size: 13px; }

.license-key {
  display: block;
  background: var(--tb-surface-3);
  padding: 8px 12px;
  border-radius: 4px;
  margin: 4px 0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--primary);
  letter-spacing: .5px;
}

/* ══════════════════════════════════════════════════════════════
   ERROR / STATUS BOXES (legacy)
   ══════════════════════════════════════════════════════════════ */

.error {
  color: var(--destructive);
  background: var(--danger-bg);
  border: 1px solid rgba(248,113,113,.2);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 10px;
}

/* ── Legacy section styles kept for admin.html ───────────────── */
.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.section h2 {
  font-size: 13px; font-weight: 600; color: var(--tb-text-2);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 1rem; display: flex; align-items: center; gap: 8px;
}

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; color: var(--tb-text-3);
  text-transform: uppercase; letter-spacing: .6px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.form-row .form-group { margin-bottom: 0; }

.checkbox-group label {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; color: var(--tb-text-2);
  text-transform: none; letter-spacing: 0; font-weight: 400;
}

/* ── Hint ────────────────────────────────────────────────────── */
.hint { font-size: 12px; color: var(--tb-text-3); margin-top: 10px; line-height: 1.6; }
.hint b { color: var(--tb-text-2); }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .bc-actions  { flex-wrap: wrap; }
  .modal-box   { max-height: 95dvh; }
  .admin-tabs  { gap: 0; }
  .admin-tab   { padding: 12px 10px 10px; font-size: 12px; }
  .calc-result-grid { grid-template-columns: repeat(2, 1fr); }
}
