:root{
  --bg:#f3f6fb;
  --card:#ffffff;
  --text:#0b1220;
  --muted:#50627f;
  --border:#dbe3f0;
  --navy:#0b2a4a;
  --primary:#1f6feb;
  --ok:#12a150;
  --bad:#d93025;
  --soft:#f7faff;
  --font:"Inter","Segoe UI","SF Pro Text",system-ui,-apple-system,Roboto,Arial,"Noto Sans","Helvetica Neue",sans-serif;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: var(--font);
  /* Full-screen Steadi background */
  background-image: radial-gradient(closest-side at 50% 30%, rgba(0,0,0,.10), rgba(243,246,251,.85)), url('steadi-bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color:var(--text);
  font-size:16px;
  line-height:1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a{color:inherit}
.container{max-width:980px; margin:0 auto; padding:18px 16px 26px}
.appbar{
  background: var(--bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.appbar-inner{
  max-width:980px;
  margin:0 auto;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  position:relative;
}
.brand{display:flex; gap:12px; align-items:center}
.logo-dot{width:12px;height:12px;border-radius:999px;background:rgba(255,255,255,.9)}
.brand-title{font-weight:950; letter-spacing:.4px}
.brand-sub{opacity:.9; font-size:.95rem; margin-top:2px; display:flex; flex-direction:column; align-items:flex-start; gap:2px}

.appbar-logo{
  height:80px;
  width:auto;
  object-fit:contain;
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.22));
  z-index: 0;
}
@media (max-width: 820px){
  .appbar-inner{flex-wrap:wrap; padding-bottom:10px}
  .appbar-logo{
    position:static;
    transform:none;
    height:36px;
    margin:8px auto 0;
    order: 3;
  }
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 14px 34px rgba(11, 42, 74, .09);
}
.grid-2{display:grid; grid-template-columns: 1fr 1fr; gap:12px; align-items:start}
@media (max-width: 980px){.grid-2{grid-template-columns:1fr}}
.panel{
  background: rgba(255,255,255,.92);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
}
.panel-title{font-weight:950; font-size:1.02rem; margin-bottom:8px}
.h2{font-size:1.25rem; font-weight:950; margin:6px 0 12px}
.row{display:flex; gap:10px; align-items:center}
.space-between{justify-content:space-between}
.top-gap{margin-top:12px}
.label{font-weight:950; font-size:.98rem; display:block; margin-bottom:6px}
.muted{color:var(--muted)}
.small{font-size:.92rem}
.sep{border:none; border-top:1px solid var(--border); margin:14px 0}

.select, .search, .textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid rgba(219,227,240,.95);
  border-radius:12px;
  background: rgba(255,255,255,.82);
  font: inherit;
  box-shadow: 0 10px 22px rgba(11, 42, 74, .06);
  transition: box-shadow .16s ease, border-color .16s ease;
}
.textarea{resize:vertical}
.select:focus, .search:focus, .textarea:focus{
  border-color: rgba(31,111,235,.35);
  box-shadow: 0 14px 30px rgba(31,111,235,.10);
  outline:none;
}

/* --- עיצוב כפתורים גלובלי משודרג (Pro Style) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  
  /* עיצוב זכוכית ומודרני */
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.85); /* שקיפות קלה */
  color: var(--text-dark);
  backdrop-filter: blur(8px); /* טשטוש רקע */
  -webkit-backdrop-filter: blur(8px);
  
  /* הצללה עדינה */
  box-shadow: 0 4px 6px rgba(11, 42, 74, 0.08), 0 1px 3px rgba(0,0,0,0.05);
  
  /* אנימציה חלקה */
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* אפקט ריחוף */
.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 20px rgba(11, 42, 74, 0.15);
  background-color: rgba(255, 255, 255, 0.95);
  border-color: rgba(31,111,235,.3);
}

/* אפקט לחיצה */
.btn:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(11, 42, 74, 0.1);
}

/* כפתור ראשי (Primary) */
.btn.primary {
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.9), rgba(20, 90, 200, 0.9));
  color: white;
  border: none;
  box-shadow: 0 8px 16px rgba(31, 111, 235, 0.25);
}

