/* ============================================================
   ENTERTAIN PRO — Design System v2.0
   Modernised for training platform deployment
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ─── TOKENS ──────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:        #1a6ef5;
  --brand-hover:  #1559cc;
  --brand-light:  #e8f0fe;
  --brand-muted:  #93b4fa;

  /* Neutrals */
  --bg:           #f0f2f7;
  --surface:      #ffffff;
  --surface-2:    #f7f8fc;
  --border:       #e2e6f0;
  --border-strong:#c8cedc;

  /* Text */
  --text-1:       #0f1623;
  --text-2:       #4a5166;
  --text-3:       #8891a8;
  --text-inv:     #ffffff;

  /* Sidebar */
  --sidebar-w:    256px;
  --sidebar-bg:   #0f1623;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-active: rgba(26,110,245,0.18);
  --sidebar-hover: rgba(255,255,255,0.06);

  /* Semantic */
  --success:      #0fa855;
  --success-bg:   #e6f7ee;
  --success-text: #0a7a3e;
  --warning:      #d97706;
  --warning-bg:   #fef3e2;
  --warning-text: #92530a;
  --danger:       #e03131;
  --danger-bg:    #fff0f0;
  --danger-text:  #b02020;
  --info:         #1a6ef5;
  --info-bg:      #e8f0fe;
  --info-text:    #1559cc;
  --purple:       #7c3aed;
  --purple-bg:    #f3effe;
  --purple-text:  #5b21b6;

  /* Training */
  --training:     #f59e0b;
  --training-bg:  #fffbeb;
  --training-text:#92400e;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(15,22,35,0.06), 0 1px 2px rgba(15,22,35,0.04);
  --shadow-md: 0 4px 16px rgba(15,22,35,0.08), 0 2px 6px rgba(15,22,35,0.04);
  --shadow-lg: 0 10px 40px rgba(15,22,35,0.12), 0 4px 12px rgba(15,22,35,0.06);

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4,0,0.2,1);
  --t-base: 220ms cubic-bezier(0.4,0,0.2,1);
  --t-slow: 350ms cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  display: flex;
  height: 100vh;
  overflow: hidden;
  line-height: 1.6;
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--sidebar-border);
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--brand);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-icon svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-brand-tagline {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}

.sidebar-section {
  padding: 20px 10px 6px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: all var(--t-fast);
  margin-bottom: 1px;
  font-weight: 400;
}

.sidebar a svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar a:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.9);
}

.sidebar a:hover svg { opacity: 1; }

.sidebar a.active {
  background: var(--sidebar-active);
  color: var(--brand-muted);
  font-weight: 500;
}

.sidebar a.active svg {
  opacity: 1;
  color: var(--brand-muted);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar a.danger-link {
  color: rgba(224,49,49,0.75);
}

.sidebar a.danger-link:hover {
  background: rgba(224,49,49,0.1);
  color: #ff6b6b;
}

/* Training Mode Banner (inside sidebar) */
.training-banner {
  margin: 10px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.training-banner-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--training);
  margin-bottom: 4px;
}

.training-banner-timer {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  color: var(--training);
  letter-spacing: 0.05em;
}

.training-banner-sub {
  font-size: 11px;
  color: rgba(245,158,11,0.7);
  margin-top: 2px;
}

/* ─── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-header-left {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-3);
}

.page-body {
  padding: 28px 32px;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ─── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

/* Accent cards */
.card-accent-blue  { border-left: 3px solid var(--brand); }
.card-accent-green { border-left: 3px solid var(--success); }
.card-accent-amber { border-left: 3px solid var(--warning); }
.card-accent-red   { border-left: 3px solid var(--danger); }
.card-accent-purple{ border-left: 3px solid var(--purple); }

/* ─── STATS GRID ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base);
}

.stat-box:hover { box-shadow: var(--shadow-md); }

.stat-box p {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-box h2 {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-box .stat-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}

.stat-box .stat-link {
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
  margin-top: 6px;
  display: inline-block;
}

/* ─── TABLES ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -4px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--t-fast);
}

tbody tr:hover { background: var(--surface-2); }

/* ─── FORMS ───────────────────────────────────────────────── */
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  margin-bottom: 16px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,110,245,0.12);
}

input:disabled, select:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%238891a8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

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

.form-group {
  margin-bottom: 16px;
}

