/* =================================================================
   Any Course — Premium UI (v4 · Red + Dark Black)
   Palette: deep black + crimson red
   Fonts:   Instrument Serif (display)
            Manrope (body, UI)
   ================================================================= */

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

:root{
  /* Base (near-black) */
  --ink-0:#07060a;
  --ink-1:#0b0a0e;
  --ink-2:#121015;
  --ink-3:#19161c;
  --ink-4:#231e25;
  --line:  #3a323e;

  /* Foreground */
  --paper:   #f4eef0;
  --paper-2: #e0d6da;
  --muted:   #a89ea3;
  --muted-2: #7d7379;

  /* Red accents */
  --red:     #e11d2a;
  --red-2:   #ff3847;
  --red-3:   #a11521;
  --red-glow:rgba(225, 29, 42, .35);
  --mint:    #85dfa4;

  --shadow: 0 12px 40px -20px rgba(0,0,0,.85), 0 2px 10px -4px rgba(225,29,42,.22);
  --radius: 14px;
  --radius-sm: 9px;

  /* Typography */
  --f-display:"Instrument Serif", "Times New Roman", serif;
  --f-body:   "Manrope", system-ui, sans-serif;
  --f-mono:   "JetBrains Mono", ui-monospace, monospace;

  color-scheme: dark;
}

html,body{ background:var(--ink-0); color:var(--paper); min-height:100%; }
body{
  font-family:var(--f-body);
  font-size:15.5px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  position:relative;
  letter-spacing:.01em;
}

/* ----- Background: grain + red orbs ----- */
.bg-grain{
  position:fixed; inset:0; pointer-events:none; z-index:0; opacity:.30;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/></svg>");
  mix-blend-mode:overlay;
}
.bg-orb{ position:fixed; pointer-events:none; z-index:0; filter:blur(100px); opacity:.30;
  border-radius:999px; }
.bg-orb-1{ width:540px; height:540px; left:-180px; top:-160px;
  background: radial-gradient(circle at center, var(--red) 0%, transparent 70%); }