.btn.primary:hover {
  background: linear-gradient(135deg, rgba(31, 111, 235, 1), rgba(20, 90, 200, 1));
  box-shadow: 0 12px 24px rgba(31, 111, 235, 0.35);
}

/* כפתור שקוף (Ghost) */
.btn.ghost {
  background: rgba(255, 255, 255, 0.6);
  border-color: transparent;
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.btn.wide{width:100%}
.btn.tiny{padding:6px 10px; border-radius:999px}

.badge{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  font-weight:950;
  font-size:.85rem;
}

/* --- התחלה חלק 2 --- */
.quiz-list{display:flex; flex-direction:column; gap:10px}
.quiz-item{
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  cursor:pointer;
  box-shadow: 0 10px 22px rgba(11, 42, 74, .06);
  transition: all 0.2s ease;
}
.quiz-item:hover{border-color: rgba(31,111,235,.25); transform:translateY(-2px);}
.quiz-item.selected{
  border-color: rgba(18,161,80,.55);
  box-shadow: 0 10px 24px rgba(18,161,80,.10);
}
.checkmark{
  width:22px; height:22px;
  border-radius:8px;
  border:1px solid var(--border);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:950;
  color: transparent;
  background: #fff;
}
.quiz-item.selected .checkmark{
  background: rgba(18,161,80,.12);
  border-color: rgba(18,161,80,.45);
  color: var(--ok);
}
.quiz-title{font-weight:950}
.quiz-meta{color:var(--muted)}

.pill-row{display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:10px}
.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#fff;
  font-weight:950;
  font-size:.86rem;
}
.pill.ghost{background: rgba(255,255,255,.10); color:#fff; border-color: rgba(255,255,255,.22)}

.question{
  font-size:1.30rem;
  line-height:1.7;
  font-weight:950;
  margin:12px 0;
}
.options{display:flex; flex-direction:column; gap:10px}
.btn.option{background: rgba(255,255,255,.78); justify-content: flex-start; text-align: left;}
.btn.option.selected{outline: 3px solid rgba(31,111,235,.18)}
.btn.option.correct{border-color: rgba(18,161,80,.45)}
.btn.option.wrong{border-color: rgba(217,48,37,.45)}

.rationale{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background: var(--soft);
  white-space: pre-wrap;
}

.progress-wrap{
  width:100%;
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,.22);
  border:1px solid rgba(255,255,255,.18);
  overflow:hidden;
  margin-top:12px;
}
.progress-bar{
  height:100%;
  width:0%;
  background: rgba(255,255,255,.85);
  border-radius:999px;
  transition: width .2s ease;
}

.stats{
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:12px;
}
.stats-title{ font-weight:950; margin-bottom:10px; }
.stats-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.stat{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background: var(--soft);
}
.stat-label{ color: var(--muted); font-weight:900; font-size:.86rem; }
.stat-value{ font-weight:950; font-size:1.15rem; margin-top:4px; }
.topic-list{display:flex; flex-direction:column; gap:8px}
.topic-row{display:grid; grid-template-columns:1fr 80px; gap:10px; align-items:center}
.topic-name{font-weight:950; font-size:.92rem}
.topic-acc{text-align:right; font-weight:950}
.topic-meter{
  grid-column: 1 / span 2;
  height:10px;
  border-radius:999px;
  background: #eef3fb;
  border:1px solid var(--border);
  overflow:hidden;
}
.topic-meter > div{
  height:100%;
  width:0%;
  background: rgba(31,111,235,.65);
}

.review-list{display:flex; flex-direction:column; gap:10px}
.review-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.ok{color:var(--ok)}
.bad{color:var(--bad)}
.hidden{display:none !important}


/* MCQ feedback */
.btn.option.correct{
  background: rgba(18,161,80,.14);
  border-color: rgba(18,161,80,.60);
}
.btn.option.wrong{
  background: rgba(217,48,37,.10);
  border-color: rgba(217,48,37,.60);
}
.btn.option.correct.selected{
  background: rgba(18,161,80,.18);
}
.btn.option.wrong.selected{
  background: rgba(217,48,37,.14);
}