.form-group label { margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea { margin-bottom: 0; }

.form-row {
  display: grid;
  gap: 16px;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ─── BUTTONS ─────────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

button svg, .btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Primary */
.btn-primary, button[type="submit"], button:not([class]) {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover, button[type="submit"]:hover, button:not([class]):hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,110,245,0.3);
}

/* Secondary */
.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-strong);
}

/* Danger */
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(224,49,49,0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Success */
.btn-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(15,168,85,0.2);
}

.btn-success:hover {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

/* Warning */
.btn-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(217,119,6,0.2);
}

.btn-warning:hover {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

/* Sizes */
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* ─── BADGES & PILLS ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-active, .status-active   { background: var(--success-bg); color: var(--success-text); }
.badge-inactive, .status-inactive { background: var(--danger-bg); color: var(--danger-text); }
.badge-pending, .status-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-info                     { background: var(--info-bg); color: var(--info-text); }
.badge-primary                  { background: var(--brand-light); color: var(--brand-hover); }
.badge-purple                   { background: var(--purple-bg); color: var(--purple-text); }
.badge-training                 { background: var(--training-bg); color: var(--training-text); }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

/* ─── ALERTS / NOTICES ────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(217,119,6,0.25);
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(224,49,49,0.25);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(15,168,85,0.25);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: rgba(26,110,245,0.25);
}

/* ─── TRAINING TASK CARD ──────────────────────────────────── */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.task-card-header {
  background: linear-gradient(135deg, #0f1623 0%, #1a2840 100%);
  padding: 18px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.task-card-scenario {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

.task-timer {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--training);
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--r-sm);
  padding: 6px 14px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.task-timer.urgent { color: var(--danger); background: var(--danger-bg); border-color: rgba(224,49,49,0.3); }

.task-card-body {
  padding: 20px 22px;
}

.task-audio-player {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.task-audio-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.task-audio-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}

.task-audio-icon {
  width: 38px;
  height: 38px;
  background: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.task-audio-icon:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(26,110,245,0.35);
}

.task-audio-icon svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.task-instructions {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 14px;
}

.task-instructions strong { color: var(--text-1); }

.task-steps {
  list-style: none;
  counter-reset: step-counter;
  margin-bottom: 18px;
}

.task-steps li {
  counter-increment: step-counter;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-2);
}

.task-steps li:last-child { border-bottom: none; }

.task-steps li::before {
  content: counter(step-counter);
  width: 22px;
  height: 22px;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.task-steps li.done { color: var(--text-3); text-decoration: line-through; }
.task-steps li.done::before { background: var(--success-bg); color: var(--success); }

/* ─── LOGIN PAGE ──────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  height: 100vh;
  width: 100%;
  background: var(--bg);
}

.auth-panel {
  width: 420px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  flex-shrink: 0;
}

.auth-visual {
  flex: 1;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-visual-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(26,110,245,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,110,245,0.07) 1px, transparent 1px);
  background-size: 40px 40px;
}

.auth-visual-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px;
  max-width: 380px;
}

.auth-visual-title {
  font-size: 28px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-visual-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--brand);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-icon svg { width: 22px; height: 22px; fill: white; }

.auth-logo-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-1);
}

.auth-heading {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.auth-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 28px;
}

.auth-error {
  background: var(--danger-bg);
  border: 1px solid rgba(224,49,49,0.25);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--danger-text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-switch {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

.auth-switch a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

/* ─── PROFILE PANEL (Staff Dashboard) ────────────────────── */
.dashboard-layout {
  display: flex;
  gap: 0;
  height: 100%;
  overflow: hidden;
}

.list-section {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
}

.profile-panel {
  width: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--t-slow);
  visibility: hidden;
  flex-shrink: 0;
}

.profile-panel.active {
  width: 680px;
  visibility: visible;
}

.profile-panel-inner {
  width: 680px;
  padding: 22px;
}

.profile-hero {
  background: var(--sidebar-bg);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.profile-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.profile-num {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.profile-balance {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  color: var(--brand-muted);
  line-height: 1;
  margin-top: 4px;
}

.profile-balance-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

/* ─── DECODER CARD ────────────────────────────────────────── */
.decoder-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 14px;
}

.decoder-header {
  background: var(--sidebar-bg);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.decoder-serial {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #fff;
  font-weight: 500;
}

.decoder-model {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

.decoder-body { padding: 12px 14px; }

.package-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.package-item.primary  { border-left-color: var(--brand); }
.package-item.addon    { border-left-color: var(--purple); }
.package-item.grace    { border-left-color: var(--warning); background: var(--warning-bg); }
.package-item.expired  { border-left-color: var(--text-3); opacity: 0.7; }

/* ─── DAYS BADGES ─────────────────────────────────────────── */
.days-good    { background: var(--success-bg); color: var(--success-text); }
.days-warning { background: var(--warning-bg); color: var(--warning-text); }
.days-danger  { background: var(--danger-bg);  color: var(--danger-text); }

/* ─── SEARCH BAR ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 9px 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-bar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,110,245,0.1);
}

.search-bar svg {
  width: 17px;
  height: 17px;
  color: var(--text-3);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-1);
  width: 100%;
  margin-bottom: 0;
  padding: 0;
}

/* ─── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,22,35,0.55);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in var(--t-base) both;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  transition: background var(--t-fast), color var(--t-fast);
  padding: 0;
}

.modal-close:hover { background: var(--surface-2); color: var(--text-1); }
.modal-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); }

/* ─── TRANSACTION ROWS ────────────────────────────────────── */
.tx-credit { color: var(--success); font-weight: 600; }
.tx-debit  { color: var(--danger);  font-weight: 600; }
.tx-transfer { color: var(--purple); font-weight: 600; }

/* ─── UTILITY ─────────────────────────────────────────────── */
.text-muted  { color: var(--text-3); }
.text-small  { font-size: 12px; }
.mono        { font-family: 'DM Mono', monospace; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }

code, .code {
  font-family: 'DM Mono', monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-2);
}

/* ─── ACTION LINKS ────────────────────────────────────────── */
.action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all var(--t-fast);
}

.action-link:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* ─── TRAINING PROGRESS BAR ───────────────────────────────── */
.progress-wrap {
  background: var(--surface-2);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  border-radius: 100px;
  background: var(--brand);
  transition: width 0.5s ease;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  stroke: var(--border-strong);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 14px;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.6;
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  body { flex-direction: column; height: auto; overflow: auto; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; }
  .main-content { height: auto; }
  .profile-panel.active { width: 100%; }
  .auth-panel { width: 100%; }
  .auth-visual { display: none; }
  .page-body { padding: 16px; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 12px; }
}

/* ─── SCROLL ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ─── SWEETALERT2 OVERRIDES ───────────────────────────────── */
.swal2-popup {
  font-family: 'DM Sans', sans-serif !important;
  border-radius: var(--r-xl) !important;
  padding: 28px !important;
}

.swal2-title { font-size: 18px !important; font-weight: 600 !important; }
.swal2-html-container { font-size: 14px !important; }
.swal2-confirm { font-family: 'DM Sans', sans-serif !important; border-radius: var(--r-sm) !important; font-weight: 500 !important; }
.swal2-cancel  { font-family: 'DM Sans', sans-serif !important; border-radius: var(--r-sm) !important; font-weight: 500 !important; }
.swal2-input, .swal2-textarea { font-family: 'DM Sans', sans-serif !important; border-radius: var(--r-sm) !important; }
/* SweetAlert inputs (password prompts etc.): the global input rule (width:100% + margin-bottom) plus
   SweetAlert's own side margins pushed the field off-centre and past the right edge. Centre it inside
   the dialog at a fixed, comfortable width, with the label text and the buttons on the same axis. */
.swal2-popup :is(input.swal2-input, select.swal2-select, textarea.swal2-textarea) {
  width: calc(100% - 3em); max-width: 360px; margin: 14px auto 4px; display: block; box-sizing: border-box;
  height: 44px; padding: 0 14px; font-size: 15px; text-align: left;
}
.swal2-popup textarea.swal2-textarea { height: auto; min-height: 90px; padding: 10px 14px; max-width: 420px; }
.swal2-popup .swal2-validation-message { margin: 10px auto 0; max-width: 360px; }

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — Additional breakpoints
   ═══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
    .profile-col.open     { width: 480px; }
    .profile-inner        { width: 480px; }
    .stats-grid           { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .col-2, .col-3-1      { grid-template-columns: 1fr; }
}

.mobile-notice{display:none;}
.impersonate-ribbon{background:var(--warning-bg,#fef3c7);color:var(--warning-text,#92400e);text-align:center;font-size:12.5px;font-weight:600;padding:7px 16px;position:fixed;top:8px;left:50%;transform:translateX(-50%);z-index:9999;border-radius:20px;box-shadow:0 4px 14px rgba(0,0,0,.18);white-space:nowrap;} /* fixed pill: body is a flex row, an in-flow ribbon became a whole column */
.impersonate-ribbon .link-btn{background:none;border:none;padding:0;color:inherit;font:inherit;font-weight:700;text-decoration:underline;cursor:pointer;}
/* Mobile */
@media (max-width: 768px) {
    .mobile-notice{display:block;text-align:center;font-size:11.5px;font-weight:600;padding:6px 10px;background:var(--warning-bg,#fef3c7);color:var(--warning-text,#92400e);}
    /* Layout */
    body                  { flex-direction: column; height: auto; overflow: auto; }
    .sidebar              { width: 100%; min-height: auto; flex-direction: row; flex-wrap: wrap; overflow: visible; }
    .sidebar-brand        { padding: 14px 16px 12px; }
    .sidebar-section      { padding: 8px 8px 4px; display: flex; flex-wrap: wrap; gap: 2px; }
    .sidebar-section-label{ display: none; }
    .sidebar a            { padding: 8px 10px; font-size: 12px; }
    .sidebar-footer       { width: 100%; padding: 8px 10px; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-wrap: wrap; gap: 8px; }
    .main-content         { height: auto; overflow: visible; }
    .page-body            { padding: 16px; }
    .page-header          { padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
    .training-banner      { display: none; } /* sidebar timer hidden on mobile, shown in header */

    /* Dashboard split panel */
    .dash-layout          { flex-direction: column; height: auto; }
    .list-col             { padding: 16px; overflow: visible; }
    .profile-col.open     { width: 100%; overflow: visible; }
    .profile-inner        { width: 100%; }

    /* Cards and grids */
    .stats-grid           { grid-template-columns: 1fr 1fr; gap: 10px; }
    .form-row-2,
    .form-row-3           { grid-template-columns: 1fr; }
    .col-2                { grid-template-columns: 1fr; }
    .col-3-1              { grid-template-columns: 1fr; }

    /* Tables */
    .table-wrap           { margin: 0 -4px; }
    table                 { font-size: 12.5px; }
    thead th, tbody td    { padding: 9px 10px; }

    /* Modals */
    .modal                { max-width: 100%; margin: 8px; }
    .modal-header,
    .modal-body,
    .modal-footer         { padding-left: 16px; padding-right: 16px; }

    /* Auth pages */
    .auth-wrap            { flex-direction: column; }
    .auth-panel           { width: 100%; padding: 32px 24px; order: 1; }
    .auth-visual          { min-height: 200px; order: 0; }
    .auth-visual-title    { font-size: 20px; }

    /* Landing page */
    .landing              { grid-template-columns: 1fr !important; padding-top: 52px; }
    .panel                { min-height: auto; padding: 40px 28px; }
    .panel-trainee        { order: -1; } /* Trainee first on mobile */

    /* Decoder cards */
    .dec-head             { flex-direction: column; align-items: flex-start; gap: 8px; }
    .dec-actions          { width: 100%; justify-content: flex-start; }
    .action-grid          { grid-template-columns: 1fr 1fr; }

    /* Tab bars */
    .tab-bar              { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab-btn              { white-space: nowrap; flex-shrink: 0; }
}

/* Small phones */
@media (max-width: 420px) {
    .stats-grid           { grid-template-columns: 1fr; }
    .action-grid          { grid-template-columns: 1fr; }
    .panel                { padding: 32px 20px; }
    .page-header          { padding: 10px 12px; }
    .page-body            { padding: 12px; }
}

/* ── Page tabs (page_tabs.js) — same look as Settings ── */
.st-tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:24px;overflow-x:auto;}
.st-tab{white-space:nowrap;padding:10px 18px;font-size:13.5px;font-weight:500;color:var(--text-3);background:none;border:0;border-bottom:2px solid transparent;cursor:pointer;font-family:inherit;}
.st-tab:hover{color:var(--text-1);} .st-tab.on{color:var(--brand);border-bottom-color:var(--brand);}
.st-pane{display:none;} .st-pane.on{display:block;}

/* ── Tab transitions, app-wide ──────────────────────────────────────────────
   Every tab system swaps panes with display:none → shown, which restarts a CSS
   animation — so one rule gives all of them the same settle-in, no JS needed.
   Covers: page_tabs.js (.st-pane), .tab-pane (trainee/training admin, accounts),
   .sp-pane (Sponsors & Partners), and the Training application tabs (#pane-*). */
.st-pane.on, .tab-pane.active, .sp-pane.active,
#pane-about, #pane-apply, #pane-status {
  animation: tabPaneIn .42s cubic-bezier(.16,1,.3,1) both;
}
@keyframes tabPaneIn {
  from { opacity: 0; transform: translateY(8px); filter: blur(2px); }
  to   { opacity: 1; transform: none;            filter: none; }
}
.st-tab, .tab-btn, .sp-tab, .reg-tab {
  transition: color .2s ease, border-color .25s ease, background-color .2s ease, box-shadow .25s ease;
}
.st-tab:active, .tab-btn:active, .sp-tab:active, .reg-tab:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .st-pane.on, .tab-pane.active, .sp-pane.active, #pane-about, #pane-apply, #pane-status { animation: none; }
}

/* ── Card hover: an animated border, app-wide ───────────────────────────────
   On hover a blue light runs around the card's edge. Drawn by a masked ::after
   ring (so each card keeps its own background and hover styles); the angle is an
   animatable custom property. Browsers without @property still get a lit border. */
@property --bd-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.card, .feature-grid li, .link-card, .org-card, .info-card, details.fq, .svc, .fx-card { position: relative; }
.card::after, .feature-grid li::after, .link-card::after, .org-card::after, .info-card::after,
details.fq::after, .svc::after, .fx-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--bd-a), #1a6ef5, #93b4fa 18%, rgba(26,110,245,0) 38%, rgba(26,110,245,0) 62%, #93b4fa 82%, #1a6ef5);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s ease;
  animation: cardBorderSpin 2.8s linear infinite; animation-play-state: paused;
}
.card:hover::after, .feature-grid li:hover::after, .link-card:hover::after, .org-card:hover::after, .info-card:hover::after,
details.fq:hover::after, .svc:hover::after, .fx-card:hover::after,
.link-card:focus-visible::after, .org-card:focus-visible::after { opacity: 1; animation-play-state: running; }
@keyframes cardBorderSpin { to { --bd-a: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  .card::after, .feature-grid li::after, .link-card::after, .org-card::after, .info-card::after,
  details.fq::after, .svc::after, .fx-card::after { animation: none; }
}

/* Superuser page groups (page_group_tabs() in platform_helpers.php) */
.grp-tabs{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 22px;padding:6px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-md,10px);}
.grp-tabs a{padding:8px 14px;border-radius:8px;font-size:13px;font-weight:500;color:var(--text-2);text-decoration:none;white-space:nowrap;}
.grp-tabs a:hover{background:var(--surface);color:var(--text-1);}
.grp-tabs a.on{background:var(--surface);color:var(--brand);font-weight:600;box-shadow:0 1px 3px rgba(15,23,42,.1);}

/* ── Pagination (pager_html() in platform_helpers.php) ── */
.pager { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:16px; font-size:13px; }
.pager a, .pager span { min-width:34px; height:34px; padding:0 10px; display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text-2); text-decoration:none; }
.pager a:hover { border-color:var(--brand); color:var(--brand); }
.pager .is-on { background:var(--brand); border-color:var(--brand); color:#fff; font-weight:600; }
.pager .is-off { opacity:.45; }
.pager .gap { border:0; background:none; min-width:auto; padding:0 2px; }
.pager .pager-total { border:0; background:none; margin-left:auto; color:var(--text-3); }

/* ── Form controls the base rule above missed (search, date, url, time…) ──
   :where() keeps specificity at zero, so any page's own class or inline style still wins. */
:where(input[type="search"], input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"], input[type="url"]) {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background-color: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  margin-bottom: 16px;
  outline: none;
  box-sizing: border-box;
}
/* Search fields: magnifier inside the field, comfortable minimum width, tidy clear button */
:where(input[type="search"]) {
  min-width: 240px;
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238891a8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; opacity: .6; }
input[type="search"]::placeholder, input::placeholder { color: var(--text-3); }

/* ── Filter / search bars (GET forms): every control on one baseline, one height ── */
form[method="get" i] :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select) { margin-bottom: 0; height: 40px; }
form[method="get" i] :is(button, .btn) { height: 40px; }
form[method="get" i] > div > label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
form[method="get" i] > div:has(> input[type="search"]) { flex: 1 1 260px; }

/* ── Notices: text that mixes plain words with <strong>/<a> must flow as one paragraph.
   (A flex .alert turns every text run into its own column — see the JS safety net in sidebar.php.) ── */
.alert-body { flex: 1; min-width: 0; }
