/* Ensure proper emoji rendering across all browsers including Edge */
.emoji, .msg-text, [class*="whatsapp"], [class*="message"], .chat-msg {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "Apple Color Emoji", "Twemoji Mozilla", sans-serif !important;
  font-variant-emoji: text;
  line-height: 1.6;
}

/* Specific fix for Edge desktop emoji rendering */
@supports (-ms-ime-align: auto) {
  .msg-text,
  .chat-body,
  .modal-body,
  [data-whatsapp-text] {
    font-family: "Segoe UI Emoji", "Segoe UI Symbol", sans-serif !important;
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Base headers typography styling */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.5px;
}


/* ═══════════════════════════════════════════════════════════════
   ChessKidoo ACADEMY - Premium Admin Panel Styles
   Modern design with gold accents and dark theme
   Professional fonts: Cormorant Garamond (headings), Syne (UI), JetBrains Mono
   ═══════════════════════════════════════════════════════════════ */

:root {
  --obsidian: #080810;
  --night: #0e0e1a;
  --dusk: #13131f;
  --surface: #181824;
  --surface2: #1e1e2e;
  --surface3: #252538;

  --amber: #e8a830;
  --amber-dim: #c49028;
  --amber-glow: rgba(232,168,48,0.18);
  --amber-mist: rgba(232,168,48,0.07);

  --gold: #dca33e;
  --gold2: #f0c05a;
  --gold-glow: rgba(220,163,62,0.25);
  --gold-mist: rgba(220,163,62,0.08);
  /* Tinted gold fill for "selected" pills. Referenced since the ledger filters
     were written but never actually defined, so every var(--gold-semi) was an
     invalid value and the active pill silently lost its background. */
  --gold-semi: rgba(220,163,62,0.16);

  --ivory: #f0ede4;
  --ivory2: #c8c4b8;
  --ivory3: #7a7870;
  --ivory-dim: #9a978c;

  --accent: #5a9fff;
  --info: #17a2b8;
  --warning: #ffc107;
  --success: #52c41a;
  --danger: #ff4d4f;
  --emerald: #52c41a;

  --glass: rgba(255,255,255,0.03);
  --border: rgba(232,168,48,0.15);
  --radius-lg: 14px;
  --radius-sm: 8px;

  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow: 0 20px 40px rgba(0,0,0,0.45);
  --shadow-deep: 0 24px 60px rgba(0,0,0,0.6), 0 8px 20px rgba(0,0,0,0.4);
  --shadow-amber: 0 0 40px rgba(232,168,48,0.12);

  --slate: #94a3b8;
  --bg3: #252538;
  --gold-light: #f5cf82;
}

/* ☀️ LIGHT THEME ☀️ */
body[data-theme="light"] {
  --obsidian: #fdfbf7;
  --night: #ffffff;
  --dusk: #f6f3eb;
  --surface: #ffffff;
  --surface2: #f9f7f2;
  --surface3: #f0ede4;

  --gold: #b3851b;
  --gold2: #d4a017;
  --gold-glow: rgba(179,133,27,0.15);
  --gold-mist: rgba(179,133,27,0.06);
  --gold-semi: rgba(179,133,27,0.14);

  --amber: #e8a830;
  --amber-dim: #c49028;
  --amber-mist: rgba(179,133,27,0.04);

  --ivory: #0f172a;
  --ivory2: #334155;
  --ivory3: #64748b;
  --ivory-dim: #94a3b8;

  --glass: rgba(255,255,255,0.9);
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 8px 30px rgba(0,0,0,0.05);
  --shadow-deep: 0 15px 45px rgba(0,0,0,0.1);
  --shadow-amber: 0 0 20px rgba(179,133,27,0.1);

  --bg3: #ffffff;
  --gold-light: #d4a017;
  --slate: #64748b;

  background: var(--obsidian) !important;
  background-image: none !important;
  color: var(--ivory) !important;
}
body[data-theme="light"]::before { opacity: 0.1; }

body[data-theme="light"] .modal-box { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-deep); }
body[data-theme="light"] .modal-hdr,
body[data-theme="light"] .modal-title { color: var(--gold); }
body[data-theme="light"] .label,
body[data-theme="light"] .form-group label { color: var(--ivory); }
body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea { background: var(--surface2); border-color: var(--border); color: var(--ivory); }

body[data-theme="light"] .sidebar { background: #ffffff; border-right: 1px solid var(--border); }
body[data-theme="light"] .nav-item { color: var(--ivory2); }
body[data-theme="light"] .nav-item:hover { background: rgba(232,168,48,0.08); color: var(--gold); }
body[data-theme="light"] .nav-item.active { background: linear-gradient(90deg, rgba(232,168,48,0.1) 0%, transparent 100%); color: var(--gold); }
body[data-theme="light"] .logo-text { color: var(--gold); }
body[data-theme="light"] .top-bar { background: var(--glass); border-bottom: 1px solid var(--border); }
body[data-theme="light"] .page-title { color: var(--ivory) !important; }
body[data-theme="light"] .admin-label { color: var(--ivory) !important; }
body[data-theme="light"] .dash-grid .card::after { opacity: 0.05; }
body[data-theme="light"] .ai-ws-sidebar { background: var(--surface); }
body[data-theme="light"] .ai-ws-main { background: var(--surface2); }
body[data-theme="light"] .ai-ws-msg.bot .ai-ws-bubble { background: #ffffff; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
body[data-theme="light"] .chat-panel { background: #ffffff; border: 1px solid var(--gold); }
body[data-theme="light"] .chat-head { background: var(--surface3); }
body[data-theme="light"] .chat-input-row { background: var(--surface2); }
body[data-theme="light"] [data-theme="light"] .ai-chat-panel { background: var(--night) !important; border: 1px solid var(--border) !important; box-shadow: 0 24px 60px rgba(0,0,0,0.18); }
body[data-theme="light"] .ai-chat-header { background: rgba(232,168,48,0.09); }
body[data-theme="light"] .ai-msg.bot { background: var(--surface3) !important; color: var(--ivory) !important; border-color: var(--border); }
body[data-theme="light"] .ai-chat-input-area { background: var(--surface2); }
body[data-theme="light"] .ai-input { background: var(--surface); border-color: var(--border); color: var(--ivory); }

/* ── MESSAGE HUB LIGHT THEME ── */
body[data-theme="light"] .msg-card { background: var(--surface); border: 1px solid var(--border); }
body[data-theme="light"] .msg-card.unread { border-left: 3px solid var(--gold); }
body[data-theme="light"] .msg-card-sender { color: var(--gold); }
body[data-theme="light"] .msg-card-subject { color: var(--ivory); }
body[data-theme="light"] .msg-card-body { color: var(--ivory2); }
body[data-theme="light"] .msg-card-time { color: var(--ivory3); }
body[data-theme="light"] #msg-filter { background: var(--surface2); border-color: var(--border); color: var(--ivory); }
body[data-theme="light"] #msg-category { background: var(--surface2); border-color: var(--border); color: var(--ivory); }
body[data-theme="light"] #msg-template { background: var(--surface2); border-color: var(--border); color: var(--ivory); }
body[data-theme="light"] .msgs-list { gap: 16px; }
body[data-theme="light"] .msg-recipient-list { background: var(--surface2) !important; }
body[data-theme="light"] .homework-calendar-grid div { background: var(--surface2) !important; }
body[data-theme="light"] #homework-month-filter, body[data-theme="light"] #homework-assignee-filter, body[data-theme="light"] #homework-status-filter { background: var(--surface2); border-color: var(--border); color: var(--ivory); }
body[data-theme="light"] .homework-calendar-list .card { background: var(--surface); border: 1px solid var(--border); }

/* ── CARD CLICKABLE ── */
.card-clickable { cursor: pointer; transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s, border-color 0.2s !important; }
.card-clickable:hover { transform: translateY(-4px) scale(1.02); border-color: var(--gold) !important; box-shadow: var(--shadow-deep), 0 0 15px var(--gold-glow); }
.card-clickable:active { transform: translateY(-1px) scale(0.98); }

/* Stat Value Brighter State */
.stat-value.bright { color: var(--gold2); text-shadow: 0 0 15px var(--gold-glow); }

/* ══════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
img, video { max-width: 100%; height: auto; display: block; } /* FIX: image overflow shield */

body, input, select, textarea, button {
  font-family: var(--font-ui) !important;
}

body {
  background: var(--obsidian);
  color: var(--ivory);
  min-height: 100vh;
  display: flex;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  overflow-x: hidden;
}

/* NOISE & MESH BACKGROUND */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(232,168,48,0.03) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(90,159,255,0.03) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 10000;
  opacity: 0.6;
  transition: opacity 0.2s;
}

body.login-mode .sidebar,
body.login-mode .main,
body.login-mode .top-bar,
body.login-mode .sidebar-overlay { display: none !important; }

/* The app-level floating widgets share z-index 4000 with #login-screen and sit
   later in the DOM, so they paint on top of the login card: #ai-chat-btn landed
   exactly on #login-chat-btn (swallowing its clicks) and #calc-toggle-btn
   covered the Sign In button. They belong to the authenticated shell — hide
   them, and their panels, until login completes. */
body.login-mode #ai-chat-btn,
body.login-mode #chat-panel,
body.login-mode #calc-toggle-btn,
body.login-mode #floating-calc { display: none !important; }

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  background: rgba(8,8,16,0.7);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), background 0.3s;
}
.sidebar.collapsed { transform: translateX(-100%); }

.logo { padding: 28px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.logo-icon {
  font-size: 26px;
  color: var(--gold);
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-text { font-family: 'Cinzel', var(--font-head); font-size: 20px; font-weight: 700; letter-spacing: 1.5px; color: var(--gold); text-transform: uppercase; }

.nav-group { padding: 12px; flex-grow: 1; overflow-y: auto; }
 .nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; margin: 3px 0;
  border-radius: var(--radius-sm);
  cursor: pointer; color: var(--ivory3);
  font-size: 14px; font-weight: 500;
  transition: 0.2s; user-select: none;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--gold-mist); color: var(--ivory); }
.nav-item.active { background: linear-gradient(90deg, rgba(232,168,48,0.18) 0%, transparent 100%); border-left: 3px solid var(--gold); color: var(--gold); box-shadow: inset 0 0 18px rgba(218,163,62,0.08); }
.nav-item .ico { font-size: 16px; min-width: 20px; text-align: center; }

/* Coach sidebar polish */
body.coach-mode .nav-item.coach-only:hover {
  background: rgba(218,163,62,0.08);
  color: var(--gold);
}
body.coach-mode .nav-item.coach-only.active {
  background: linear-gradient(90deg, rgba(218,163,62,0.15) 0%, transparent 100%);
  border-left: 3px solid var(--gold);
  color: var(--gold);
  box-shadow: inset 0 0 18px rgba(218,163,62,0.1);
}

/* ── MAIN CONTENT ── */
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.15s ease; width: calc(100% - 240px); }
.main.expanded { margin-left: 0; width: 100%; }

.top-bar {
  padding: 22px 36px;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(14,14,26,0.4);
  backdrop-filter: blur(25px) saturate(180%);
  position: sticky; top: 0; z-index: 90;
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
  gap: 0 24px; /* Added horizontal gap between left and right sections */
}

.page-title {
  color: var(--ivory) !important;
  font-family: var(--font-head);
  font-size: clamp(18px, 3.5vw, 26px);
  font-weight: 700;
  display: flex; align-items: center; gap: 16px;
}

.top-nav-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.top-nav-right .btn { padding: 8px 14px; font-size: 12px; white-space: nowrap; }
#top-btn-area { flex-wrap: wrap !important; gap: 10px !important; }
.content { padding: 24px 28px 40px; }



/* ── MENU TOGGLE ── */
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--gold);
  cursor: pointer; padding: 6px; margin-right: 4px;
  border-radius: 6px; transition: 0.2s ease;
}
.menu-toggle:hover { background: var(--gold-mist); color: var(--gold2); }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 9998; }
.sidebar-overlay.active { display: block; }

/* ── TOP PROFILE ── */
.top-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 12px; border-radius: var(--radius-sm); transition: 0.2s; }
.top-profile:hover { background: var(--gold-mist); }
.top-profile-av { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }
.top-profile-info { display: flex; flex-direction: column; }
.top-profile-hello { font-size: 11px; color: var(--ivory3); line-height: 1.2; }
.top-profile-name { font-size: 14px; color: var(--ivory); font-weight: 600; }

/* ── HERO & CARDS ── */
.hero-img {
  width: 100%; height: 210px;
  border-radius: var(--radius-lg); object-fit: cover;
  margin-bottom: 28px;
  border: 1px solid rgba(232,168,48,0.12);
  object-position: center 35%;
  box-shadow: var(--shadow);
}

.card {
  background: var(--surface);
  border: 1px solid rgba(232,168,48,0.1);
  border-radius: var(--radius-lg);
  padding: 24px; transition: 0.25s;
  box-shadow: var(--shadow); min-width: 0;
}
.card:hover { border-color: rgba(232,168,48,0.25); transform: translateY(-3px); box-shadow: var(--shadow-amber); }

.stat-label { font-size: 10px; text-transform: uppercase; color: var(--ivory3); letter-spacing: 1.5px; margin-bottom: 8px; font-weight: 600; }
.stat-value { font-size: clamp(22px, 2.5vw, 30px); font-weight: 700; color: var(--gold); font-family: var(--font-mono); word-break: break-word; overflow-wrap: break-word; }