@keyframes blinkGreen {
  0%, 100% { box-shadow: 0 0 0 rgba(18,161,80,0); transform: translateY(0); }
  50% { box-shadow: 0 0 0 6px rgba(18,161,80,.18); transform: translateY(-1px); }
}
.blink-correct{
  animation: blinkGreen .6s ease-in-out 5;
}

/* Icons */
.btn .ico{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
}
.btn .ico svg{ width: 1.15em; height: 1.15em; }

/* Admin */

/* ===== Admin menu layout fixes (buttons + responsive) ===== */
.admin-menu .btn.wide{
  justify-content:flex-start;           /* align icon+text to left */
  padding-left:16px;
  text-align:left;
}
.admin-menu .btn.wide .ico{
  width:22px;
  height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 22px;                        /* keep all icons same width */
}
/* Make menu buttons consistent on mobile too */
@media (max-width: 520px){
  .admin-menu .btn.wide{ padding:12px 14px; }
}

/* Fix "space-between" rows inside admin tabs on narrow screens (prevents jumping text) */
#adminSettingsView .row.space-between{
  flex-wrap:wrap;
  row-gap:10px;
}
#adminSettingsView .row.space-between > *{
  max-width:100%;
}

/* Review tab: prevent 2-column layouts from forcing side text outside on small screens */
@media (max-width: 520px){
  #adminReviewTab .grid-2{ grid-template-columns: 1fr !important; }
}

.admin-grid{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap:12px;
  align-items:stretch;
  min-height: 600px;
}
@media (max-width: 980px){
  .admin-grid{ grid-template-columns: 1fr; }
}
.admin-menu, .admin-content{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.admin-content {
  overflow-y: auto;
}
.admin-user-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background: var(--soft);
  margin-top:8px;
}
.admin-user-name{ font-weight:900; }
.table-wrap{ overflow:auto; border-radius:12px; border:1px solid var(--border); }
.table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}
.table th, .table td{
  padding:10px 10px;
  border-bottom:1px solid var(--border);
  text-align:left;
  white-space:nowrap;
}
.table th{ font-weight:950; background: var(--soft); }

.app-meta{ margin-left:0; font-weight:900; font-size:.86rem; color: var(--muted); }
.footer{ text-align:center; color: var(--muted); font-size:.9rem; padding:20px 0 8px; }
body.rtl{ font-family: "Heebo", var(--font); }

.footer-badge{
  display:block;
  height: 115px;
  width: auto;
  margin: 0 auto 0px;
  opacity: .95;
}

/* Home Start buttons spacing */
.panel .btn + .btn{ margin-top:10px; }


/* ================================================== */
/* --- שליטה במיקום הכפתורים העליונים (הכי חשוב) --- */
/* ================================================== */

.top-actions {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto !important;
  left: auto !important;
  margin: 0 !important;

  /* --- ידית 1: שמאלה/ימינה --- */
  /* כרגע מוגדר למה שביקשת (-70px), שנה את המספר כדי להזיז */
  right: -70px !important; 

  /* --- ידית 2: למעלה/למטה --- */
  /* כרגע מוגדר 10px, שנה את המספר כדי להזיז */
  margin-top: 10px !important;
}

/* איפוסים חשובים */
.top-actions .btn,
.top-actions .lang-wrap,
#adminSettingsBtn, 
#langBtn, 
#logoutBtn {
  position: static !important;
  transform: none !important;
  margin: 0 !important;
  left: auto !important; 
  top: auto !important;
}

/* --- צבעים ועיצוב ייחודי לכפתורים העליונים (שקיפות) --- */

/* 1. אדמין (כחול-סגול חצי שקוף) */
#adminSettingsBtn { 
  order: 1; 
  background-color: rgba(79, 70, 229, 0.9) !important; 
  color: white !important; 
  display: flex !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
}

/* 2. שפה (אפור בהיר חצי שקוף) */
.lang-wrap { order: 2; }
#langBtn { 
  background-color: rgba(241, 245, 249, 0.85) !important; 
  color: #334155 !important; 
}