.bg-orb-2{ width:640px; height:640px; right:-220px; bottom:-260px;
  background: radial-gradient(circle at center, #6b0913 0%, transparent 70%); opacity:.25; }

::selection{ background:var(--red); color:#fff; }

/* ============ LAYOUT ============ */
.wrap{ position:relative; z-index:1; max-width:1240px; margin:0 auto; padding:36px 28px 120px; }

/* ============ NAV ============ */
.topnav{
  position:sticky; top:0; z-index:50;
  backdrop-filter: blur(18px) saturate(140%);
  background: color-mix(in oklab, var(--ink-0) 75%, transparent);
  border-bottom:1px solid var(--ink-3);
}
.nav-inner{ max-width:1240px; margin:0 auto; padding:16px 28px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.brand{ display:inline-flex; align-items:center; gap:12px; color:var(--paper); text-decoration:none; font-weight:700; }
.brand-logo-img{ height:96px; width:auto; display:block; filter: drop-shadow(0 6px 16px rgba(225,29,42,.42)); transition: transform .2s ease; }
.brand:hover .brand-logo-img{ transform: scale(1.04); }
.login-logo{ height:190px; width:auto; margin: -8px 0 4px; filter: drop-shadow(0 10px 28px rgba(225,29,42,.5)); }

.nav-right{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.role-pill{
  display:inline-flex; align-items:center; gap:7px;
  padding:6px 11px; font-size:12.5px; font-weight:600;
  border-radius:999px; background:var(--ink-2); border:1px solid var(--ink-4); color:var(--paper-2);
}
.role-pill.admin-pill{ color:#ffd1d4; border-color:#5a1a1f; background:#2a0b0e; }
.nav-user{ color:var(--muted); font-weight:500; font-size:14px; }

/* ============ BUTTONS ============ */
.btn{
  display:inline-flex; align-items:center; gap:9px;
  padding:10px 18px; border-radius:11px;
  font:600 14px/1 var(--f-body); cursor:pointer; border:1px solid transparent;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
  text-decoration:none; white-space:nowrap;
  background:transparent; color:var(--paper);
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn-lg{ padding:13px 22px; font-size:15px; }
.btn-sm{ padding:7px 12px; font-size:13px; border-radius:9px; }
.btn-primary{
  background: linear-gradient(180deg, var(--red-2) 0%, var(--red) 50%, var(--red-3) 100%);
  color:#fff; box-shadow: 0 10px 26px -14px var(--red-glow);
  border-color: #7a0f18;
}
.btn-primary:hover{ box-shadow: 0 14px 34px -14px var(--red); filter: brightness(1.06); }
.btn-ghost{ border-color:var(--ink-4); color:var(--paper-2); background:var(--ink-2); }
.btn-ghost:hover{ background:var(--ink-3); border-color:var(--line); color:var(--paper); }
.btn-danger{ background:#2a0b0e; color:#ffb6ae; border-color:#6a1a20; }
.btn-danger:hover{ background:#3a1015; color:#fff; border-color: var(--red); }

.btn-icon{
  width:42px; height:42px; border-radius:11px; display:grid; place-items:center; border:1px solid var(--ink-4);
  background:var(--ink-2); color:var(--paper); cursor:pointer; transition: all .18s ease;
}
.btn-icon:hover{ background:var(--ink-3); }
.btn-icon.btn-primary{ background: linear-gradient(180deg, var(--red-2) 0%, var(--red) 100%); color:#fff; border:0; }

/* ============ LOGIN HERO ============ */
.login-hero{ display:grid; grid-template-columns: 1.05fr .95fr; gap:64px; align-items:center; min-height: 86vh; padding-top:40px; }
@media (max-width: 960px){ .login-hero{ grid-template-columns:1fr; gap:36px; padding-top:10px; } }

.tag{ display:inline-flex; align-items:center; gap:9px; padding:6px 13px; border-radius:999px;
  background:var(--ink-2); border:1px solid var(--ink-4); color:var(--paper-2); font-size:12.5px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; }
.tag .dot{ width:7px; height:7px; border-radius:50%; background:var(--red); box-shadow:0 0 0 4px rgba(225,29,42,.24); }

.display{
  font-family:var(--f-display); font-weight:400; font-size: clamp(44px, 6.8vw, 86px);
  line-height:1.02; margin:22px 0 16px; letter-spacing:-0.01em;
}
.display em{ color:var(--red-2); font-style:italic; }
.lead{ color:var(--paper-2); max-width:540px; font-size:17px; }

.feature-list{ list-style:none; margin-top:22px; display:grid; gap:9px; }
.feature-list li{ display:flex; gap:10px; align-items:center; color:var(--paper-2); font-weight:500; }
.feature-list i{ color:var(--red-2); }

.contact-row{ margin-top:26px; color:var(--muted); font-size:13.5px; }
.contact-row a{ color:var(--red-2); text-decoration:none; border-bottom:1px dashed var(--red-3); }

/* Login card */
.login-card{
  background: linear-gradient(160deg, #17121a 0%, #0f0c12 100%);
  border:1px solid var(--ink-4); border-radius:20px;
  padding:38px 34px; box-shadow: var(--shadow);
  position:relative; overflow:hidden;
}
.login-card::before{
  content:""; position:absolute; inset:-1px; border-radius:21px; pointer-events:none;
  background: linear-gradient(180deg, rgba(225,29,42,.24), transparent 40%); mask: linear-gradient(#000,transparent);
}
.card-header{ display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:18px; text-align:center; }
.card-header h2{ font-family:var(--f-display); font-weight:400; font-size:32px; letter-spacing:-.01em; }
.muted{ color:var(--muted); }

/* Forms */
.form{ display:grid; gap:14px; }
.form.grid-2{ grid-template-columns: 1fr 1fr; gap:14px; }
.form.grid-2 .span-2{ grid-column: span 2; }
@media (max-width: 620px){ .form.grid-2{ grid-template-columns: 1fr; } .form.grid-2 .span-2{ grid-column: span 1; } }

.field{ display:flex; flex-direction:column; gap:7px; }
.field .label{ font-size:12.5px; color:var(--muted); font-weight:600; letter-spacing:.02em; text-transform:uppercase; }
.field .label .req{ color:var(--red-2); margin-left:3px; }

.input-wrap{ position:relative; display:flex; align-items:center; }
.input-wrap.compact input{ padding:10px 14px 10px 38px; }
.input-wrap i{ position:absolute; left:14px; color:var(--muted); pointer-events:none; }
.input-wrap input, .input-wrap select, .field textarea{
  width:100%; background:var(--ink-2); border:1px solid var(--ink-4); color:var(--paper);
  padding:12px 14px 12px 42px; border-radius:11px; font: 500 14.5px/1.35 var(--f-body);
  transition: border-color .2s, background .2s;
}
.field textarea{ padding:12px 14px; min-height:64px; resize:vertical; }
.input-wrap input:focus, .field textarea:focus{ outline:none; border-color:var(--red); background:var(--ink-3); box-shadow: 0 0 0 3px rgba(225,29,42,.14); }
.input-wrap input::placeholder, .field textarea::placeholder{ color:var(--muted-2); }

.eye-btn{ position:absolute; right:10px; width:32px; height:32px; border:0; background:transparent; color:var(--muted); border-radius:8px; cursor:pointer; }
.eye-btn:hover{ color:var(--paper); background:var(--ink-3); }

.remember{ display:flex; align-items:center; gap:10px; color:var(--paper-2); font-size:13.5px; user-select:none; }
.remember input[type=checkbox]{ accent-color: var(--red); width:17px; height:17px; }

.card-foot{ margin-top:22px; text-align:center; color:var(--muted); font-size:13.5px; }
.card-foot a{ color:var(--red-2); text-decoration:none; font-weight:600; }
.card-foot a:hover{ text-decoration:underline; }

/* ============ ALERTS ============ */
.alert{ display:flex; align-items:center; gap:10px; padding:11px 14px; border-radius:11px; font-size:14px; margin: 2px 0 10px; }
.alert-danger { background:#2a0b0e; color:#ffbdb5; border:1px solid #6a1a20; }
.alert-success{ background:#0f2316; color:#b4f0c2; border:1px solid #1e4a2a; }

/* ============ PAGE HEAD ============ */
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:28px; flex-wrap:wrap; }
.h1{ font-family:var(--f-display); font-size: clamp(34px, 4.6vw, 52px); font-weight:400; letter-spacing:-.01em; }
.h1 em{ color:var(--red-2); font-style:italic; }
.head-stats{ display:flex; gap:10px; }
.mini-stat{
  display:inline-flex; flex-direction:column; background:var(--ink-2); border:1px solid var(--ink-4);
  padding:10px 16px; border-radius:12px; color:var(--paper-2);
}
.mini-stat strong{ color:var(--red-2); font-size:22px; font-family:var(--f-display); }
.mini-stat span{ font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }

/* ============ CRUMBS ============ */
.crumbs{ display:flex; align-items:center; gap:10px; color:var(--muted); font-size:14px; margin-bottom:18px; }
.crumbs a{ color:var(--paper-2); text-decoration:none; font-weight:600; }
.crumbs a:hover{ color:var(--red-2); }
.crumbs .sep{ opacity:.5; }
.crumbs strong{ color:var(--paper); }

/* ============ COURSE GRID ============ */
.course-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap:22px; }
.course-grid.admin{ grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.course-card{
  display:flex; flex-direction:column; background:var(--ink-2); border:1px solid var(--ink-4); border-radius:16px;
  overflow:hidden; text-decoration:none; color:inherit; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  position:relative;
}
.course-card:hover{ transform: translateY(-3px); border-color: var(--red-3); box-shadow: var(--shadow); }
.course-thumb{
  aspect-ratio: 16/10; background:var(--ink-3) center/cover no-repeat;
  display:grid; place-items:center; color:var(--red-2); font-size:48px; position:relative;
  text-decoration:none;
}
.course-thumb .badge{
  position:absolute; bottom:10px; left:10px; background:rgba(0,0,0,.55); backdrop-filter: blur(6px);
  color:var(--paper); padding:4px 10px; border-radius:999px; font-size:12px; font-weight:600;
}
.course-body{ padding:16px 18px 18px; display:flex; flex-direction:column; gap:6px; }
.course-body h3{ font-family:var(--f-display); font-weight:400; font-size:24px; letter-spacing:-.005em; }
.course-body p{ color:var(--muted); font-size:13.5px; min-height: 38px; }
.course-body .cta{ margin-top:6px; color:var(--red-2); font-weight:600; font-size:14px; }
.course-card.admin .actions{ display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }

.edit-box{ border-top:1px solid var(--ink-4); padding:16px 18px; background: color-mix(in oklab, var(--ink-1) 80%, transparent); }

/* Empty card */
.empty-card{
  grid-column: 1/-1;
  text-align:center; padding:46px 24px; background:var(--ink-2); border:1px dashed var(--ink-4); border-radius:16px; color:var(--muted);
}
.empty-card i{ font-size:40px; color:var(--red-3); margin-bottom:12px; display:block; }
.empty-card h3{ font-family:var(--f-display); font-size:24px; margin-bottom:6px; color:var(--paper); }

/* ============ COURSE VIEW (Great-Learning-style) ============ */
.course-view{ display:grid; grid-template-columns: 1.35fr 340px; gap:22px; align-items:start; }
@media (max-width: 980px){ .course-view{ grid-template-columns: 1fr; } }

.course-player{ display:flex; flex-direction:column; gap:14px; }
.video-wrap{
  position:relative; background:#000; border-radius:14px; overflow:hidden; border:1px solid var(--ink-4);
}
.video-wrap.big{ aspect-ratio: 16/9; }
.video-wrap video{ width:100%; height:100%; display:block; }
.video-guard{
  position:absolute; right:14px; top:12px; color: rgba(255,255,255,.6);
  background: rgba(0,0,0,.4); padding:4px 10px; border-radius:999px;
  font-family:var(--f-mono); font-size:11px; letter-spacing:.06em;
  pointer-events:none; user-select:none;
  animation: drift 21s infinite alternate ease-in-out;
}
.video-guard.small{ left:14px; top:auto; bottom:14px; right:auto; animation: drift2 18s infinite alternate ease-in-out; opacity:.8; }
@keyframes drift  { 0%{ transform: translate(0,0);} 100%{ transform: translate(-20px, 240px);} }
@keyframes drift2 { 0%{ transform: translate(0,0);} 100%{ transform: translate(30px,-180px);} }

.player-meta h2{ font-family:var(--f-display); font-weight:400; font-size:30px; }

.lesson-list{
  background:var(--ink-2); border:1px solid var(--ink-4); border-radius:14px; padding:14px; max-height: 640px; overflow:auto;
}
.lesson-list header{ padding:4px 6px 12px; border-bottom:1px solid var(--ink-4); margin-bottom:10px; }
.lesson-list header h3{ font-family:var(--f-display); font-size:21px; font-weight:400; }
.lesson-list header small{ color:var(--muted); }
.lesson-list ol{ list-style:none; display:flex; flex-direction:column; gap:4px; }
.lesson-item{
  display:grid; grid-template-columns: 28px 62px 1fr; align-items:center; gap:12px; width:100%;
  background:transparent; border:1px solid transparent; color:var(--paper); padding:10px 10px;
  text-align:left; border-radius:11px; cursor:pointer; transition: background .15s ease, border-color .15s ease;
}
.lesson-item:hover{ background:var(--ink-3); border-color:var(--ink-4); }
.lesson-item.active{ background: color-mix(in oklab, var(--red) 16%, var(--ink-3)); border-color: var(--red-3); }
.lesson-item.active .lnum{ color:var(--red-2); }
.lnum{ font-family:var(--f-mono); font-size:12px; color:var(--muted); }
.lthumb{
  width:62px; height:40px; border-radius:7px; background:var(--ink-4) center/cover no-repeat;
  display:grid; place-items:center; color:var(--red-2); font-size:12px;
}
.linfo strong{ display:block; font-size:14px; font-weight:600; }
.linfo small{ color:var(--muted); font-size:11.5px; }

/* ============ CHAT CARD (User) ============ */
.chat-card{
  margin-top:36px; background:var(--ink-2); border:1px solid var(--ink-4); border-radius:16px; overflow:hidden;
}
.chat-card-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--ink-4); }
.chat-card-head h2{ font-family:var(--f-display); font-weight:400; font-size:24px; display:flex; gap:10px; align-items:center; }
.chat-card-head h2 i{ color:var(--red-2); }
.chat-card-head small{ color:var(--muted); }
.live-pulse{ display:inline-flex; align-items:center; gap:8px; font-size:12.5px; color:var(--mint); font-weight:600; }
.live-pulse .ping{ width:8px; height:8px; border-radius:50%; background:var(--mint); box-shadow:0 0 0 4px rgba(143,214,164,.18); animation: pulse 1.5s infinite; }
@keyframes pulse{ 0%{ box-shadow:0 0 0 0 rgba(143,214,164,.35);} 100%{ box-shadow:0 0 0 12px transparent;} }

.chat-messages{ padding:20px; min-height:220px; max-height: 420px; overflow-y:auto; display:flex; flex-direction:column; gap:10px; background: color-mix(in oklab, var(--ink-1) 70%, transparent); }
.message{ display:flex; }
/* WhatsApp-style: VIEWER's own messages on the right, other party on the left */
.message.me   { justify-content: flex-end;   }
.message.them { justify-content: flex-start; }
/* Legacy support */
.message.user  { justify-content: flex-end;   }
.message.admin { justify-content: flex-start; }
/* When both legacy and new classes are present, `me`/`them` wins */
.message.me.admin { justify-content: flex-end;   }
.message.them.user{ justify-content: flex-start; }

.message .bubble{
  padding:10px 14px; max-width: 72%;
  border-radius:14px; font-size:14.5px; line-height:1.45;
  word-wrap: break-word;
  box-shadow: 0 1px 0 rgba(0,0,0,.35);
}
/* Bubble styles: self (red) vs other (dark) */
.message.me .bubble{
  background: linear-gradient(180deg, var(--red-2) 0%, var(--red) 100%);
  color:#fff; border-bottom-right-radius:5px;
}
.message.them .bubble{
  background:var(--ink-3); border:1px solid var(--ink-4); color:var(--paper); border-bottom-left-radius:5px;
}
/* Fallbacks for legacy */
.message.user .bubble  { background: linear-gradient(180deg, var(--red-2) 0%, var(--red) 100%); color:#fff; border-bottom-right-radius:5px; }
.message.admin .bubble { background:var(--ink-3); border:1px solid var(--ink-4); color:var(--paper); border-bottom-left-radius:5px; }
/* And again let new classes win */
.message.me .bubble   { background: linear-gradient(180deg, var(--red-2) 0%, var(--red) 100%); color:#fff; border-bottom-right-radius:5px; border-bottom-left-radius:14px; }
.message.them .bubble { background:var(--ink-3); border:1px solid var(--ink-4); color:var(--paper); border-bottom-left-radius:5px;  border-bottom-right-radius:14px; }
.empty-chat{ text-align:center; color:var(--muted); padding:30px 10px; }
.empty-chat i{ font-size:34px; display:block; margin-bottom:8px; }

.chat-composer{ display:flex; align-items:center; gap:8px; padding:12px; border-top:1px solid var(--ink-4); background:var(--ink-2); }
.chat-composer input[type=text]{
  flex:1; background:var(--ink-3); border:1px solid var(--ink-4); color:var(--paper);
  padding:11px 14px; border-radius:11px; font: 500 14.5px var(--f-body);
}
.chat-composer input[type=text]:focus{ outline:none; border-color:var(--red); }

/* ============ ADMIN ============ */
.stats-row{ display:grid; grid-template-columns: repeat(5, 1fr); gap:14px; margin-bottom:22px; }
@media (max-width: 900px){ .stats-row{ grid-template-columns: repeat(2, 1fr); } }
.stat-card{
  display:flex; align-items:center; gap:14px; background:var(--ink-2); border:1px solid var(--ink-4);
  padding:14px 18px; border-radius:14px;
}
.stat-card i{ font-size:22px; color:var(--red-2); background:var(--ink-3); padding:10px; border-radius:11px; }
.stat-card span{ font-family:var(--f-display); font-size:26px; font-weight:400; display:block; }
.stat-card small{ color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.06em; }
.stat-card.hot i{ color:#ff9b9b; background:#2a0b0e; }

.tabs{ display:flex; gap:6px; margin-bottom:20px; border-bottom:1px solid var(--ink-3); overflow-x:auto; }
.tab{
  text-decoration:none; color:var(--muted); padding:11px 16px; font-weight:600; font-size:14px;
  border-bottom:2px solid transparent; display:inline-flex; gap:8px; align-items:center; white-space:nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover{ color:var(--paper); }
.tab.active{ color:var(--red-2); border-bottom-color: var(--red); }
.tab-badge{ background:var(--red); color:#fff; border-radius:999px; font-size:11px; padding:1px 7px; font-weight:700; }

/* Panels */
.panel{ background:var(--ink-2); border:1px solid var(--ink-4); border-radius:16px; padding:22px; margin-bottom:22px; }
.panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.panel-head h2{ font-family:var(--f-display); font-weight:400; font-size:24px; display:flex; gap:10px; align-items:center; }
.panel-head h2 i{ color:var(--red-2); }

.search-form{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.search-form .input-wrap{ min-width: 260px; }
.search-form .input-wrap input{ padding:9px 14px 9px 38px; }

/* Tables */
.table-wrap{ overflow-x:auto; }
.data-table{ width:100%; border-collapse:separate; border-spacing:0; font-size:14px; }
.data-table thead th{
  text-align:left; color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.05em;
  padding:10px 12px; border-bottom:1px solid var(--ink-4);
}
.data-table tbody td{ padding:12px; border-bottom:1px solid var(--ink-3); vertical-align: middle; }
.data-table th.right, .data-table td.right{ text-align:right; }

.tiny-thumb{ display:inline-block; width:54px; height:34px; border-radius:6px; background:var(--ink-4) center/cover no-repeat; }

.empty-muted{ color:var(--muted); padding:16px; text-align:center; }

/* Access grid */
.access-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:10px; margin-bottom:14px; }
.access-item{ display:flex; align-items:center; gap:10px; padding:12px; border:1px solid var(--ink-4); border-radius:11px; cursor:pointer; background:var(--ink-3); transition: border-color .15s, background .15s; }
.access-item:hover{ border-color:var(--line); }
.access-item.on, .access-item:has(input:checked){ border-color:var(--red-3); background: color-mix(in oklab, var(--red) 12%, var(--ink-3)); }
.access-item input{ accent-color: var(--red); width:17px; height:17px; }
.access-item strong{ display:block; font-size:14px; }
.access-item small{ color:var(--muted); font-size:12px; }

/* User detail layout */
.user-detail{ display:grid; grid-template-columns: 1.1fr 1fr; gap:20px; align-items:start; }
@media (max-width: 960px){ .user-detail{ grid-template-columns: 1fr; } }

/* ============ MAILBOX · prominence tweaks (colour-combo unchanged) ============ */
.mailbox-item{ padding: 14px; }
.mailbox-item .avatar{ width:44px; height:44px; font-size:20px; }
.mbx-top strong{ font-size:15px; letter-spacing:.01em; }
.mbx-top small{ color:var(--muted); font-size:11.5px; font-weight:500; }
.mbx-bot .preview{ font-size:13px; max-width:200px; }
.pane-head .avatar{ width:44px; height:44px; font-size:20px; }
.pane-head strong{ font-size:16px; }
.mailbox-card{ display:grid; grid-template-columns: 320px 1fr; background:var(--ink-2); border:1px solid var(--ink-4); border-radius:16px; overflow:hidden; min-height:560px; }
@media (max-width: 900px){ .mailbox-card{ grid-template-columns: 1fr; } }
.mailbox-list{ border-right:1px solid var(--ink-4); max-height: 620px; overflow:auto; }
.mailbox-head{ display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--ink-4); color:var(--muted); }
.mailbox-head .count{ background:var(--ink-3); border-radius:999px; padding:2px 9px; font-size:12px; }
.mailbox-item{
  display:grid; grid-template-columns: 40px 1fr; gap:12px; align-items:center; width:100%;
  padding:12px 14px; background:transparent; border:0; border-bottom:1px solid var(--ink-3); color:var(--paper); text-align:left; cursor:pointer;
}
.mailbox-item:hover{ background:var(--ink-3); }
.mailbox-item.active{ background: color-mix(in oklab, var(--red) 12%, var(--ink-3)); }
.avatar{
  width:40px; height:40px; border-radius:11px;
  background: linear-gradient(135deg, var(--red-3), var(--red-2)); color:#fff;
  display:grid; place-items:center; font-weight:700; font-family:var(--f-display); font-size:18px;
}
.avatar.placeholder{ background:var(--ink-3); color:var(--muted); }
.mbx-body{ min-width:0; }
.mbx-top{ display:flex; justify-content:space-between; gap:8px; }
.mbx-top strong{ font-size:14px; }
.mbx-bot{ display:flex; justify-content:space-between; gap:8px; align-items:center; margin-top:3px; }
.preview{ color:var(--muted); font-size:12.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:220px; }
.unread-badge{ background:var(--red); color:#fff; font-weight:700; font-size:11px; border-radius:999px; padding:1px 8px; }

.chat-pane{ display:flex; flex-direction:column; }
.pane-head{ display:flex; gap:12px; align-items:center; padding:14px 18px; border-bottom:1px solid var(--ink-4); }
.pane-head strong{ display:block; }
.pane-head small{ color:var(--muted); font-size:12px; }

/* ============ PRE-LOGIN HELP WIDGET ============ */
.fab{
  position:fixed; right:26px; bottom:26px; width:58px; height:58px; border-radius:50%;
  background: linear-gradient(135deg, var(--red-2) 0%, var(--red) 80%);
  color:#fff; border:0; cursor:pointer; box-shadow: 0 18px 40px -16px var(--red);
  font-size:20px; z-index:60; transition: transform .2s;
}
.fab:hover{ transform: translateY(-3px) rotate(-6deg); }
.chat-widget{
  position:fixed; right:26px; bottom:96px; width:360px; max-width: calc(100vw - 32px);
  background:var(--ink-2); border:1px solid var(--ink-4); border-radius:16px; overflow:hidden; z-index:60;
  transform: translateY(20px) scale(.96); opacity:0; pointer-events:none;
  transition: transform .25s ease, opacity .25s ease;
  box-shadow: var(--shadow);
}
.chat-widget.open{ transform: translateY(0) scale(1); opacity:1; pointer-events:auto; }
.widget-head{ display:flex; justify-content:space-between; align-items:center; padding:14px 16px; background: linear-gradient(180deg, var(--ink-3), transparent); border-bottom:1px solid var(--ink-4); }
.widget-head b{ display:block; color:var(--paper); font-size:14px; }
.widget-head small{ color:var(--muted); font-size:12px; }
.widget-head .x{ border:0; background:var(--ink-3); color:var(--paper); border-radius:8px; width:28px; height:28px; cursor:pointer; font-size:16px; }
.widget-body{ padding:14px; min-height:200px; max-height:300px; overflow-y:auto; display:flex; flex-direction:column; gap:8px; }
.widget-foot{ padding:10px; border-top:1px solid var(--ink-4); background:var(--ink-2); display:flex; flex-direction:column; gap:8px; }
.widget-foot .row{ display:flex; gap:6px; }
.widget-foot input{
  flex:1; background:var(--ink-3); border:1px solid var(--ink-4); color:var(--paper);
  padding:10px 12px; border-radius:10px; font: 500 14px var(--f-body);
}
.widget-foot input:focus{ outline:none; border-color:var(--red); }
.widget-foot #preChatName{ font-size:13px; }

/* ============ FOOTER ============ */
.site-foot{
  position:relative; z-index:1; max-width:1240px; margin: 60px auto 0; padding:22px 28px 40px;
  border-top:1px solid var(--ink-3); color:var(--muted); font-size:13px;
  display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap;
}
.site-foot a{ color:var(--red-2); text-decoration:none; }

/* ============ SCREEN RECORDING BLOCK OVERLAY ============ */
.recording-block{
  position:fixed; inset:0; z-index:9999;
  background: rgba(6,4,2,.92); backdrop-filter: blur(14px);
  display:grid; place-items:center; color:var(--paper);
  text-align:center; padding:32px;
}
.recording-block .inner{ max-width:480px; }
.recording-block h2{ font-family:var(--f-display); font-size:36px; font-weight:400; margin-bottom:10px; }
.recording-block p{ color:var(--paper-2); }
.recording-block i{ font-size:46px; color:var(--red-2); margin-bottom:14px; }

/* Disable selection / callouts for user role */
body[data-role="user"], body[data-role="user"] *{
  -webkit-user-select:none; user-select:none; -webkit-touch-callout:none;
}
body[data-role="user"] input, body[data-role="user"] textarea{ -webkit-user-select:text; user-select:text; }

/* Fine scrollbar */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-track{ background: transparent; }
*::-webkit-scrollbar-thumb{ background:#2a242e; border-radius:999px; }
*::-webkit-scrollbar-thumb:hover{ background:#3a323e; }