/* ── SKELETON LOADERS ── */
@keyframes ck-shimmer { 0% { background-position: -468px 0; } 100% { background-position: 468px 0; } }
.skeleton-line {
  display: inline-block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 936px 100%;
  animation: ck-shimmer 1.4s infinite linear;
}
body[data-theme="light"] .skeleton-line {
  background: linear-gradient(90deg, rgba(0,0,0,0.05) 25%, rgba(0,0,0,0.10) 50%, rgba(0,0,0,0.05) 75%);
  background-size: 936px 100%;
}
.skeleton-row td { padding: 14px 16px; }

/* ── TABLES ── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(232,168,48,0.1);
  overflow: hidden; box-shadow: var(--shadow); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { text-align: left; padding: 16px 18px; font-size: 11px; color: var(--ivory3); border-bottom: 1px solid var(--border); background: var(--surface2); font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
td { padding: 15px 18px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gold-mist); }

.av-cell { display: flex; align-items: center; gap: 11px; font-weight: 600; }
.av-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(232,168,48,0.3); flex-shrink: 0; }

/* ── TEXT FORMATTING ── */
.text-gold { color: var(--gold); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.text-success { color: var(--success); font-weight: 700; }
.text-danger { color: var(--danger); font-weight: 700; }
.text-warning, .text-pending { color: var(--amber); font-weight: 700; }

/* ── BUTTONS ── */
.btn {
  padding: 9px 18px; border-radius: var(--radius-sm); border: none;
  font-weight: 600; cursor: pointer; font-family: var(--font-ui);
  font-size: 13px; transition: 0.25s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #111; box-shadow: 0 4px 14px rgba(232,168,48,0.3); }
.btn-gold:hover { background: linear-gradient(135deg, var(--gold2), var(--gold)); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,168,48,0.4); }
.btn-outline { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.btn-outline:hover { background: var(--gold-mist); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-outline-blue { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline-blue:hover { background: rgba(90,159,255,0.1); }
.btn-outline-grey { background: transparent; border: 1px solid #555; color: var(--ivory); }
.btn-outline-grey:hover { background: var(--glass); }
.btn-outline-grey.active { background: var(--gold); color: var(--charcoal); border-color: var(--gold); }
 .btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
 .btn-danger:hover { background: rgba(255,77,79,0.1); }
 .btn-outline-info { background: transparent; border: 1px solid var(--info); color: var(--info); }
 .btn-outline-info:hover { background: rgba(30,144,255,0.1); }
 .btn-outline-warning { background: transparent; border: 1px solid var(--warning); color: var(--warning); }
 .btn-outline-warning:hover { background: rgba(255,193,7,0.1); }

/* ── BADGES ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.badge-paid { background: rgba(82,196,26,0.15); color: var(--success); }
.badge-due { background: rgba(255,77,79,0.15); color: var(--danger); }
.badge-level { background: var(--gold-glow); color: var(--gold); text-transform: uppercase; }
.badge-danger { background: rgba(255,77,79,0.15); color: var(--danger); }
.badge-grey { background: rgba(140, 140, 140, 0.15); color: #8c8c8c; }
.badge-gold { background: rgba(218, 163, 62, 0.15); color: var(--gold); }
.badge-purple { background: rgba(114, 46, 209, 0.15); color: #722ed1; }

/* ── PROFILE HEADER ── */
.profile-hdr {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); padding: 32px 36px;
  border-radius: var(--radius-lg); border: 1px solid rgba(232,168,48,0.1);
  box-shadow: var(--shadow); margin-bottom: 28px; flex-wrap: wrap; gap: 24px;
}
.profile-info { display: flex; align-items: center; gap: 24px; }
.profile-av { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--gold); object-fit: cover; box-shadow: 0 8px 24px var(--gold-glow); flex-shrink: 0; }
.profile-details h1 { font-family: var(--font-head); color: var(--gold); font-size: 34px; margin-bottom: 8px; line-height: 1; }
.profile-meta { display: flex; gap: 16px; color: var(--ivory3); font-size: 14px; }
.profile-meta b { color: var(--ivory); font-weight: 600; }
.profile-actions { display: flex; gap: 12px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.82); display: none; align-items: center; justify-content: center; z-index: 3000; backdrop-filter: blur(5px); }
.modal.active,
.modal.open { display: flex !important; }
.modal-box {
  background: var(--surface);
  width: 480px; max-width: 94vw; max-height: 90vh;
  overflow-y: auto; scrollbar-width: thin;
  padding: 36px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(232,168,48,0.2);
  position: relative;
  box-shadow: var(--shadow), 0 0 40px rgba(232,168,48,0.08);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(232, 168, 48, 0.15);
  padding-bottom: 12px;
}
.modal-title { font-family: var(--font-head); font-size: 24px; color: var(--gold); margin: 0; font-weight: 600; }
.close-btn {
  background: transparent;
  border: none;
  color: var(--ivory3);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.2s ease;
}
.close-btn:hover {
  background: rgba(232, 168, 48, 0.12);
  color: var(--gold);
}
.modal-body {
  margin-bottom: 20px;
}
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
}
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ivory2);
  margin-bottom: 6px;
  text-align: left;
}
.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  border-top: 1px solid rgba(232, 168, 48, 0.15);
  padding-top: 20px;
}
.modal-sub { color: var(--ivory3); font-size: 14px; margin-bottom: 22px; }

/* Autofill styling override */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--surface2) inset !important;
  -webkit-text-fill-color: var(--ivory) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── BACK TO EVENTS LINK ── */
.back-link-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--gold);
  padding: 8px 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s ease;
  outline: none;
}
.back-link-btn:hover {
  color: var(--gold-light);
}
.back-link-btn:hover svg {
  transform: translateX(-4px);
}

/* ── FORM INPUTS ── */
input, select, textarea {
  width: 100%; padding: 13px;
  background: var(--surface2);
  border: 1px solid rgba(232,168,48,0.12);
  border-radius: var(--radius-sm);
  color: var(--ivory); margin-bottom: 13px;
  outline: none; transition: 0.25s;
  font-family: var(--font-ui); font-size: 14px; resize: vertical;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); background: var(--surface); box-shadow: 0 0 0 2px var(--gold-glow); }
select option { background-color: var(--surface2) !important; color: var(--ivory) !important; }
input[type="time"], input[type="date"] { color-scheme: dark; }
body[data-theme="light"] input[type="time"], body[data-theme="light"] input[type="date"] { color-scheme: light; }
input[type='month']::-webkit-calendar-picker-indicator { filter: invert(0.8) sepia(1) saturate(5) hue-rotate(5deg); cursor: pointer; }
body[data-theme="light"] input[type='month']::-webkit-calendar-picker-indicator { filter: invert(0.4) sepia(1) saturate(5) hue-rotate(5deg); cursor: pointer; }

/* ── HISTORY ITEMS ── */
.history-item { margin-bottom: 8px; border-bottom: 1px solid var(--glass); padding-bottom: 8px; font-size: 13px; }
.history-item span { color: var(--ivory3); font-size: 11px; display: block; margin-top: 2px; }

/* ── SCHEDULE ── */
.schedule-day { display: flex; justify-content: space-between; padding: 12px 16px; background: var(--surface2); border: 1px solid rgba(232,168,48,0.1); border-radius: var(--radius-sm); margin-bottom: 8px; }
.schedule-day b { color: var(--gold); }
.schedule-time { color: var(--ivory); font-family: var(--font-mono); font-size: 13px; }

/* ── ACHIEVEMENTS ── */
.ach-grid, .fame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 22px; margin-top: 18px; }
.ach-card, .fame-card {
  position: relative; background: var(--surface);
  border: 1px solid rgba(232,168,48,0.1);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: 0.3s; box-shadow: var(--shadow); min-height: 280px;
}
.ach-card:hover, .fame-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: 0 15px 40px rgba(0,0,0,0.4), var(--shadow-amber); }
.ach-img, .fame-img { width: 100%; height: 180px; object-fit: cover; }
.ach-img-placeholder, .fame-img-placeholder { width: 100%; height: 180px; display: flex; align-items: center; justify-content: center; font-size: 48px; background: var(--surface2); }
.ach-info, .fame-info { padding: 16px; text-align: center; }
.ach-title, .fame-title { font-family: var(--font-head); font-size: 18px; color: var(--gold); margin-bottom: 5px; font-weight: 600; }
.ach-sub, .fame-sub { font-size: 12px; color: var(--ivory3); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.del-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--danger); color: #fff; border: none;
  border-radius: 50%; width: 26px; height: 26px;
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4); transition: 0.2s; z-index: 5;
}
.del-btn:hover { transform: scale(1.15); background: #e03033; }

/* ── PREMIUM EVENT CARDS ── */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 24px; }
.ev-card {
  background: var(--surface); border: 1px solid rgba(232,168,62,0.12);
  border-radius: 16px; overflow: hidden; transition: all 0.3s ease;
  display: flex; flex-direction: column;
  transform-style: preserve-3d; perspective: 1000px;
}
.ev-card:hover { transform: translateY(-8px) rotateX(3deg); box-shadow: 0 24px 50px rgba(0,0,0,0.5), 0 0 30px rgba(232,168,48,0.15); border-color: rgba(232,168,62,0.3); }
.ev-header { background: linear-gradient(135deg, rgba(232,168,48,0.15) 0%, rgba(232,168,48,0.05) 100%); border-radius: 16px 16px 0 0; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(232,168,62,0.1); }
.ev-type-badge { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #000; font-size: 11px; font-weight: 700; padding: 5px 12px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.ev-date-badge { background: var(--surface3); color: var(--ivory); font-family: var(--font-mono); font-size: 12px; padding: 6px 14px; border-radius: 8px; }
.ev-body { padding: 22px; flex: 1; }
.ev-title { font-family: var(--font-head); font-size: 22px; color: var(--ivory); margin-bottom: 12px; font-weight: 600; line-height: 1.3; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.ev-meta-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ivory2); }
.ev-time::before { content: '🕐'; }
.ev-loc::before  { content: '📍'; }
.ev-prize::before { content: '🏆'; }
.ev-desc { font-size: 14px; color: var(--ivory3); line-height: 1.6; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.05); }
.ev-progress-wrap { padding: 0 22px 18px; }
.ev-progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.ev-progress-label span:last-child { color: var(--gold); font-family: var(--font-mono); font-weight: 600; }
.ev-progress-track { background: var(--surface2); height: 8px; border-radius: 4px; overflow: hidden; }
.ev-progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); border-radius: 4px; transition: width 0.5s ease; }
.ev-footer { padding: 18px 22px; border-top: 1px solid rgba(232,168,62,0.08); display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.15); }
.ev-spots { font-size: 13px; color: var(--ivory3); }
.ev-spots strong { color: var(--ivory); font-family: var(--font-mono); }
.ev-poster { width: 100%; height: 180px; object-fit: cover; border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--border); }
.ev-map-link { display: inline-flex; align-items: center; gap: 6px; background: rgba(232,168,48,0.1); color: var(--gold); padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.2s; border: 1px solid rgba(232,168,48,0.2); margin-top: 10px; }
.ev-map-link:hover { background: var(--gold); color: var(--obsidian); }
.btn-register { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #000; font-weight: 700; padding: 10px 24px; border-radius: 10px; border: none; cursor: pointer; font-family: var(--font-ui); font-size: 14px; transition: all 0.2s ease; }
.btn-register:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(232,168,48,0.4); }
.btn-register.registered { background: var(--surface2); color: var(--success); border: 1px solid var(--success); }

/* ── AI WORKSPACE CHAT ── */
.chat-box { flex: 1; overflow-y: auto; padding: 4px 0 16px; display: flex; flex-direction: column; gap: 10px; }
.msg-ai { max-width: 82%; padding: 12px 16px; border-radius: 12px 12px 12px 3px; font-size: 14px; line-height: 1.6; background: var(--surface2); color: var(--ivory); border-left: 3px solid var(--gold); border: 1px solid rgba(232,168,48,0.1); align-self: flex-start; white-space: pre-wrap; }
.msg-user { max-width: 82%; padding: 12px 16px; border-radius: 12px 12px 3px 12px; font-size: 14px; line-height: 1.6; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #000; font-weight: 600; align-self: flex-end; }
.msg-thinking { opacity: 0.6; font-style: italic; }

/* ── LOGIN SCREEN ── */
#login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(rgba(5,5,10,0.7), rgba(14,14,26,0.9)), url('/lms/images/hero.jpg') center/cover no-repeat;
  z-index: 4000; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s;
}
#login-screen::before { content: ''; position: absolute; inset: 0; backdrop-filter: blur(12px); background: rgba(5,5,10,0.3); }
.login-box {
  width: 100%; max-width: 420px;
  background: rgba(22,22,34,0.75);
  border: 1px solid rgba(232,168,48,0.25);
  border-radius: var(--radius-lg);
  padding: 48px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 60px rgba(232,168,48,0.08);
  text-align: center; position: relative; z-index: 10; backdrop-filter: blur(20px);
}
.logo-area { margin-bottom: 40px; }
.logo-chess-large { width: 64px; height: 64px; background: linear-gradient(135deg, var(--amber), var(--amber-dim)); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 32px; box-shadow: 0 8px 24px rgba(232,168,48,0.3); margin-bottom: 16px; color: var(--obsidian); }
.logo-name { font-family: 'Cinzel', var(--font-head); font-size: 28px; font-weight: 700; color: var(--amber); letter-spacing: 1.5px; display: block; text-transform: uppercase; }
.logo-tagline { font-size: 11px; color: var(--ivory3); text-transform: uppercase; letter-spacing: 3px; font-weight: 500; }
.form-group { margin-bottom: 24px; text-align: left; }
.label { display: block; font-size: 12px; color: var(--ivory3); margin-bottom: 8px; margin-left: 4px; text-transform: uppercase; letter-spacing: 1px; -webkit-user-select: none; user-select: none; }