/* 3. יציאה (אדום חצי שקוף) */
#logoutBtn { 
  order: 3; 
  background-color: rgba(254, 226, 226, 0.9) !important; 
  color: #991b1b !important; 
}

/* טיפול בתפריט שפה */
.lang-menu{
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 190px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  box-shadow: 0 14px 34px rgba(11, 42, 74, .12);
  padding:8px;
  z-index: 10000;
}
.lang-item{
  width:100%;
  text-align:right;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  font: inherit;
  font-weight:900;
  cursor:pointer;
}
.lang-item:hover{
  background: rgba(31,111,235,.08);
  border-color: rgba(31,111,235,.18);
}
/* --- מרכוז כפתורי ניווט במבחן --- */
.quiz-nav-row {
  justify-content: center !important; /* ממקם במרכז */
  gap: 20px; /* רווח יפה בין הכפתורים */
}

/* מוודא שהכפתורים לא נמתחים */
.quiz-nav-row .btn {
  min-width: 120px; /* רוחב מינימלי אחיד לכפתורים */
}
/* --- עיצוב משודרג לפס התקדמות --- */
.progress-wrap {
  height: 8px; /* קצת דק יותר ואלגנטי */
  background: #e2e8f0; /* רקע אפור בהיר */
  border: none;
  border-radius: 99px;
  margin-top: 16px;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, #3b82f6 0%, #4f46e5 100%); /* כחול מתחלף */
  border-radius: 99px;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.4); /* הילה זוהרת */
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); /* תנועה חלקה */
}

/* Login loading + offline banner */
.spinner{
  width:16px;
  height:16px;
  border-radius:999px;
  border:2px solid rgba(255,255,255,.55);
  border-top-color: rgba(255,255,255,1);
  display:inline-block;
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.btn.is-loading{
  opacity:.92;
  pointer-events:none;
}

.offline-banner{
  position:fixed;
  left:16px;
  right:16px;
  bottom:16px;
  z-index:9999;
  background:#fffbf0;
  border:1px solid #f59e0b;
  color:#b45309;
  border-radius:14px;
  padding:10px 12px;
  box-shadow: 0 14px 34px rgba(11, 42, 74, .12);
  font-weight:800;
}



/* ===== Steadicopter branded background (Login/Loader + App right-side) ===== */

/* Loader overlay uses the Steadicopter background image */
.loading-overlay{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0b1220;
  background-image:
    radial-gradient(closest-side at 50% 30%, rgba(0,0,0,.20), rgba(0,0,0,.75)),
    url('steadi-bg.jpg');
  background-size: cover;
  background-position: center;
}

.loading-panel{
  width: min(520px, 92vw);
  border-radius: 18px;
  padding: 22px 20px 18px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 55px rgba(0,0,0,.30);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.loading-logo{ height: 58px; margin-bottom: 4px; }

.loading-text{
  font-weight: 800;
  color: #0b2a4a;
  letter-spacing: .2px;
  text-align: center;
}

.loading-spinner{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(11,42,74,.20);
  border-top-color: rgba(11,42,74,.95);
  animation: spin 0.9s linear infinite;
  margin-top: 2px;
}

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

.loading-progress-wrap{
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(11,42,74,.12);
  overflow: hidden;
}

.loading-bar{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(11,42,74,.95);
  transition: width .22s ease;
}

.loading-pct{
  font-weight: 800;
  color: #0b2a4a;
}
/* RIGHT background (inside app) */
.right-bg{
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(38vw, 520px);
  background-image: url("steadi-bg.jpg");
  background-size: cover;
  background-position: center;
  opacity: .22;
  pointer-events: none;
  z-index: 0;
}

/* Soft fade into the app (ימין) */
.right-bg::after{
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to left,
    rgba(243,246,251,1) 0%,
    rgba(243,246,251,.86) 22%,
    rgba(243,246,251,0) 70%
  );
}


/* LEFT background (inside app) */
.left-bg{
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(38vw, 520px);
  background-image: url("steadi-bgx.jpg");
  background-size: cover;
  background-position: center;
  opacity: .22;
  pointer-events: none;
  z-index: 0;
}

/* Soft fade into the app (שמאל) */
.left-bg::after{
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(243,246,251,1) 0%,
    rgba(243,246,251,.86) 22%,
    rgba(243,246,251,0) 70%
  );
}


/* Hide side backgrounds on mobile */
@media (max-width: 900px){
  .left-bg, .right-bg{ display:none; }
}



/* ==================================================
   Chat / Tasks UI (more spacious)
   ================================================== */
.chat-messages{
  height: 520px;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}

@media (max-width: 980px){
  .chat-messages{ height: 420px; }
}

.chat-bubble{
  max-width: 88%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: var(--soft);
  margin: 8px 0;
  white-space: pre-wrap;
}

.chat-bubble.me{
  margin-left:auto;
  background: rgba(31,111,235,.10);
  border-color: rgba(31,111,235,.22);
}

.chat-bubble.them{
  margin-right:auto;
}

.chat-meta{
  font-size:.78rem;
  color: var(--muted);
  margin-top:6px;
}

.task-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
  margin-top:10px;
}
.task-item .task-title{ font-weight:950; }
.task-item .task-type{ font-weight:900; font-size:.85rem; color: var(--muted); }
.task-item .task-actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }



/* Force single full-screen background (disable side backgrounds) */
.left-bg, .right-bg{ display:none !important; }


/* =========================
   Exam Settings / Editor
========================= */
.exam-editor{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background: var(--soft);
}
.exam-editor-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height: 52vh;
  overflow:auto;
  padding-right: 6px;
}
.exam-quiz{
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  padding:10px;
}
.exam-quiz-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.exam-quiz-title{ font-weight:950; }
.exam-quiz-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.exam-q-list{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.exam-q{
  display:flex;
  gap:10px;
  align-items:flex-start;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background: var(--soft);
}
.exam-q:hover{ background: #eef3fb; }
.exam-q input{ margin-top:3px; }
.exam-q-text{ font-weight:800; }
.exam-q-meta{ color: var(--muted); font-size:.86rem; margin-top:2px; }

/* modal */
.modal{ position:fixed; inset:0; z-index: 99999; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.35); }
.modal-panel{
  position:relative;
  width: min(760px, 92vw);
  max-height: 84vh;
  overflow:auto;
  margin: 6vh auto 0;
  background:#fff;
  border-radius:16px;
  padding:14px;
  border:1px solid var(--border);
  box-shadow: 0 18px 55px rgba(0,0,0,.30);
}

/* Exam editor: collapsible quizzes */
.exam-quiz-head{
  cursor: pointer;
  user-select: none;
}
.exam-quiz-left{
  display:flex;
  align-items:flex-start;
  gap:10px;
}
.exam-caret{
  font-weight: 950;
  width: 18px;
  line-height: 1.2;
  margin-top: 2px;
  opacity: .9;
}
.exam-quiz.is-collapsed .exam-q-list{
  display:none;
}

/* WhatsApp-like chat area */
#chatMessages, #adminChatMessages{
  height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f6f7f9;
}

.wa-row{
  display:flex;
  margin: 6px 0;
}
.wa-row.mine{ justify-content: flex-end; }
.wa-row.theirs{ justify-content: flex-start; }

.wa-bubble{
  max-width: min(520px, 85%);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.wa-row.mine .wa-bubble{
  background: #dcf8c6;
}

.wa-text{
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.25;
  font-weight: 750;
}

.wa-meta{
  margin-top: 6px;
  font-size: .74rem;
  color: var(--muted);
  text-align: right;
}
.inbox-messages{
  height: 46vh;
  min-height: 320px;
  max-height: 520px;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}

.inbox-mail{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background: var(--soft);
  margin:10px 0;
}

.inbox-mail .subj{
  font-weight:950;
}

.inbox-mail .meta{
  color: var(--muted);
  font-size:.82rem;
  margin-top:6px;
}

.thread-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  margin:8px 0;
  background:#fff;
  cursor:pointer;
}

.thread-item.unread{
  border-color: rgba(255,170,0,.55);
  box-shadow: 0 0 0 2px rgba(255,170,0,.15) inset;
}