/* ── Login brand logo (theme-aware image with text fallback) ── */
.login-logo { display: block; width: 88%; max-width: 320px; height: auto; margin: 0 auto 10px; }
.login-logo-light { display: none; }
body[data-theme="light"] .login-logo-dark { display: none; }
body[data-theme="light"] .login-logo-light { display: block; }
.logo-fallback { display: none; flex-direction: column; align-items: center; }
/* If the image files aren't present yet, hide the imgs and show the branded mark. */
.logo-area.logo-img-missing .login-logo { display: none !important; }
.logo-area.logo-img-missing .logo-fallback { display: flex; }

.logo-crest {
  width: 76px; height: 76px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 44px; line-height: 1; margin-bottom: 14px; border-radius: 18px;
  background: linear-gradient(135deg, #f3cf6b 0%, var(--gold, #c9a227) 55%, #9a7b1d 100%);
  color: #15233b; box-shadow: 0 10px 28px rgba(201,162,39,0.38); border: 1px solid rgba(255,255,255,0.25);
}
.logo-wordmark { font-family: 'Cinzel', var(--font-head); font-size: 30px; font-weight: 700; letter-spacing: 1px; line-height: 1; }
.logo-wordmark .lw-chess { color: var(--ivory, #f4ecd8); }
.logo-wordmark .lw-kidoo { color: var(--gold, #c9a227); }
.logo-fallback .logo-tagline { margin-top: 8px; font-size: 11px; color: var(--ivory3); text-transform: uppercase; letter-spacing: 4px; font-weight: 600; }
/* Light theme: pale crest + dark wordmark, gold accent kept. */
body[data-theme="light"] .logo-crest {
  background: linear-gradient(135deg, #fdfaf2 0%, #ece3cf 100%);
  color: #1a2435; box-shadow: 0 8px 22px rgba(26,36,53,0.18); border: 1px solid rgba(26,36,53,0.12);
}
body[data-theme="light"] .logo-wordmark .lw-chess { color: #1a2435; }
body[data-theme="light"] .logo-wordmark .lw-kidoo { color: #b8860b; }

/* Login form labels — brighter so they're clearly visible on the dark login box. */
#login-screen .label { color: var(--amber); opacity: 0.95; font-weight: 600; }
body[data-theme="light"] #login-screen .label { color: var(--gold); }
.input-field { width: 100%; background: var(--surface); border: 1px solid rgba(232,168,48,0.1); border-radius: 8px; padding: 14px 16px; color: var(--ivory); font-family: var(--font-ui); font-size: 14px; transition: all 0.3s ease; outline: none; }
.input-field:focus { border-color: var(--amber); background: var(--surface2); box-shadow: 0 0 0 4px var(--amber-glow); }
.login-btn { width: 100%; background: linear-gradient(135deg, var(--amber), var(--amber-dim)); color: var(--obsidian); border: none; border-radius: 8px; padding: 16px; font-family: var(--font-ui); font-weight: 700; font-size: 15px; cursor: pointer; transition: all 0.3s ease; margin-top: 10px; text-transform: uppercase; letter-spacing: 1px; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(232,168,48,0.3); filter: brightness(1.1); }
.footer-links { margin-top: 24px; display: flex; justify-content: center; gap: 16px; }
.footer-link { font-size: 12px; color: var(--ivory3); text-decoration: none; transition: color 0.2s; cursor: pointer; }
.footer-link:hover { color: var(--amber); }

/* ── UPI & MISC ── */
.upi-list { display: flex; flex-direction: column; gap: 11px; margin: 22px 0; }
.upi-item { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--surface2); border: 1px solid rgba(232,168,48,0.1); border-radius: 10px; cursor: pointer; transition: 0.2s; }
.upi-item:hover { border-color: var(--gold); transform: scale(1.01); }
.upi-logo { width: 28px; height: 28px; border-radius: 5px; object-fit: contain; }

/* ── UPLOAD ZONE ── */
.upload-zone { display: block; width: 100%; box-sizing: border-box; border: 1px dashed var(--ivory3); border-radius: var(--radius-sm); padding: 20px; text-align: center; cursor: pointer; transition: 0.2s; margin-bottom: 13px; font-size: 13px; color: var(--ivory3); background: var(--surface2); }
.upload-zone:hover { border-color: var(--gold); color: var(--gold); }
.upload-zone input { display: none; }
.upload-preview { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 13px; display: none; }

/* ── FILTERS ── */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; padding: 18px; background: var(--surface2); border-radius: var(--radius-lg); margin-bottom: 24px; border: 1px solid var(--border); align-items: end; box-shadow: var(--shadow-sm); }
.filter-bar select, .filter-bar input { margin-bottom: 0; padding: 10px 14px; font-size: 13px; width: 100%; border-radius: 6px; border: 1px solid var(--border); background: var(--bg3); color: var(--ivory); }
.filter-bar .filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-bar .filter-label { font-size: 11px; font-weight: 600; color: var(--ivory-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-start; grid-column: 1 / -1; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Mobile-only filters toggle. Hidden here and switched on inside the 768px
   block, where #student-filter-bar collapses; on desktop the bar is always
   open so the button has nothing to do. */
#filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 44px; /* finger-friendly target */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ivory);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease,
    box-shadow 0.22s ease, transform 0.12s ease;
}
#filter-toggle-btn:active { transform: scale(0.97); }
#filter-toggle-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Both glyphs are stroked so they inherit the button's colour transitions. */
#filter-toggle-btn .ft-icon,
#filter-toggle-btn .ft-chevron {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#filter-toggle-btn .ft-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.75;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Open state: gold pill, chevron flipped to point back up. */
#filter-toggle-btn[aria-expanded="true"] {
  background: linear-gradient(180deg, rgba(232, 168, 48, 0.22), rgba(232, 168, 48, 0.1));
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 2px 10px rgba(232, 168, 48, 0.18);
}
#filter-toggle-btn[aria-expanded="true"] .ft-chevron { transform: rotate(180deg); }

/* Count of filters currently narrowing the registry. */
#filter-toggle-btn .filter-toggle-count {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #14161a;
  font-size: 11px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

/* ── STUDENT REGISTRY TOTALS FOOTER ── */
.student-totals-row td {
  padding: 12px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-top: 2px solid var(--border);
}
.totals-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.totals-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
/* Label stays neutral so the eye lands on the amount, which carries the
   status colour inherited from the tone- class on the chip. */
.totals-chip .totals-key,
.totals-grand .totals-key {
  color: var(--ivory-dim);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.totals-chip b,
.totals-grand b {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
}
.totals-chip .totals-count,
.totals-grand .totals-count {
  color: var(--ivory-dim);
  font-size: 10px;
  font-weight: 600;
  opacity: 0.75;
}
.totals-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  align-self: center;
  flex: none;
}
.totals-sep {
  color: var(--ivory-dim);
  opacity: 0.25;
  font-weight: 400;
}

.student-totals-row .tone-paid { color: var(--success); }
.student-totals-row .tone-pending { color: var(--warning); }
.student-totals-row .tone-due { color: var(--warning); }
.student-totals-row .tone-overdue { color: var(--danger); }

/* Grand total sits at the far end of the row, or drops to its own line once
   the chips no longer fit. */
.totals-grand {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin-left: auto;
  padding: 5px 14px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold-semi);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.totals-grand b { font-size: 14px; }
/* Filtered view has no breakdown chips, so the pill leads the row instead of
   being pushed to the far end of an otherwise empty line. */
.totals-solo .totals-grand { margin-left: 0; }

@media (max-width: 768px) {
  .totals-chip, .totals-grand { font-size: 11px; }
  .totals-chip b { font-size: 12px; }
  .totals-grand b { font-size: 13px; }
  /* The registry scrolls sideways on phones, so pushing the total to the far
     end of the row would park it off-screen. Keep it beside the breakdown. */
  .totals-grand { padding: 4px 11px; margin-left: 4px; }
}

/* ── LEDGER STATUS FILTER PILLS ── */
.ledger-filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-filter-ledger {
  padding: 6px 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ivory-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-filter-ledger:hover { color: var(--ivory); border-color: var(--ivory-dim); }
.btn-filter-ledger.active-filter {
  background: var(--gold-semi);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
}


/* ── PAGE VISIBILITY ── */
body.admin-mode .parent-only,
body.parent-mode .admin-only,
body.admin-mode .coach-only,
body.parent-mode .coach-only,
body.admin-mode:not(.master-mode) .master-only { display: none !important; }
body.coach-mode .admin-only:not(.coach-accessible) { display: none !important; }
body.coach-mode .coach-accessible { display: flex !important; }
body.coach-mode .page.coach-accessible { display: block !important; }
body.coach-mode .page.coach-accessible > * { width: 100% !important; min-width: 0 !important; }
.page { display: none; animation: fadeUp 0.4s ease; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ── TOAST NOTIFICATIONS ── */
#toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 20px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.35); animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(10px); }
.toast-success { background: rgba(82,196,26,0.15); border: 1px solid rgba(82,196,26,0.3); color: var(--success); }
.toast-error { background: rgba(255,77,79,0.15); border: 1px solid rgba(255,77,79,0.3); color: var(--danger); }
.toast-info { background: rgba(232,168,48,0.1); border: 1px solid rgba(232,168,48,0.25); color: var(--gold); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ── DASHBOARD GRIDS ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 18px; margin-bottom: 18px;
}
.dash-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 18px;
}

/* ── CHART RESPONSIVENESS ── */
.chart-revenue { height: 300px; }
.chart-coach, .chart-payment, .chart-finance, .chart-session { height: 350px; }

@media (min-width: 1025px) {
  .chart-revenue { height: 420px; }
  .chart-coach, .chart-payment, .chart-finance, .chart-session { height: 450px; }
}

/* Decorative chess piece watermark */
.dash-grid .card { position: relative; overflow: hidden; z-index: 1; }
.dash-grid .card::after { content: '♟'; position: absolute; bottom: -15px; right: -5px; font-size: 80px; opacity: 0.03; transform: rotate(15deg); pointer-events: none; }

/* ── LOADING STATES ── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(212,175,55,0.3); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--ivory3); gap: 14px; font-size: 14px; }
.empty-state { text-align: center; padding: 60px; color: var(--ivory3); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; }

/* ═══════════════════════════════════════════════════════════════
   AI WORKSPACE — Full component suite + mobile pivot fix
   ═══════════════════════════════════════════════════════════════ */
.ai-ws {
  display: flex;
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); min-height: 650px;
  overflow: hidden; box-shadow: var(--shadow-deep);
}
/* FIX: Mobile pivot — sidebar becomes horizontal strip */
@media (max-width: 768px) {
  .ai-ws { flex-direction: column; min-height: auto; }
  .ai-ws-sidebar { width: 100% !important; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: nowrap; padding: 12px; gap: 6px; }
  .ai-ws-brand { display: none; }
  .ai-ws-menu { flex-direction: row !important; overflow-x: auto; padding-bottom: 4px; gap: 6px; }
  .ai-ws-btn { white-space: nowrap; padding: 8px 12px; font-size: 12px; }
}
.ai-ws-sidebar {
  width: 280px; background: var(--surface);
  border-right: 1px solid rgba(232,168,48,0.08);
  padding: 24px 20px; display: flex; flex-direction: column; gap: 8px;
}
.ai-ws-brand { font-family: var(--font-head); font-size: 20px; color: var(--gold); display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.ai-ws-brand span { font-size: 24px; }
.ai-ws-menu { display: flex; flex-direction: column; gap: 6px; }
.ai-ws-btn { background: transparent; color: var(--ivory3); border: 1px solid transparent; padding: 12px 16px; text-align: left; border-radius: 8px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 10px; font-family: var(--font-ui); font-size: 14px; }
.ai-ws-btn:hover { background: var(--gold-mist); color: var(--ivory); }
.ai-ws-btn.active { background: rgba(220,161,62,0.12); color: var(--gold); border: 1px solid rgba(220,161,62,0.3); }
.ai-ws-main { flex: 1; display: flex; flex-direction: column; background: var(--obsidian); }
.ai-ws-header { padding: 20px 40px; border-bottom: 1px solid rgba(255,255,255,0.05); background: rgba(255,255,255,0.02); display: flex; justify-content: space-between; align-items: center; }
.ai-ws-header h2 { font-family: var(--font-head); font-size: 24px; color: var(--ivory); margin-bottom: 4px; }
.ai-ws-header p { color: var(--ivory3); font-size: 14px; }
.ai-ws-chat { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.ai-ws-msg { display: flex; gap: 12px; max-width: 85%; }
.ai-ws-msg.bot { align-self: flex-start; }
.ai-ws-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-ws-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold-glow); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--gold); }
.ai-ws-msg.user .ai-ws-avatar { background: var(--gold); color: var(--obsidian); }
.ai-ws-bubble { padding: 14px 18px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.ai-ws-msg.bot .ai-ws-bubble { background: var(--surface2); color: var(--ivory); border-bottom-left-radius: 2px; border-left: 3px solid var(--gold); }
.ai-ws-msg.user .ai-ws-bubble { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #000; font-weight: 600; border-bottom-right-radius: 2px; }
.ai-ws-input-area { padding: 20px 24px; background: var(--surface2); border-top: 1px solid var(--border); }
.ai-ws-input-box { display: flex; gap: 12px; background: var(--surface); padding: 8px 16px; border-radius: 30px; border: 1px solid var(--border); }
.ai-ws-input-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 8px 30px rgba(220,161,62,0.15); }
.ai-ws-input-box input { flex: 1; background: transparent; border: none; margin-bottom: 0; padding: 8px 0; color: var(--ivory); font-size: 16px; outline: none; font-family: var(--font-ui); }
.ai-ws-input-box input:focus { box-shadow: none; }
.ai-ws-input-box input::placeholder { color: var(--ivory3); }
.ai-ws-send { background: var(--gold); color: #000; border: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.ai-ws-send:hover { transform: scale(1.1); background: var(--gold2); }
.ai-ws-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-ws-pill { background: var(--surface); border: 1px solid var(--border); padding: 6px 14px; border-radius: 20px; font-size: 11px; color: var(--ivory2); cursor: pointer; transition: 0.2s; }
.ai-ws-pill:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }

/* ── AI CHATBOT FLOATING WIDGET ── */
.ai-chat-btn {
  position: fixed; bottom: 28px; right: 28px;
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: #000; border: none;
  box-shadow: 0 6px 20px rgba(232,168,48,0.45), 0 0 0 0 rgba(232,168,48,0.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 4500; transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: chatBtnPulse 3s ease-in-out infinite;
}
.ai-chat-btn:hover { transform: scale(1.1) translateY(-2px); box-shadow: 0 10px 30px rgba(232,168,48,0.6), 0 0 0 6px rgba(232,168,48,0.12); animation: none; }
@keyframes chatBtnPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 20px rgba(232,168,48,0.45); }
  50%       { transform: scale(1.05); box-shadow: 0 6px 30px rgba(232,168,48,0.6); }
}

.ai-chat-panel {
  position: fixed; bottom: 100px; right: 28px;
  width: 370px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 140px);
  background: var(--surface); border: 1px solid rgba(232,168,48,0.15);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(232,168,48,0.08);
  display: none; flex-direction: column; z-index: 4400; overflow: hidden;
  transform-origin: bottom right;
  animation: chatPanelIn 0.28s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
  backdrop-filter: blur(12px);
}
@keyframes chatPanelIn {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.ai-chat-header { background: linear-gradient(90deg, rgba(232,168,48,0.12) 0%, rgba(232,168,48,0.04) 100%); padding: 16px 18px; border-bottom: 1px solid rgba(232,168,48,0.1); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.ai-chat-title { font-family: var(--font-head); font-size: 16px; color: var(--gold); display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ai-chat-title::before { content: '⚡'; }
.ai-online-dot { width: 7px; height: 7px; background: var(--success); border-radius: 50%; display: inline-block; animation: onlinePulse 2s ease-in-out infinite; }
@keyframes onlinePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.ai-chat-close { background: none; border: none; color: var(--ivory3); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 6px; transition: 0.15s; }
.ai-chat-close:hover { background: var(--glass); color: var(--ivory); }
.ai-chat-body { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.ai-chat-body::-webkit-scrollbar { width: 4px; }
.ai-chat-body::-webkit-scrollbar-track { background: transparent; }
.ai-chat-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.ai-msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; animation: msgSlideIn 0.2s ease forwards; word-break: break-word; }
@keyframes msgSlideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.ai-msg.user { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #000; font-weight: 600; align-self: flex-end; border-bottom-right-radius: 3px; box-shadow: 0 3px 10px rgba(232,168,48,0.3); }
.ai-msg.bot { background: var(--surface2); color: var(--ivory); align-self: flex-start; border-bottom-left-radius: 3px; border: 1px solid rgba(232,168,48,0.1); border-left: 3px solid var(--gold); }
.ai-msg.bot.thinking { color: var(--ivory3); font-style: italic; }
.ai-chat-input-area { padding: 12px 14px; border-top: 1px solid rgba(232,168,48,0.1); display: flex; gap: 8px; align-items: center; background: var(--surface2); flex-shrink: 0; }
.ai-input { flex: 1; background: var(--surface); border: 1px solid rgba(232,168,48,0.12); color: var(--ivory); border-radius: 22px; padding: 9px 16px; outline: none; font-size: 14px; font-family: var(--font-ui); transition: border-color 0.2s, box-shadow 0.2s; margin-bottom: 0; }
.ai-input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); background: var(--surface); }
.ai-input::placeholder { color: var(--ivory3); }
.ai-send { background: var(--gold); color: #000; border: none; border-radius: 50%; width: 38px; height: 38px; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s, transform 0.15s; box-shadow: 0 2px 8px rgba(232,168,48,0.35); }
.ai-send:hover { background: var(--gold2); transform: scale(1.1); }
.ai-send:active { transform: scale(0.95); }

/* ── CHAT FAB & PANEL ── */
.chat-fab { position: fixed; bottom: 28px; right: 28px; width: 56px; height: 56px; background: linear-gradient(135deg, var(--gold), var(--gold2)); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 4000; box-shadow: 0 8px 24px rgba(232,168,48,0.4); font-size: 22px; transition: all 0.3s; border: none; }
.chat-fab:hover { transform: scale(1.1) rotate(10deg); box-shadow: 0 12px 32px rgba(232,168,48,0.5); }
.chat-panel { position: fixed; bottom: 96px; right: 28px; width: 360px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid rgba(232,168,48,0.2); border-radius: var(--radius-lg); box-shadow: var(--shadow), 0 0 40px rgba(232,168,48,0.1); z-index: 3900; display: flex; flex-direction: column; overflow: hidden; animation: chatIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards; }
@keyframes chatIn { from { opacity: 0; transform: translateY(16px) scale(0.95); transform-origin: bottom right; } to { opacity: 1; transform: translateY(0) scale(1); } }
.chat-head { background: linear-gradient(90deg, rgba(232,168,48,0.1), rgba(232,168,48,0.04)); padding: 14px 18px; border-bottom: 1px solid rgba(232,168,48,0.1); display: flex; align-items: center; gap: 10px; }
.chat-head-av { width: 34px; height: 34px; background: linear-gradient(135deg, var(--gold), var(--gold2)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; color: #000; }
.chat-head-info h4 { font-family: var(--font-head); font-size: 14px; color: var(--gold); }
.chat-head-info p { font-size: 10px; color: var(--success); display: flex; align-items: center; gap: 4px; }
.online-dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; display: inline-block; margin-right: 4px; }
.chat-body { flex: 1; max-height: 280px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: rgba(232,168,48,0.15) transparent; }
.chat-msg { font-size: 13px; padding: 9px 13px; border-radius: 10px; max-width: 82%; line-height: 1.5; }
.chat-msg.bot { background: var(--surface2); color: var(--ivory); align-self: flex-start; border-bottom-left-radius: 3px; }
.chat-msg.user { background: var(--gold-mist); border: 1px solid rgba(232,168,48,0.2); color: var(--ivory); align-self: flex-end; border-bottom-right-radius: 3px; }
.chat-input-row { padding: 12px; border-top: 1px solid rgba(232,168,48,0.08); display: flex; gap: 8px; background: var(--surface2); }
.chat-input-row input { flex: 1; background: var(--surface); border: 1px solid rgba(232,168,48,0.12); border-radius: 8px; padding: 8px 12px; color: var(--ivory); font-size: 13px; font-family: var(--font-ui); outline: none; transition: border-color 0.2s; margin-bottom: 0; }
.chat-input-row input:focus { border-color: var(--gold); }
.chat-input-row input::placeholder { color: var(--ivory3); }
.chat-send { width: 34px; height: 34px; background: linear-gradient(135deg, var(--gold), var(--gold2)); border: none; border-radius: 8px; color: #000; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; transition: all 0.15s; }
.chat-send:hover { transform: scale(1.05); }

/* ── STAT CARD 3D ANIMATIONS ── */
@keyframes cardReveal { from { opacity: 0; transform: translateY(16px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.stat-card { animation: cardReveal 0.5s cubic-bezier(0.34,1.56,0.64,1) backwards; transition: all 0.3s cubic-bezier(0.25,0.46,0.45,0.94); transform-style: preserve-3d; perspective: 1000px; position: relative; }
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }
.stat-card:nth-child(5) { animation-delay: 0.32s; }
.stat-card:nth-child(6) { animation-delay: 0.4s; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(232,168,48,0.1), transparent); border-radius: var(--radius-lg); opacity: 0; transition: opacity 0.3s; z-index: -1; }
.stat-card:hover { transform: translateY(-6px) rotateX(2deg); box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 30px rgba(232,168,48,0.15); }
.stat-card:hover::before { opacity: 1; }
.stat-card::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%) scale(0.8); width: 60%; height: 16px; background: radial-gradient(ellipse, rgba(0,0,0,0.3), transparent); filter: blur(8px); opacity: 0; transition: all 0.3s; z-index: -1; }
.stat-card:hover::after { opacity: 0.4; transform: translateX(-50%) scale(1); }

/* 3D Button Animations */
.btn-gold, .chat-fab { transform: translateZ(0); }
.btn-gold:hover, .chat-fab:hover { transform: translateY(-2px) translateZ(0); box-shadow: 0 12px 30px rgba(232,168,48,0.5), 0 0 20px rgba(232,168,48,0.2); }

/* Smooth Page Transitions */
.page { animation: pageIn 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── COACH SCHEDULE GRID PREMIUM ── */
.schedule-grid-premium { display: flex; gap: 20px; overflow-x: auto; padding: 10px 5px; scrollbar-width: thin; }
.schedule-day-column { min-width: 200px; flex: 1; background: var(--surface2); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
.schedule-day-column.tbd { opacity: 0.8; border-style: dashed; }
.schedule-day-header { padding: 12px; background: var(--surface3); color: var(--gold); font-weight: 700; text-align: center; border-bottom: 1px solid var(--border); font-family: var(--font-head); letter-spacing: 1px; }
.schedule-slot-card { padding: 12px; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.schedule-slot-card:last-child { border-bottom: none; }
.schedule-slot-card:hover { background: var(--glass); }
.slot-time { font-family: var(--font-mono); color: var(--gold); font-size: 11px; margin-bottom: 4px; }
.slot-stud { color: var(--ivory); font-weight: 600; font-size: 14px; }
.slot-lvl { color: var(--ivory3); font-size: 11px; margin-top: 2px; }

/* ── STATUS STYLES ── */
.status-paid { background: rgba(82,196,26,0.15); color: #52c41a; border: 1px solid rgba(82,196,26,0.2); }
.status-pending { background: rgba(201,150,12,0.15); color: var(--gold); border: 1px solid rgba(201,150,12,0.2); }
.status-due { background: rgba(255,77,79,0.15); color: #ff4d4f; border: 1px solid rgba(255,77,79,0.3); font-weight: 700; text-shadow: 0 0 10px rgba(255,77,79,0.3); animation: pulse-red 2s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255,77,79,0.2); } 70% { box-shadow: 0 0 0 6px rgba(255,77,79,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,79,0); } }

/* ── SELECTOR MINIMAL ── */
.selector-minimal { background: transparent; border: none; color: var(--gold); font-family: system-ui, -apple-system, sans-serif; font-weight: 600; font-size: 11px; cursor: pointer; padding: 2px 0; border-radius: 6px; transition: all 0.2s; outline: none; text-transform: none; letter-spacing: 0; width: auto; max-width: 120px; }
.selector-minimal:hover { background: rgba(232,168,48,0.1); }
.selector-minimal option { background: var(--surface); color: var(--ivory); text-transform: none; font-weight: 400; }

/* ── PARENT PORTAL TABS ── */
.tabs-nav { display: flex; gap: 12px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.tab-link { background: transparent; border: none; color: var(--ivory3); padding: 10px 18px; font-family: var(--font-ui); font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; border-radius: 4px 4px 0 0; }
.tab-link:hover { color: var(--ivory); background: var(--gold-mist); }
.tab-link.active { color: var(--gold); border-bottom-color: var(--gold); background: linear-gradient(180deg, transparent 0%, rgba(232,168,48,0.05) 100%); }
.child-tab-content, .dash-tab-content { display: none; }
.child-tab-content.active, .dash-tab-content.active { display: block; animation: fadeUp 0.3s ease-out; }

/* ── ATTENDANCE HEATMAP ── */
.heatmap-container { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 16px; background: var(--surface2); border-radius: 12px; border: 1px solid var(--border); margin-top: 10px; }
.heatmap-day { aspect-ratio: 1; background: var(--surface3); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--ivory3); position: relative; transition: transform 0.2s; }
.heatmap-day:hover { transform: scale(1.1); z-index: 2; }
.heatmap-day.present { background: var(--success); color: #fff; box-shadow: 0 0 10px rgba(82,196,26,0.3); }
.heatmap-day.absent { background: var(--danger); color: #fff; box-shadow: 0 0 10px rgba(255,77,79,0.3); }
.heatmap-day .day-label { display: block; font-size: 8px; opacity: 0.7; margin-top: 2px; }

/* ── RESOURCE LIBRARY ── */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 18px; }
.resource-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: 0.25s; display: flex; flex-direction: column; gap: 12px; }
.resource-card:hover { transform: translateY(-4px); border-color: var(--gold); background: var(--surface); }
.res-type { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); font-weight: 700; }
.res-title { font-family: var(--font-head); font-size: 18px; color: var(--ivory); }
.res-desc { font-size: 13px; color: var(--ivory3); line-height: 1.5; }
.res-action { margin-top: auto; }

/* ── NOTIFICATION SYSTEM ── */
#notification-btn.has-notifications::after { content: ''; position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; animation: notificationPulse 2s infinite; }
@keyframes notificationPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.2); } }
.notification-item { display: flex; align-items: flex-start; gap: 12px; padding: 16px; margin-bottom: 8px; background: var(--surface); border: 1px solid rgba(232,168,48,0.1); border-radius: var(--radius-sm); transition: all 0.2s ease; }
.notification-item:hover { background: var(--surface2); border-color: var(--gold); }
.notification-item.success { border-left: 3px solid var(--success); }
.notification-item.warning { border-left: 3px solid var(--gold); }
.notification-item.error { border-left: 3px solid var(--danger); }
.notification-item.info { border-left: 3px solid var(--accent); }
.notification-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.notification-item.success .notification-icon { color: var(--success); }
.notification-item.warning .notification-icon { color: var(--gold); }
.notification-item.error .notification-icon { color: var(--danger); }
.notification-item.info .notification-icon { color: var(--accent); }
.notification-message { font-weight: 500; margin-bottom: 4px; color: var(--ivory); }
.notification-time { font-size: 12px; color: var(--ivory3); }

/* ── MESSAGES LIST ── */
.msgs-list { display: grid; gap: 16px; }
.msg-card { background: var(--surface); border: 1px solid rgba(232,168,48,0.1); border-radius: var(--radius-lg); padding: 20px; transition: all 0.2s; position: relative; }
.msg-card.unread { border-left: 3px solid var(--gold); }
.msg-card:hover { border-color: rgba(232,168,48,0.25); }
.msg-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.msg-card-sender { font-weight: 600; color: var(--gold); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.msg-card-subject { color: var(--ivory); font-size: 14px; margin-top: 2px; font-weight: 500; }
.msg-card-time { font-family: var(--font-mono); font-size: 11px; color: var(--ivory3); }
.msg-card-body { font-size: 13px; color: var(--ivory2); line-height: 1.5; margin-bottom: 12px; }
.msg-card-actions { display: flex; gap: 8px; }

/* ── COACH CARDS ── */
.coach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 24px; }
.coach-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1); display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.coach-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--gold), var(--gold2)); opacity: 0; transition: opacity 0.3s; }
.coach-card:hover { transform: translateY(-8px); border-color: var(--gold); box-shadow: 0 12px 32px rgba(0,0,0,0.4), var(--shadow-amber); }
.coach-card:hover::before { opacity: 1; }
.coach-card-header { display: flex; align-items: center; gap: 16px; }
.coach-card-av { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; border: 2px solid var(--gold); }
.coach-card-title { font-family: var(--font-head); font-size: 20px; color: var(--gold); font-weight: 700; line-height: 1.2; }
.coach-card-subtitle { font-size: 11px; color: var(--ivory3); text-transform: uppercase; letter-spacing: 1px; }
.coach-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface2); border-radius: var(--radius-sm); padding: 12px; gap: 8px; }
.coach-stat { display: flex; flex-direction: column; align-items: center; }
.coach-stat-label { font-size: 9px; text-transform: uppercase; color: var(--ivory3); margin-bottom: 4px; }
.coach-stat-val { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--ivory); }
.coach-card-actions { display: flex; gap: 10px; margin-top: auto; }
.coach-card-actions .btn { flex: 1; padding: 10px; font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -40px; left: 0; background: var(--gold); color: var(--obsidian); padding: 8px 16px; z-index: 10000; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 0; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(232,168,48,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(232,168,48,0.4); }
.scroll-thin { scrollbar-width: thin; scrollbar-color: rgba(232,168,48,0.15) transparent; }
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--gold-glow); border-radius: 10px; }

/* ── FLUID UTILITIES ── */
.img-fluid { max-width: 100%; height: auto; }
.flex-adaptive { display: flex; flex-wrap: wrap; gap: 16px; }

/* ═══════════════════════════════════════════════════════════════
   MASTER ADAPTIVE ENGINE — Responsive Breakpoints
   ═══════════════════════════════════════════════════════════════ */
/* ── RESPONSIVE GRID UTILITIES ── */
.grid-2-col { display: grid; grid-template-columns: 1fr 1fr; }
.grid-3-col { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.grid-sidebar-layout { display: grid; grid-template-columns: 1fr 2.5fr; }

@media (max-width: 1024px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); width: 280px; box-shadow: 20px 0 60px rgba(0,0,0,0.8); z-index: 10000; }
  .sidebar.active, .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0 !important; width: 100% !important; }
  .top-bar { padding: 16px 20px; flex-wrap: wrap; gap: 10px; }
  .top-nav-right { gap: 10px; }
  .content { padding: 20px; }
  .dash-charts { grid-template-columns: 1fr; }
  .dash-grid { gap: 14px; margin-bottom: 14px; }
}

@media (max-width: 768px) {
  /* ── RESPONSIVE GRID OVERRIDES ── */
  .grid-2-col, .grid-3-col, .grid-sidebar-layout { grid-template-columns: 1fr !important; }
  .content { padding: 16px !important; }
  .login-box { padding: 32px 24px !important; }
  .modal-box { width: 95vw !important; max-height: 85vh !important; padding: 24px !important; }
  .profile-hdr { flex-direction: column; align-items: flex-start; gap: 16px; }
  
  /* ── PREMIUM MOBILE TOP-BAR FLEX WRAPPING ── */
  .top-bar {
    flex-wrap: wrap !important;
    padding: 12px 16px !important;
    gap: 12px 0 !important;
  }
  .page-title {
    width: auto !important;
    font-size: 18px !important;
    gap: 12px !important;
  }
  .top-nav-right {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 4px !important;
  }
  #top-btn-area {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }
  #top-btn-area .btn {
    flex: 1 1 auto !important;
    text-align: center !important;
    font-size: 11px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* ── COMPACT ADAPTIVE STAT CARDS GRID ── */
  .dash-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }
  .card {
    padding: 14px 16px !important;
    border-radius: 12px !important;
  }
  .stat-label {
    font-size: 9px !important;
    letter-spacing: 1px !important;
    margin-bottom: 4px !important;
  }
  .stat-value {
    font-size: 20px !important;
  }

  /* ── COLLAPSIBLE FILTERS PANEL SYSTEM ── */
  #filter-toggle-btn {
    display: flex !important;
  }
  #student-filter-bar {
    display: none !important;
    width: 100% !important;
  }
  #student-filter-bar.active {
    display: flex !important;
    animation: slideDownFade 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .filter-bar select, .filter-bar input, .filter-bar button {
    padding: 8px 10px !important;
    font-size: 12px !important;
    min-width: 110px !important;
  }

  @keyframes slideDownFade {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .page-title { font-size: 20px; }

  .profile-hdr { padding: 24px; flex-direction: column; align-items: center; text-align: center; gap: 20px; }
  .profile-info { flex-direction: column; gap: 16px; }
  .profile-actions { width: 100%; justify-content: center; flex-direction: column; }
  .profile-actions .btn { width: 100%; }

  .hero-img { height: 160px; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; margin: 0 -10px; padding: 0 10px; width: calc(100% + 20px); }
  table { min-width: 750px; }

  .modal-box { width: 95vw !important; padding: 24px !important; margin: 10px auto; }

  /* FIX: del-btn finger-friendly touch target on mobile */
  .del-btn { width: 36px; height: 36px; font-size: 16px; }

  /* FIX: heatmap readable on phones */
  .heatmap-container { gap: 4px; padding: 10px; }
  .heatmap-day { font-size: 8px; }
}