.thread-title{ font-weight:950; }
.thread-preview{ color: var(--muted); font-size:.85rem; margin-top:4px; }
/* =========================================
   NEW STYLES — v2 update
   ========================================= */

/* ── Appbar actions (3 buttons inline) ── */
.appbar-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 0 16px;
  min-height: 56px;
}
.brand { flex: 1; min-width: 0; }
.appbar-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  margin: 0 12px;
}
.appbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.appbar-actions .btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  font-size: .72rem;
  min-width: 52px;
  line-height: 1;
}
.appbar-btn-label {
  font-size: .68rem;
  line-height: 1;
}
@media (max-width: 480px) {
  .appbar-btn-label { display: none; }
  .appbar-actions .btn { min-width: 36px; padding: 6px 8px; }
}

/* Inbox badge on header button */
.inbox-header-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 900;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  pointer-events: none;
}

/* ── Home: Questionnaires full-width panel ── */
#questionnairesPanel { width: 100%; }
.quizz-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.quizz-row #selectedQuizInfo {
  flex: 1;
  min-width: 0;
}

/* ── Home: 3-action button row ── */
.home-action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.home-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  text-align: center;
  font-size: .88rem;
}
.home-action-btn .ico {
  display: block;
}
@media (max-width: 500px) {
  .home-action-row { grid-template-columns: 1fr; }
}

/* ── Timers side-by-side ── */
.timers-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.timer-item {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--soft);
}

/* ── Email Inbox styles ── */
.inbox-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  min-height: 460px;
}
@media (max-width: 680px) { .inbox-layout { grid-template-columns: 1fr; } }

.inbox-sidebar {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inbox-main {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  min-height: 420px;
}
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  max-height: 55vh;
  overflow-y: auto;
}
.inbox-item {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  cursor: pointer;
  background: #fff;
  transition: background .12s;
}
.inbox-item:hover { background: #f0f9ff; }
.inbox-item.unread { border-color: #3b82f6; background: #eff6ff; }
.inbox-item.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.inbox-item-subject { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item-meta { font-size: .74rem; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; }

.inbox-message-view { min-height: 380px; }
.inbox-message-header { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 14px; }
.inbox-message-subject { font-size: 1.15rem; font-weight: 900; margin-bottom: 5px; }
.inbox-message-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.inbox-message-body { white-space: pre-wrap; line-height: 1.7; font-size: .93rem; }
.inbox-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; color: var(--muted); }

/* Admin inbox grid */
.admin-inbox-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  min-height: 400px;
}
@media (max-width: 680px) { .admin-inbox-grid { grid-template-columns: 1fr; } }

/* ── Appbar buttons — equal size ── */
.appbar-actions .btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 12px;
  font-size: .75rem;
  min-width: 62px;
  height: 48px;
  line-height: 1;
  box-sizing: border-box;
}
.appbar-actions .btn .ico {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Toggle switch ON/OFF ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: .2s;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: #16a34a; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Exam control panel ── */
.exam-control-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--soft);
}
.exam-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Inbox compose To selector fix ── */
#inboxComposeToWrap { display: flex; flex-direction: column; gap: 4px; }

/* ═══════════════════════════════════
   BIGGER APPBAR BUTTONS
   ═══════════════════════════════════ */
.appbar-actions .btn {
  padding: 8px 14px !important;
  min-width: 68px !important;
  height: 52px !important;
  font-size: .82rem !important;
  gap: 4px !important;
}
.appbar-btn-label {
  font-size: .78rem !important;
  font-weight: 600 !important;
}
.appbar-actions .btn .ico svg {
  width: 20px !important;
  height: 20px !important;
}

/* ═══════════════════════════════════
   3-COLUMN INBOX LAYOUT
   ═══════════════════════════════════ */