@media (max-width: 480px) {
  .page-title { font-size: 18px; }
  .top-profile-name, .top-profile-hello { display: none; }
  .modal-box { padding: 20px; width: 98vw; border-radius: 12px; }
  input, select, textarea { font-size: 16px !important; } /* Stop iOS zoom */
  .logo-text { font-size: 16px; }
  .ai-chat-panel { width: calc(100vw - 16px); right: 8px; bottom: 90px; }
  .ai-chat-btn { right: 16px; bottom: 20px; }
  .chat-panel { width: calc(100vw - 16px); right: 8px; bottom: 90px; }
  .chat-fab { right: 16px; bottom: 20px; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── COACH PORTAL ── */
.coach-shell { display: flex; flex-direction: column; gap: 18px; width: 100%; }
.coach-section-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); }
.coach-section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.coach-section-row > *:last-child { margin-left: auto; }
.coach-header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.coach-section-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--ivory); margin: 0; letter-spacing: 0.2px; }
.coach-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.coach-stat-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; align-items: center; gap: 14px; transition: 0.25s; }
.coach-stat-card:hover { border-color: rgba(232,168,48,0.25); transform: translateY(-2px); box-shadow: var(--shadow-amber); }
.coach-stat-icon-wrap { width: 44px; height: 44px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.coach-stat-info { flex: 1; min-width: 0; }
.coach-stat-value { font-size: 24px; font-weight: 700; color: var(--ivory); font-family: var(--font-mono); line-height: 1; margin-bottom: 4px; word-break: break-word; }
.coach-stat-label { font-size: 11px; color: var(--ivory-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.coach-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid rgba(232,168,48,0.1); box-shadow: var(--shadow); background: var(--surface); }
.coach-mini-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 0; }
.coach-mini-table th { text-align: left; padding: 12px 14px; font-size: 11px; color: var(--ivory3); border-bottom: 1px solid var(--border); background: var(--surface2); font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
.coach-mini-table td { padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; vertical-align: middle; }
.coach-mini-table tbody tr:last-child td { border-bottom: none; }
.coach-mini-table tbody tr:hover { background: var(--gold-mist); }
.coach-loading-cell { text-align: center; color: var(--ivory-dim); padding: 22px; font-style: italic; font-size: 13px; }
/* auto-fit, not a fixed 4 — the marking summary renders 5 tiles
   (Present/Absent/Late/Excused/Unmarked) and must not overflow on narrow screens. */
.coach-attendance-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-bottom: 16px; }
.coach-attendance-item { text-align: center; padding: 14px 10px; border-radius: var(--radius-sm); background: var(--surface2); border: 1px solid var(--border); }
.coach-attendance-item.present { border-left: 3px solid var(--success); }
.coach-attendance-item.absent { border-left: 3px solid var(--danger); }
.coach-attendance-item.late { border-left: 3px solid var(--gold); }
.coach-attendance-item.excused { border-left: 3px solid #8c8c8c; }
.coach-attendance-item.pending { border-left: 3px solid var(--border); opacity: 0.75; }
.attendance-count { display: block; font-size: 28px; font-weight: 700; color: var(--ivory); font-family: var(--font-mono); line-height: 1; margin-bottom: 6px; }
.attendance-label { font-size: 11px; color: var(--ivory-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.coach-quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.coach-action-btn { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface2); color: var(--ivory); font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.25s; font-family: var(--font-ui); }
.coach-action-btn:hover { background: var(--gold-mist); border-color: var(--gold); color: var(--gold); transform: translateY(-1px); box-shadow: var(--shadow); }
.coach-action-btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: var(--obsidian); border: none; }
.coach-action-icon { font-size: 16px; width: 20px; text-align: center; }
.coach-action-text { line-height: 1.25; }
.coach-insight-list { display: flex; flex-direction: column; gap: 0; }
.coach-insight-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.coach-insight-item:last-child { border-bottom: none; }
.coach-insight-item:first-child { padding-top: 0; }
.coach-insight-label { font-size: 13px; color: var(--ivory-dim); font-weight: 500; }
.coach-insight-value { font-size: 14px; color: var(--ivory); font-family: var(--font-mono); font-weight: 700; white-space: nowrap; }

@media (max-width: 1200px) { .coach-stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) { .coach-quick-actions { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .coach-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .coach-section-block { padding: 14px; }
  .coach-welcome-title { font-size: 20px; }
  .coach-mini-table th, .coach-mini-table td { padding: 8px 10px; font-size: 12px; }
  .coach-quick-actions { grid-template-columns: 1fr; }
  .coach-attendance-summary { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .coach-stats-grid { grid-template-columns: 1fr; } }
.coach-insight-value {
  font-size: 14px;
  color: var(--ivory);
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

/* ── RESPONSIVE: COACH DASHBOARD ── */
@media (max-width: 1200px) {
  .coach-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .coach-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .coach-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .coach-section-block { padding: 14px; }
  .coach-welcome-title { font-size: 20px; }
  .coach-mini-table th,
  .coach-mini-table td { padding: 8px 10px; font-size: 12px; }
  .coach-quick-actions { grid-template-columns: 1fr; }
  .coach-attendance-summary { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .coach-stats-grid { grid-template-columns: 1fr; }
}

/* Header */
.coach-header-section {
  position: relative;
  background: linear-gradient(135deg, rgba(232,168,48,0.12) 0%, rgba(232,168,48,0.04) 100%);
  border: 1px solid rgba(232,168,48,0.18);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}
.coach-header-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(59,130,246,0.1) 0%, transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(59,130,246,0.06) 0%, transparent 45%);
  pointer-events: none;
}
.coach-header-content {
  position: relative;
  z-index: 1;
}
.coach-welcome-title {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  color: var(--ivory);
  margin: 0 0 8px 0;
  line-height: 1.2;
  letter-spacing: 0.2px;
}
.coach-name-highlight {
  color: var(--gold);
  font-weight: 800;
  text-shadow: 0 0 18px rgba(218,163,62,0.25);
}
.coach-welcome-subtitle {
  color: var(--ivory-dim);
  font-size: 14px;
  margin: 0;
  max-width: 760px;
  line-height: 1.6;
}

/* Section block */
.coach-section-block {
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.coach-section-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  border-color: rgba(218,163,62,0.35);
}
.coach-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.coach-section-row > *:last-child {
  margin-left: auto;
}
.coach-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.coach-section-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--ivory);
  margin: 0;
  letter-spacing: 0.2px;
}
.coach-section-badge,
.coach-link-btn {
  font-size: 12px;
  color: var(--gold);
  background: var(--surface2);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  text-decoration: none;
}
.coach-link-btn {
  background: transparent;
  border: none;
  padding: 6px 2px;
}

/* Stats */
.coach-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.coach-stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%), var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.coach-stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 14px 34px rgba(0,0,0,0.45), 0 0 0 1px rgba(218,163,62,0.25);
}
.coach-stat-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(232,168,48,0.12));
  border: 1px solid rgba(59,130,246,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(59,130,246,0.08);
}
.coach-stat-info {
  flex: 1;
  min-width: 0;
}
.coach-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--ivory);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
  word-break: break-word;
  letter-spacing: 0.2px;
}
.coach-stat-label {
  font-size: 11px;
  color: var(--ivory-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

/* Dash card */
.coach-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
}
.coach-card-body {
  padding: 16px 18px 18px;
}
.coach-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.coach-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 0;
}
.coach-mini-table th {
  text-align: left;
  color: var(--gold);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(218,163,62,0.25);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  background: rgba(218,163,62,0.06);
}
.coach-mini-table td {
  padding: 11px 14px;
  color: var(--ivory);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.18s ease;
}
.coach-mini-table tbody tr:last-child td {
  border-bottom: none;
}
.coach-mini-table tbody tr:hover td {
  background: rgba(218,163,62,0.06);
}
.coach-mini-table tbody tr:hover {
  background: transparent;
}
.coach-loading-cell {
  text-align: center;
  color: var(--ivory-dim);
  padding: 22px;
  font-style: italic;
  font-size: 13px;
}