.inbox-3col {
  display: grid;
  grid-template-columns: 190px 240px 1fr;
  gap: 0;
  height: calc(100vh - 200px);
  min-height: 500px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

/* Column headers */
.inbox-col-header {
  padding: 12px 14px;
  font-weight: 800;
  font-size: .88rem;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Col 1 — Contacts */
.inbox-contacts-col {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fafafa;
  padding-bottom: 10px;
}
.inbox-contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.inbox-contacts-col .btn {
  margin: 0 10px;
  font-size: .78rem;
}
.inbox-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s;
  position: relative;
}
.inbox-contact-item:hover { background: #f0f4ff; }
.inbox-contact-item.active {
  background: #eff6ff;
  border-left-color: var(--primary);
}
.inbox-contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: .88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.inbox-contact-info { flex: 1; min-width: 0; }
.inbox-contact-name {
  font-weight: 700;
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-contact-preview {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-contact-badge {
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 900;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Col 2 — Thread list */
.inbox-msgs-col {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.inbox-thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.inbox-thread-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f1f1;
  transition: background .12s;
  position: relative;
}
.inbox-thread-item:hover { background: #f8faff; }
.inbox-thread-item.active { background: #eff6ff; }
.inbox-thread-item.unread { background: #f0f9ff; }
.inbox-thread-subject {
  font-weight: 700;
  font-size: .83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-thread-item.unread .inbox-thread-subject { color: var(--primary); }
.inbox-thread-meta {
  font-size: .72rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  margin-top: 2px;
  align-items: center;
}
.inbox-thread-dir {
  font-size: .68rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
}
.inbox-thread-dir.sent { background: #dcfce7; color: #166534; }
.inbox-thread-dir.recv { background: #dbeafe; color: #1e40af; }

/* Col 3 — Detail / Compose */
.inbox-detail-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
#inboxComposeForm {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 0;
  height: 100%;
  box-sizing: border-box;
}
#inboxComposeBody { flex: 1; }
.inbox-message-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.inbox-message-detail-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.inbox-message-detail-subject {
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 6px;
}
.inbox-message-detail-meta {
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.inbox-message-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: .93rem;
}
.inbox-delete-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: .78rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.inbox-delete-btn:hover { background: #fee2e2; }
.inbox-reply-btn {
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  cursor: pointer;
  font-size: .8rem;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 700;
}
.inbox-reply-btn:hover { background: #eff6ff; }

@media (max-width: 700px) {
  .inbox-3col { grid-template-columns: 1fr; height: auto; }
  .inbox-msgs-col, .inbox-detail-col { border-right: none; border-top: 1px solid var(--border); min-height: 280px; }
  .inbox-contacts-col { max-height: 220px; }
}

/* ═══════════════════════════════════
   APPBAR BUTTON HOVER ANIMATIONS
   ═══════════════════════════════════ */
.appbar-actions .btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease !important;
}
.appbar-actions .btn:hover {
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18) !important;
  filter: brightness(1.08) !important;
}
.appbar-actions .btn:active {
  transform: translateY(0px) scale(0.98) !important;
  transition-duration: 0.08s !important;
}

/* ═══════════════════════════════════
   CHAT-STYLE INBOX LAYOUT
   ═══════════════════════════════════ */
.inbox-chat-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  height: calc(100vh - 200px);
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.inbox-chat-col {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  overflow: hidden;
}
.inbox-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8faff;
}
.inbox-chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}
.inbox-chat-bubble-wrap.sent {
  align-self: flex-end;
  align-items: flex-end;
}
.inbox-chat-bubble-wrap.recv {
  align-self: flex-start;
  align-items: flex-start;
}
.inbox-chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: .93rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.inbox-chat-bubble-wrap.sent .inbox-chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.inbox-chat-bubble-wrap.recv .inbox-chat-bubble {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.inbox-chat-meta {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 3px;
  padding: 0 4px;
}
.inbox-chat-subject {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 3px;
  padding: 0 4px;
}
.inbox-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.inbox-chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: .93rem;
  resize: none;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s;
  background: var(--soft);
}
.inbox-chat-input:focus {
  border-color: var(--primary);
  background: #fff;
}
.inbox-chat-send-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: unset !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .inbox-chat-layout { grid-template-columns: 1fr; height: auto; }
  .inbox-chat-col { border-left: none; border-top: 1px solid var(--border); min-height: 400px; }
  .inbox-contacts-col { max-height: 200px; }
}

/* ═══════════════════════════════════
   IMAGE BOXES (fillable overlays)
   ═══════════════════════════════════ */
#questionAssetsContainer {
  margin-top: 14px;
}
#questionAssetsContainer img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.img-box-input {
  position: absolute;
  border: 2px solid #94a3b8;
  border-radius: 4px;
  background: rgba(255,255,255,0.92);
  padding: 2px 6px;
  box-sizing: border-box;
  font-family: var(--font);
  transition: border-color .15s, background .15s, box-shadow .15s;
  z-index: 10;
  font-size: 12px;
}
.img-box-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.22);
}
#nextBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.json-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: var(--soft);
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.json-upload-zone:hover, .json-upload-zone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}
.json-upload-icon { font-size: 1.8rem; margin-bottom: 6px; }
.json-upload-label { font-size: .85rem; color: var(--muted); }
.json-upload-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}
.json-file-info {
  margin-top: 8px;
  padding: 6px 12px;
  background: #dcfce7;
  border-radius: 8px;
  font-size: .82rem;
  color: #166534;
  font-weight: 600;
}


/* ═══════════════════════════════════════════
   UPGRADE: Progress ring (quiz view)
═══════════════════════════════════════════ */
#quizProgressRing {
  transition: opacity .2s;
}

/* ═══════════════════════════════════════════
   UPGRADE: Custom confirm modal
═══════════════════════════════════════════ */
#_confirmYes, #_confirmNo {
  font-size: .97rem;
}

/* ═══════════════════════════════════════════
   HTML Content — Interactive Tables & Diagrams
═══════════════════════════════════════════ */
#questionHtmlContent {
  margin-top: 16px;
  overflow-x: auto;
}
.hc-input {
  border: 2px solid #94a3b8;
  border-radius: 5px;
  background: rgba(255,255,255,0.95);
  padding: 4px 8px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  box-sizing: border-box;
  text-align: center;
}
.hc-input:focus {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}
.hc-input:not(:placeholder-shown) {
  border-color: #16a34a;
  background: #f0fdf4;
}
.hc-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  margin-top: 6px;
}
.hc-table th {
  background: #1e3a5f;
  color: #fff;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  border: 1px solid #1e3a5f;
}
.hc-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 8px;
  text-align: center;
  background: #fff;
}
.hc-table tr:nth-child(even) td {
  background: #f8fafc;
}
.hc-table td.row-label {
  text-align: left;
  font-weight: 600;
  background: #f1f5f9;
  padding-left: 12px;
}
.hc-table td.fill-cell {
  padding: 4px 4px;
}
.hc-table td.fill-cell .hc-input {
  width: 100%;
  min-width: 40px;
}
.hc-wordbank {
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #f8fafc;
  font-size: .9rem;
}

/* ── Exam Library List ───────────────────────────────────── */
.exam-lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 12px;
  flex-wrap: wrap;
  transition: background 0.15s;
}
.exam-lib-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.exam-lib-date {
  font-size: .75rem;
  color: #64748b;
  margin-top: 2px;
}

/* ── Review diagram box overlays ─────────────────────────── */
.review-box-overlay {
  position: absolute;
  background: rgba(255,255,255,0.93);
  border: 2px solid #2563eb;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1e40af;
  z-index: 10;
  box-sizing: border-box;
  padding: 2px 4px;
  text-align: center;
  pointer-events: none;
}

/* ── Admin Stats User Cards ─────────────────────────────── */
.admin-stats-user-card {
  transition: all .15s ease;
}
.admin-stats-user-card:hover {
  border-color: #93c5fd !important;
  box-shadow: 0 3px 16px rgba(37,99,235,.12) !important;
  transform: translateY(-1px);
}
.admin-stats-user-card.selected {
  background: #eff6ff !important;
  border-color: #2563eb !important;
}

/* ── Review Modal ────────────────────────────────────────── */
#reviewModal {
  animation: fadeInModal .2s ease;
}

/* ── Trainee modal blur overlay ──────────────────────────── */
#traineeModal {
  animation: tmFadeIn .22s ease;
}