/* Attendance */
.coach-attendance-summary {
  display: grid;
  /* auto-fit: the marking view renders 5 tiles including "Unmarked" */
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.coach-attendance-item {
  text-align: center;
  padding: 16px 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%), var(--surface2);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.coach-attendance-item.present { border-left-color: var(--success); }
.coach-attendance-item.absent { border-left-color: var(--danger); }
.coach-attendance-item.late { border-left-color: var(--gold); }
.coach-attendance-item.excused { border-left-color: #8c8c8c; }
.coach-attendance-item.pending { border-left-color: var(--border); opacity: 0.75; }
.coach-attendance-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.attendance-count {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--ivory);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.attendance-label {
  font-size: 11px;
  color: var(--ivory-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.coach-attendance-details {
  font-size: 12px;
  color: var(--ivory-dim);
  line-height: 1.5;
}

/* Quick actions */
.coach-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 1024px) {
  .coach-quick-actions { grid-template-columns: repeat(2, 1fr); }
}
.coach-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%), var(--surface2);
  color: var(--ivory);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
  font-family: var(--font-ui);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.coach-action-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(218,163,62,0.08) 0%, rgba(218,163,62,0.02) 100%);
  color: var(--gold);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}
.coach-action-btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: var(--obsidian);
  border: none;
  box-shadow: 0 6px 20px rgba(218,163,62,0.25);
}
.coach-action-btn.primary:hover {
  filter: brightness(1.08);
  color: var(--obsidian);
  box-shadow: 0 12px 30px rgba(218,163,62,0.45);
}
.coach-action-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
}
.coach-action-text {
  line-height: 1.25;
}

/* Insights */
.coach-insight-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.coach-insight-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%), var(--surface2);
  border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.coach-insight-item:hover {
  transform: translateY(-1px);
  border-color: rgba(218,163,62,0.35);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}
.coach-insight-item:last-child { border-bottom: none; }
.coach-insight-label {
  font-size: 13px;
  color: var(--ivory-dim);
  font-weight: 500;
}
.coach-insight-value {
  font-size: 14px;
  color: var(--ivory);
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1200px) {
  .coach-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .coach-main-grid { grid-template-columns: 1fr; }
  .coach-main-col,
  .coach-side-col { width: 100%; }
}
@media (max-width: 768px) {
  .coach-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .coach-section-block { padding: 14px; }
  .coach-welcome-title { font-size: 20px; }
  .coach-mini-table th,
  .coach-mini-table td { padding: 8px 10px; font-size: 12px; }
  .coach-quick-actions { grid-template-columns: 1fr; }
  .coach-attendance-summary { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .coach-stats-grid { grid-template-columns: 1fr; }
}
.coach-header-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(59,130,246,0.08) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(59,130,246,0.04) 0%, transparent 50%);
  pointer-events: none;
}
.coach-header-content {
  position: relative;
  z-index: 1;
}
.coach-greeting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.coach-emoji-wave {
  font-size: 32px;
  animation: waveAnimation 2.4s ease-in-out infinite;
  line-height: 1;
}
@keyframes waveAnimation {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(20deg); }
  40% { transform: rotate(-12deg); }
  60% { transform: rotate(14deg); }
  80% { transform: rotate(-4deg); }
}
.coach-welcome-title {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  color: var(--ivory);
  margin: 0;
  line-height: 1.2;
}
.coach-name-highlight {
  color: var(--gold);
  font-weight: 800;
}
.coach-welcome-subtitle {
  color: var(--ivory-dim);
  font-size: 14px;
  margin: 0;
  max-width: 600px;
  line-height: 1.6;
}

/* Section header */
.coach-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.coach-section-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--ivory);
  margin: 0;
  letter-spacing: 0.3px;
}
.coach-section-badge {
  font-size: 12px;
  color: var(--ivory-dim);
  background: var(--surface2);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Stats Grid */
.coach-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.coach-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
  position: relative;
  overflow: hidden;
}
.coach-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--gold);
}
.coach-stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(232,168,48,0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.coach-stat-card:hover::after {
  opacity: 1;
}
.coach-stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.coach-stat-info {
  flex: 1;
  position: relative;
  z-index: 1;
}
.coach-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ivory);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
  transition: color 0.2s;
}
.coach-stat-card:hover .coach-stat-value {
  color: var(--gold);
}
.coach-stat-label {
  font-size: 11px;
  color: var(--ivory-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.coach-stat-trend {
  font-size: 11px;
  color: var(--ivory-dim);
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.coach-stat-trend.positive {
  color: var(--success);
  background: rgba(82,196,26,0.1);
  border-color: rgba(82,196,26,0.2);
}
.coach-stat-note {
  font-size: 11px;
  color: var(--ivory-dim);
  font-weight: 600;
  position: relative;
  z-index: 1;
}
.coach-stat-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 0 rgba(245,158,11,0.4);
  animation: pulse-attention 2s infinite;
  position: relative;
  z-index: 1;
}
@keyframes pulse-attention {
  0% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  70% { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}

/* Main Dashboard Grid */
.coach-dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.coach-main-column,
.coach-sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.coach-dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}
.coach-dashboard-card:hover {
  box-shadow: var(--shadow);
  border-color: rgba(232,168,48,0.25);
  transform: translateY(-2px);
}
.coach-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.coach-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ivory);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  letter-spacing: 0.2px;
}
.coach-card-icon {
  font-size: 16px;
}
.coach-card-action {
  background: transparent;
  border: none;
  color: var(--ivory-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: 0.2px;
}
.coach-card-action:hover {
  color: var(--gold);
  background: var(--surface2);
  transform: translateX(2px);
}
.coach-card-body {
  padding: 16px 20px;
  flex: 1;
}
.coach-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.08);
}
.coach-more-link {
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.3px;
}
.coach-add-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: var(--obsidian);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.coach-add-btn:hover {
  transform: scale(1.1);
}

/* Mini Tables */
.coach-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.coach-mini-table th {
  text-align: left;
  color: var(--ivory-dim);
  font-weight: 700;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.coach-mini-table td {
  padding: 10px 8px;
  color: var(--ivory);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.coach-mini-table tr:last-child td {
  border-bottom: none;
}
.coach-mini-table tbody tr {
  transition: background 0.2s;
}
.coach-mini-table tbody tr:hover {
  background: var(--gold-mist);
}
.coach-loading-cell {
  text-align: center;
  color: var(--ivory-dim);
  padding: 24px;
  font-style: italic;
  font-size: 13px;
}

/* Attendance */
.coach-attendance-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.coach-attendance-item {
  flex: 1;
  text-align: center;
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.coach-attendance-item.present {
  border-left: 3px solid var(--success);
}
.coach-attendance-item.absent {
  border-left: 3px solid var(--danger);
}
.coach-attendance-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.attendance-count {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--ivory);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
}
.attendance-label {
  font-size: 11px;
  color: var(--ivory-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.coach-attendance-details {
  font-size: 12px;
  color: var(--ivory-dim);
  padding-top: 8px;
  line-height: 1.6;
}

/* Quick Actions */
.coach-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.coach-action-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ivory);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 600;
}
.coach-action-btn:hover {
  background: var(--gold-mist);
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.coach-action-btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: var(--obsidian);
  border: none;
  font-weight: 700;
}
.coach-action-btn.primary span {
  font-size: 16px;
}
.coach-action-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.coach-action-text {
  font-size: 12px;
  line-height: 1.3;
}

/* Insights */
.coach-insight-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.coach-insight-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.coach-insight-item:first-child {
  padding-top: 0;
}
.coach-insight-label {
  font-size: 13px;
  color: var(--ivory-dim);
  font-weight: 500;
}
.coach-insight-value {
  font-size: 14px;
  color: var(--ivory);
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ── PRINT ── */
@media print {
  .sidebar, .top-bar, .btn, .modal, #toast-container, .nav-group { display: none !important; }
  .main { margin: 0; width: 100%; padding: 20px; }
  body { background: white; color: black; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
/* ── COUNTRY SELECTOR & DROPDOWN ── */
.country-selector {
  position: relative;
  user-select: none;
}

.country-selected-display {
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 122px;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  color: var(--ivory);
}

.country-selected-display::after {
  content: '▾';
  font-size: 11px;
  color: var(--ivory3);
  transition: transform 0.2s ease;
}

.country-selected-display:hover {
  border-color: var(--gold);
  background: var(--surface);
  box-shadow: 0 0 10px var(--gold-glow);
}

.country-selector:focus-within .country-selected-display {
  border-color: var(--gold);
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px; /* Comfortable width for search and country names */
  background: rgba(30, 30, 46, 0.96); /* Opaque premium surface */
  backdrop-filter: blur(15px);
  border: 1px solid rgba(220, 163, 62, 0.35); /* Crisp gold border */
  border-radius: var(--radius-sm);
  max-height: 310px;
  z-index: 9999; /* Higher than other form controls and modal containers */
  box-shadow: var(--shadow-deep), 0 0 30px rgba(220, 163, 62, 0.1);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

/* Open state with class toggle */
.country-dropdown.open {
  display: flex !important;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.country-search-container {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
}

.country-search-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(220, 163, 62, 0.15) !important;
  border-radius: 6px !important;
  color: var(--ivory) !important;
  font-size: 13px !important;
  outline: none !important;
  margin-bottom: 0 !important; /* Override standard input margin */
  transition: all 0.2s ease !important;
}

.country-search-input:focus {
  border-color: var(--gold) !important;
  background: rgba(0, 0, 0, 0.2) !important;
  box-shadow: 0 0 8px var(--gold-glow) !important;
}

.country-options-wrapper {
  overflow-y: auto;
  flex: 1;
  max-height: 240px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.country-options-wrapper::-webkit-scrollbar {
  width: 5px;
}

.country-options-wrapper::-webkit-scrollbar-thumb {
  background: rgba(220, 163, 62, 0.3);
  border-radius: 4px;
}

.country-options-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.country-option {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.country-option:last-child {
  border-bottom: none;
}

.country-option:hover {
  background: rgba(220, 163, 62, 0.12); /* Subtle gold highlight */
}

.country-option.selected {
  background: rgba(220, 163, 62, 0.2);
  color: var(--gold);
  font-weight: 600;
}

.country-flag-box {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px; /* Beautiful large emoji flag size */
  line-height: 1;
}

.country-name {
  flex: 1;
  font-size: 13px;
  color: var(--ivory2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.country-option:hover .country-name {
  color: var(--ivory);
}

.country-option.selected .country-name {
  color: var(--gold2);
}

.country-dial {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  text-align: right;
}


/* ── PREMIUM NOTIFICATION SELECTION CARDS ── */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.channel-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface2);
  border: 1px solid rgba(232, 168, 48, 0.08);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.channel-card:hover {
  background: var(--surface3);
  border-color: rgba(232, 168, 48, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), 0 0 10px var(--gold-mist);
}

/* Hide standard radio */
.channel-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px !important;
  height: 18px !important;
  border: 2px solid var(--ivory3);
  border-radius: 50% !important;
  margin: 0 !important;
  padding: 0 !important;
  outline: none !important;
  background: transparent !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.channel-card input[type="radio"]::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  transform: scale(0);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Checked states */
.channel-card.active,
.channel-card:has(input[type="radio"]:checked) {
  background: linear-gradient(135deg, rgba(220, 163, 62, 0.1) 0%, rgba(220, 163, 62, 0.02) 100%);
  border-color: var(--gold) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 15px var(--gold-glow) !important;
}

.channel-card:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}

.channel-card:has(input[type="radio"]:checked) input[type="radio"]::before {
  transform: scale(1);
}

/* Brand colored selection glows */
.channel-card[data-channel="whatsapp"]:has(input[type="radio"]:checked) {
  border-color: var(--success) !important;
  background: linear-gradient(135deg, rgba(82, 196, 26, 0.08) 0%, rgba(82, 196, 26, 0.01) 100%) !important;
}
.channel-card[data-channel="whatsapp"]:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: var(--success) !important;
}
.channel-card[data-channel="whatsapp"]:has(input[type="radio"]:checked) input[type="radio"]::before {
  background: var(--success) !important;
}

.channel-card[data-channel="sms"]:has(input[type="radio"]:checked) {
  border-color: var(--accent) !important;
  background: linear-gradient(135deg, rgba(90, 159, 255, 0.08) 0%, rgba(90, 159, 255, 0.01) 100%) !important;
}
.channel-card[data-channel="sms"]:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: var(--accent) !important;
}
.channel-card[data-channel="sms"]:has(input[type="radio"]:checked) input[type="radio"]::before {
  background: var(--accent) !important;
}

.channel-card[data-channel="email"]:has(input[type="radio"]:checked) {
  border-color: var(--amber) !important;
  background: linear-gradient(135deg, rgba(232, 168, 48, 0.08) 0%, rgba(232, 168, 48, 0.01) 100%) !important;
}
.channel-card[data-channel="email"]:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: var(--amber) !important;
}
.channel-card[data-channel="email"]:has(input[type="radio"]:checked) input[type="radio"]::before {
  background: var(--amber) !important;
}

.channel-card[data-channel="push"]:has(input[type="radio"]:checked) {
  border-color: #ff4d4f !important;
  background: linear-gradient(135deg, rgba(255, 77, 79, 0.08) 0%, rgba(255, 77, 79, 0.01) 100%) !important;
}
.channel-card[data-channel="push"]:has(input[type="radio"]:checked) input[type="radio"] {
  border-color: #ff4d4f !important;
}
.channel-card[data-channel="push"]:has(input[type="radio"]:checked) input[type="radio"]::before {
  background: #ff4d4f !important;
}

.channel-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.channel-card:hover .channel-icon {
  transform: scale(1.15) rotate(5deg);
}

.channel-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.channel-name {
  font-weight: 700;
  color: var(--ivory);
  font-size: 13.5px;
}

.channel-desc {
  font-size: 10px;
  color: var(--ivory3);
  margin-top: 3px;
}



/* ---------------------------------------------------------------
   EXPENDITURE MANAGEMENT MODULE
   --------------------------------------------------------------- */

/* Category badge pill */
.exp-cat-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Expenditure summary widget row */
.exp-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Expenditure form grid */
.exp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) { .exp-form-grid { grid-template-columns: 1fr; } }

/* Chart area inside card */
.exp-chart-wrap {
  position: relative;
  height: 260px;
}

/* Form error text */
.exp-form-error {
  color: var(--danger);
  font-size: 12px;
  min-height: 18px;
  margin-top: -8px;
  margin-bottom: 10px;
}

/* Filter bar specific for expenditures */
.exp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid rgba(232,168,48,0.08);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.exp-filter-bar select,
.exp-filter-bar input { margin-bottom: 0; padding: 8px 12px; font-size: 13px; flex: 1; min-width: 120px; }

/* Month nav strip */
.exp-month-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.exp-month-strip h3 { color: var(--gold); font-family: var(--font-head); font-size: 22px; }

/* Income vs Expense colour indicators */
.exp-income-card  { border-left: 4px solid var(--success) !important; }
.exp-expense-card { border-left: 4px solid var(--danger)  !important; }
.exp-pl-card      { border-left: 4px solid var(--amber)   !important; }

#calc-toggle-btn {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  color: var(--obsidian) !important;
  border: none;
  box-sizing: border-box;
  box-shadow: 0 6px 20px rgba(232,168,48,0.35);
  cursor: pointer;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 22px;
}
#calc-toggle-btn:hover {
  transform: translateY(-2px) scale(1.1) rotate(15deg);
  box-shadow: 0 12px 30px rgba(232,168,48,0.5), 0 0 20px rgba(232,168,48,0.2);
}
#calc-toggle-btn .ico {
  font-size: 22px;
}

.calc-window {
  position: fixed;
  bottom: 175px;
  right: 30px;
  width: 320px;
  background: rgba(14, 14, 26, 0.9);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-deep);
  border-radius: var(--radius-lg);
  overflow: hidden;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  animation: calcFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
@keyframes calcFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.calc-header {
  background: rgba(232, 168, 48, 0.08);
  border-bottom: 1px solid rgba(232, 168, 48, 0.1);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
}
.calc-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold2);
  letter-spacing: 0.5px;
}
.calc-controls {
  display: flex;
  gap: 6px;
}
.calc-ctrl-btn {
  background: none;
  border: none;
  color: var(--ivory3);
  font-size: 15px;
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}
.calc-ctrl-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--ivory);
}
.calc-ctrl-btn.calc-close:hover {
  background: var(--danger);
  color: #fff;
}

.calc-display-container {
  background: rgba(0, 0, 0, 0.35);
  padding: 14px;
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
#calc-prev-expression {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ivory3);
  min-height: 16px;
  letter-spacing: 0.5px;
  overflow-x: auto;
  white-space: nowrap;
}
#calc-display {
  font-family: var(--font-mono);
  font-size: 26px;
  color: var(--gold2);
  font-weight: 700;
  overflow-x: auto;
  white-space: nowrap;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
}
.calc-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  padding: 12px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc-btn:hover {
  background: rgba(232,168,48,0.08);
  border-color: rgba(232,168,48,0.25);
  color: var(--gold2);
  transform: translateY(-1px);
}
.calc-btn:active {
  transform: scale(0.96);
}
.calc-mem {
  font-size: 13px !important;
  color: var(--amber) !important;
  font-weight: 700;
  background: rgba(232,168,48,0.03) !important;
}
.calc-btn.calc-action {
  background: rgba(232,168,48,0.05);
  color: var(--gold);
}
.calc-btn.calc-action:hover {
  background: rgba(232,168,48,0.15);
  color: var(--gold2);
}
.calc-btn.calc-equals {
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: var(--obsidian);
  border: none;
  font-weight: 700;
}
.calc-btn.calc-equals:hover {
  background: linear-gradient(135deg, var(--gold2), var(--amber));
  box-shadow: 0 4px 12px rgba(232,168,48,0.25);
  color: var(--obsidian);
}

/* Minimize/Collapse state */
.calc-window.minimized #calc-body-wrap {
  display: none;
}
.calc-window.minimized {
  width: 180px;
  bottom: 110px;
}

/* Mobile placement for the calculator widgets.
   This has to live AFTER the base #calc-toggle-btn / .calc-window rules above:
   the selectors have equal specificity, so an earlier media query (the
   max-width:480px block up near .chat-fab) would lose the cascade and never
   apply. The calculator button stacks directly above .chat-fab, which mobile
   moves to right:16px/bottom:20px — it must follow that right edge or the two
   sit 12px out of line. Bottom keeps the desktop 12px gap: 20+56+12 = 88px. */
@media (max-width: 480px) {
  #calc-toggle-btn { right: 16px; bottom: 88px; }
  .calc-window { width: calc(100vw - 16px); right: 8px; bottom: 156px; }
  .calc-window.minimized { width: 180px; bottom: 156px; }
}


.ach-card:hover .ach-poster-bg { transform: scale(1.05) !important; }

/* ── PREMIUM EVENT MANAGEMENT STYLES ── */
#ev-manage-view {
  background: linear-gradient(135deg, rgba(24, 24, 36, 0.95), rgba(19, 19, 31, 0.98)) !important;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(232, 168, 48, 0.18) !important;
  box-shadow: var(--shadow-deep), 0 0 50px rgba(232, 168, 48, 0.05);
  transition: all 0.3s ease;
}
/* Light theme: the manage view must NOT stay dark navy or its dark text vanishes. */
body[data-theme="light"] #ev-manage-view {
  background: linear-gradient(135deg, #ffffff, #f7f4ec) !important;
  border: 1px solid var(--border) !important;
}
/* Mobile: keep the Event Manager inside the viewport. The registry/expenditure
   grid items were forced wide by their inner tables (default min-width:auto),
   pushing the whole page into horizontal scroll. min-width:0 lets them shrink,
   and the tables scroll inside their own wrapper instead. */
#ev-manage-view { overflow-x: hidden; }
#ev-registry-section, #ev-expenditures-section { min-width: 0; max-width: 100%; }
#ev-manage-view .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
#ev-manage-view > div[style*="grid"] { min-width: 0; }

/* Operational Groups Action Bar */
.ev-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.02));
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(232, 168, 48, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Modern micro-interaction: action buttons lift & glow on hover. */
.ev-action-bar .btn {
  transition: transform 0.15s ease, box-shadow 0.22s ease, filter 0.2s ease;
}
.ev-action-bar .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
  filter: brightness(1.06);
}
.ev-action-bar .btn:active { transform: translateY(0); }

.ev-action-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ev-action-separator {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  align-self: center;
}

@media (max-width: 991px) {
  .ev-action-separator {
    display: none;
  }
}

/* Glassmorphic Stats Grid Cards */
.ev-manage-card {
  padding: 22px;
  position: relative;
  overflow: hidden;
  border-radius: 16px !important;
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  border-left: 4px solid var(--card-accent) !important;
  background: linear-gradient(145deg, var(--surface), rgba(255, 255, 255, 0.01)) !important;
}

.ev-manage-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), var(--shadow-amber);
  border-color: var(--card-accent) !important;
}

.ev-manage-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, var(--card-accent-glow) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
  transition: opacity 0.3s;
}

.ev-manage-card:hover::before {
  opacity: 0.3;
}

/* Premium form selector and additions */
.premium-registry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(0, 0, 0, 0.15);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid rgba(232, 168, 48, 0.12);
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.premium-select-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid rgba(232, 168, 48, 0.25);
  border-radius: 8px;
  padding: 2px;
  transition: all 0.2s ease;
}

.premium-select-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

.premium-select {
  min-width: 180px;
  padding: 6px 12px;
  font-size: 13px;
  background: transparent !important;
  border: none !important;
  color: var(--ivory) !important;
  margin: 0 !important;
  outline: none !important;
  cursor: pointer;
  height: auto !important;
}

/* Premium Tables & Custom Dropdowns */
.premium-table-select {
  padding: 6px 10px;
  font-size: 12px;
  width: 105px !important;
  background: var(--surface3) !important;
  color: var(--ivory) !important;
  border: 1px solid rgba(232, 168, 48, 0.2) !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0 !important;
}

.premium-table-select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px var(--gold-glow) !important;
}

/* Action button stylings */
.round-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ivory2);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0 !important;
}

.round-icon-btn:hover {
  transform: scale(1.1) translateY(-1px);
  color: var(--btn-accent-color);
  background: var(--btn-accent-glow);
  border-color: var(--btn-accent-color);
  box-shadow: 0 0 10px var(--btn-accent-glow);
}

.round-icon-btn:active {
  transform: scale(0.95);
}

/* Accent mappings */
.btn-receipt-accent {
  --btn-accent-color: var(--accent);
  --btn-accent-glow: rgba(90, 159, 255, 0.15);
}

.btn-whatsapp-accent {
  --btn-accent-color: var(--success);
  --btn-accent-glow: rgba(82, 196, 26, 0.15);
}

.btn-trash-accent {
  --btn-accent-color: var(--danger);
  --btn-accent-glow: rgba(255, 77, 79, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   TOM AI — Training Operations Manager Styles
   ═══════════════════════════════════════════════════════════════ */

/* Command Center Header */
.tom-command-header {
  position: relative;
  background: linear-gradient(135deg, rgba(232,168,48,0.08) 0%, rgba(90,159,255,0.04) 50%, rgba(232,168,48,0.06) 100%);
  border: 1px solid rgba(232,168,48,0.18);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 40px rgba(232,168,48,0.06);
}
.tom-header-content { position: relative; z-index: 2; }
.tom-brand-row { display: flex; align-items: center; gap: 16px; }
.tom-avatar {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(232,168,48,0.35);
  animation: tomPulse 3s ease-in-out infinite;
}
@keyframes tomPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(232,168,48,0.35); }
  50% { box-shadow: 0 8px 32px rgba(232,168,48,0.55), 0 0 60px rgba(232,168,48,0.15); }
}
.tom-title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  margin: 0;
  line-height: 1.2;
}
.tom-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--ivory3);
  display: block;
  font-family: var(--font-ui);
  letter-spacing: 0.5px;
}
.tom-status {
  font-size: 12px;
  color: var(--ivory3);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tom-online-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: onlinePulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(82,196,26,0.5);
}
.tom-neural-bg {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 50%;
  background:
    radial-gradient(circle at 70% 30%, rgba(232,168,48,0.06) 0%, transparent 50%),
    radial-gradient(circle at 30% 70%, rgba(90,159,255,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}
.tom-neural-bg::after {
  content: '🧠';
  position: absolute;
  top: 50%; right: 40px;
  transform: translateY(-50%);
  font-size: 80px;
  opacity: 0.04;
}

/* TOM KPI Grid */
.tom-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.tom-kpi-card {
  background: var(--surface);
  border: 1px solid rgba(232,168,48,0.1);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.tom-kpi-card:hover {
  border-color: rgba(232,168,48,0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-amber);
}
.tom-kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  opacity: 0;
  transition: opacity 0.25s;
}
.tom-kpi-card:hover::after { opacity: 1; }
.tom-kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tom-kpi-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--ivory);
  line-height: 1;
}
.tom-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ivory3);
  font-weight: 600;
  text-align: center;
}

/* Agent Badge */
.tom-agent-badge {
  background: rgba(232,168,48,0.1);
  border: 1px solid rgba(232,168,48,0.25);
  color: var(--gold);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Light theme TOM overrides */
body[data-theme="light"] .tom-command-header {
  background: linear-gradient(135deg, rgba(232,168,48,0.06) 0%, rgba(59,130,246,0.03) 50%, rgba(232,168,48,0.04) 100%);
  border-color: rgba(232,168,48,0.15);
}
body[data-theme="light"] .tom-kpi-card { background: #ffffff; }
body[data-theme="light"] .tom-kpi-value { color: var(--ivory); }

/* Mobile Responsive */
@media (max-width: 768px) {
  .tom-command-header { padding: 20px; }
  .tom-title { font-size: 22px; }
  .tom-neural-bg { display: none; }
  .tom-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tom-kpi-card { padding: 14px 10px; }
  .tom-kpi-value { font-size: 20px; }
  .tom-kpi-label { font-size: 9px; }
  .tom-agent-badge { display: none; }
}
@media (max-width: 480px) {
  .tom-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── ChessKidoo INVITATION CARD ── */
.twoknights-schedule-card {
  background: #ffffff;
  border: 8px solid #064e3b; /* Dark green border */
  border-radius: 24px;
  padding: 24px;
  color: #111827; /* Dark text for high contrast print style */
  font-family: 'Outfit', 'Inter', sans-serif;
  position: relative;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.twoknights-schedule-card .card-logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.twoknights-schedule-card .owl-logo-svg {
  display: inline-block;
  vertical-align: middle;
}

.twoknights-schedule-card .brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 28px;
  color: #064e3b;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0px #facc15;
}

.twoknights-schedule-card .ribbon-banner {
  background: #064e3b;
  color: #ffffff;
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  padding: 10px 15px;
  margin-left: -32px;
  margin-right: -32px;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.twoknights-schedule-card .ribbon-banner::before,
.twoknights-schedule-card .ribbon-banner::after {
  content: '';
  position: absolute;
  border-style: solid;
  top: 100%;
}

.twoknights-schedule-card .ribbon-banner::before {
  left: 0;
  border-width: 6px 8px 0 0;
  border-color: #042f1a transparent transparent transparent;
}

.twoknights-schedule-card .ribbon-banner::after {
  right: 0;
  border-width: 6px 0 0 8px;
  border-color: #042f1a transparent transparent transparent;
}

.twoknights-schedule-card .schedule-section {
  border-bottom: 1.5px solid #e5e7eb;
  padding-bottom: 16px;
  margin-bottom: 16px;
  text-align: left;
}

.twoknights-schedule-card .schedule-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.twoknights-schedule-card .section-title {
  font-size: 16px;
  font-weight: 700;
  color: #064e3b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.twoknights-schedule-card .section-title-icon {
  font-size: 20px;
}

.twoknights-schedule-card .schedule-details {
  padding-left: 28px;
}

.twoknights-schedule-card .details-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 6px;
  color: #374151;
}

.twoknights-schedule-card .details-row:last-child {
  margin-bottom: 0;
}

.twoknights-schedule-card .details-row-bold {
  font-weight: 800;
  font-size: 16px;
  color: #111827;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── CONTEXTUAL AI INSIGHTS BOX ── */
.ai-insight-box {
  background: linear-gradient(135deg, rgba(218, 163, 62, 0.08) 0%, rgba(218, 163, 62, 0.02) 100%);
  border: 1px solid rgba(218, 163, 62, 0.2);
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

.ai-insight-title {
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-family: var(--font-head);
}

.ai-insight-text {
  color: var(--ivory-dim);
}

.badge-ai-suggest {
  background: rgba(218, 163, 62, 0.15);
  color: var(--gold);
  border: 1px solid rgba(218, 163, 62, 0.35);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(218, 163, 62, 0.2);
  animation: ai-glow-pulse 2s infinite alternate;
  display: inline-block;
}

@keyframes ai-glow-pulse {
  0% { box-shadow: 0 0 4px rgba(218, 163, 62, 0.2); }
  100% { box-shadow: 0 0 10px rgba(218, 163, 62, 0.5); }
}

.modal-content, .modal-box { max-height: 85vh; overflow-y: auto; }

.coach-section-block table {
   min-width: 0;
 }

/* ── SKILL RADIAL PROGRESS BAR ── */
.skill-radial {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 8px;
}

.skill-radial svg {
  transform: rotate(-90deg);
}

.skill-radial .skill-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
}

.skill-radial .skill-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ivory);
  margin-top: 4px;
}

.skill-radial .skill-hint {
  font-size: 10px;
  color: var(--ivory-dim);
}

/* ── CHESS PERFORMANCE ERROR STATE ── */
.chess-error-state {
  padding: 20px;
  text-align: center;
  color: var(--danger);
}

.chess-error-state .retry-btn {
  margin-top: 12px;
}

/* ── CHESS PERFORMANCE EMPTY STATE ── */
.chess-empty-state {
  padding: 40px 20px;
  text-align: center;
}

.chess-empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.chess-empty-state .cta-btn {
  margin-top: 16px;
}

/* ── GAME VIEWER NAVIGATION ── */
.chess-game-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chess-game-nav button {
  padding: 4px 12px;
  font-size: 12px;
}

.chess-move-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface2);
  border-radius: 6px;
  font-family: var(--font-mono);
}

.chess-move-item {
  display: flex;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
}

.chess-move-item.current {
  background: rgba(218, 163, 62, 0.15);
}

/* Adaptive Pending Colors */
.theme-adaptive-pending { color: #1a3a5c; font-weight: 800; }
body[data-theme='light'] .theme-adaptive-pending { color: #000 !important; } 

/* Premium Custom Checkbox styling */
input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px !important;
  height: 18px !important;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0 !important;
  outline: none;
  flex-shrink: 0;
}

input[type="checkbox"]:hover {
  border-color: var(--gold);
  background: rgba(218, 163, 62, 0.05);
}

input[type="checkbox"]:checked {
  border-color: var(--gold);
  background: var(--gold);
}

input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -1px);
  transition: all 0.2s ease;
}

input[type="checkbox"]:disabled {
  border-color: var(--border);
  background: rgba(255,255,255,0.03);
  cursor: not-allowed;
  opacity: 0.5;
}

input[type="checkbox"]:disabled:checked::after {
  border-color: var(--ivory-dim);
}

/* Premium Click Active Scaling Transition & outline fix */
*:focus {
  outline: none !important;
}

.btn, .card, .card-clickable, input, select, textarea {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active, .card-clickable:active {
  transform: scale(0.98);
} 

/* ── Virtualized trace tables (Payments Gateway Monitor / Access Control audit log) ──
   Background must be theme-aware: the old hardcoded rgba(10,10,20,.4) turned into an
   unreadable grey wash in light theme. */
.virtual-table-container {
  background: rgba(10, 10, 20, 0.4);
}
body[data-theme="light"] .virtual-table-container {
  background: var(--surface);
}

/* Action chips inside trace rows (payment.captured, auth.login.success, ...) */
.trace-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid rgba(232, 168, 48, 0.3);
  border-radius: 4px;
  color: #fbbf24;
  background: rgba(232, 168, 48, 0.05);
}
.trace-chip.failed {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}
body[data-theme="light"] .trace-chip {
  color: #92400e;
  border-color: rgba(146, 64, 14, 0.3);
  background: rgba(245, 158, 11, 0.1);
}
body[data-theme="light"] .trace-chip.failed {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

/* ── Growth tab: full-width horizontal bands ──
   Each card spans the row; a left stats rail + right visual fills the
   space instead of leaving grid gaps. Collapses to stacked on mobile. */
.growth-split {
  display: grid;
  grid-template-columns: minmax(230px, 300px) 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .growth-split { grid-template-columns: 1fr; }
}

/* Student registry: the "->" arrow reveals actions as a dropdown panel
   anchored to the arrow, constrained to the viewport so buttons never shoot
   off-screen on narrow widths (the actions column sits far right in a
   horizontally scrolling table). */
.action-menu-container { position: relative; }
/* Student registry: the "->" arrow slides the row's actions open INLINE.
   Only one row is open at a time (tracked in JS, survives re-renders). */
.row-actions {
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.row-actions > div { display: flex; flex-wrap: wrap; gap: 4px; }
/* moreActions buttons were authored full-width for the old dropdown; inline
   them so History/Receipt/WhatsApp sit beside the primary actions. */
.row-actions .btn { flex-shrink: 0; width: auto !important; margin-bottom: 0 !important; white-space: nowrap; }

/* ── MASTER MATRIX INLINE BATCH EDITOR ── */
.mat-edit-popover {
  position: fixed;
  z-index: 10500;
  background: var(--surface2, #1c2030);
  border: 1px solid var(--border, rgba(232,168,48,0.25));
  border-radius: 10px;
  padding: 16px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  color: var(--ivory, #fff);
  font-family: inherit;
  box-sizing: border-box;
}
.mat-edit-popover h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--gold, #e8a830);
}
.mat-edit-popover label {
  display: block;
  font-size: 11px;
  color: var(--ivory-dim, #8a90a6);
  margin-top: 8px;
  margin-bottom: 4px;
  font-weight: 600;
}
.mat-edit-popover input[type="text"] {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg3, #141722);
  border: 1px solid var(--border, #2c3242);
  border-radius: 6px;
  color: var(--ivory, #fff);
  font-size: 12px;
  box-sizing: border-box;
}
.day-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.day-pill {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--bg3, #141722);
  border: 1px solid var(--border, #2c3242);
  color: var(--ivory-dim, #8a90a6);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}
.day-pill.active {
  background: var(--gold, #e8a830);
  color: #111;
  font-weight: 600;
  border-color: var(--gold, #e8a830);
}
.mat-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
}
.mat-btn-cancel {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border, #2c3242);
  color: var(--ivory-dim, #8a90a6);
  cursor: pointer;
}
.mat-btn-save {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--gold, #e8a830);
  border: none;
  color: #111;
  cursor: pointer;
}

/* Mobile responsive fixes for coach portal header & modals */
@media (max-width: 768px) {
  .coach-header-actions {
    width: 100%;
    justify-content: flex-start !important;
    gap: 8px !important;
  }
  .coach-header-actions input,
  .coach-header-actions select,
  .coach-header-actions button {
    flex: 1 1 auto;
    min-width: 130px;
  }
  #monthly-attendance-modal .modal-sub {
    flex-direction: column;
    align-items: stretch !important;
  }
  #monthly-attendance-modal .modal-sub > div {
    width: 100%;
    margin-left: 0 !important;
  }
  #monthly-attendance-modal .modal-sub input,
  #monthly-attendance-modal .modal-sub select {
    width: 100%;
  }
}

/* ── E-Library & Recorded Sessions Hub ── */
.elib-card:hover {
  transform: translateY(-4px);
  border-color: rgba(232, 168, 48, 0.4) !important;
  box-shadow: 0 16px 36px rgba(0,0,0,0.35) !important;
}

.elib-filter-pill {
  transition: all 0.2s ease;
  border-radius: 99px !important;
  padding: 6px 14px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
}

.elib-filter-pill.active {
  background: var(--gold, #e8a830) !important;
  color: #111827 !important;
  border-color: var(--gold, #e8a830) !important;
  box-shadow: 0 4px 12px rgba(232, 168, 48, 0.35) !important;
}

.elib-card:hover {
  transform: translateY(-4px);
  border-color: rgba(218, 163, 62, 0.4) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35) !important;
}

.elib-student-checkbox-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(218, 163, 62, 0.3) !important;
}

/* ── VISUAL ATTENDANCE & LESSON CALENDAR ── */
.cal-wrapper {
  transition: all 0.3s ease;
}

.cal-day-cell {
  user-select: none;
  border-radius: 8px;
  box-sizing: border-box;
}

.cal-day-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  border-color: var(--gold) !important;
}

.cal-day-present:hover {
  border-color: #2ecc71 !important;
}

.cal-day-absent:hover {
  border-color: #ff7675 !important;
}

.cal-day-late:hover {
  border-color: #f1c40f !important;
}

@media (max-width: 768px) {
  .cal-wrapper {
    overflow-x: auto;
    padding: 12px !important;
  }
  .cal-day-cell {
    min-height: 70px !important;
    padding: 4px 2px !important;
  }
}

/* ── Study PGN, Tactics & Speed Trainer Styles ── */
.chesscom-board-wrap,
.pgn-chess-grid {
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  grid-template-rows: repeat(8, 1fr) !important;
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  max-width: 480px !important;
  margin: 0 auto !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  border: 3px solid #4a3627 !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55) !important;
  position: relative !important;
  box-sizing: border-box !important;
}

.pgn-square,
.tactics-square {
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  user-select: none !important;
  position: relative !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  transition: filter 0.1s ease;
}

.pgn-square:hover,
.tactics-square:hover {
  filter: brightness(1.08);
}

.piece-svg-box {
  width: 88% !important;
  height: 88% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35)) !important;
  pointer-events: none !important;
  box-sizing: border-box !important;
}

.piece-svg-box svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
}

.pgn-move-btn {
  transition: all 0.15s ease;
}

.pgn-move-btn:hover {
  background: rgba(218, 163, 62, 0.25) !important;
  color: var(--gold) !important;
}

@media (max-width: 860px) {
  .studypgn-split-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  #admin-elibrary-grid,
  #coach-elibrary-grid,
  #child-elibrary-grid {
    grid-template-columns: 1fr !important;
  }
  .elib-filter-pill {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}



