/* ═══════════════════════════════════════════
   TOP ONE LABEL TRAINING SYSTEM — Global Stylesheet
   ═══════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --dark-blue:  #0d1b2a;   /* TOP ONE LABEL midnight navy */
  --mid-blue:   #1a3a6e;   /* rich navy */
  --mid-blue2:  #15305c;   /* medium navy */
  --light-blue: #c8d8f0;   /* soft blue-grey tint */
  --pale-blue:  #f0f4fb;   /* clean off-white blue */
  --gold:       #c8961e;   /* warm amber gold — primary accent */
  --light-gold: #fdf3dc;   /* pale gold background */
  --gray:       #f5f6f8;   /* neutral light grey */
  --mid-gray:   #d1d5db;
  --dark-gray:  #6b7280;
  --text:       #1e293b;
  --white:      #FFFFFF;
  --success:    #0d7a45;
  --success-bg: #ecfdf5;
  --danger:     #b91c1c;
  --danger-bg:  #fef2f2;
  --warning:    #92400e;
  --warning-bg: #fffbeb;

  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 12px rgba(13,27,42,.10);
  --shadow-md:  0 4px 24px rgba(13,27,42,.18);
  --transition: .2s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--gray); min-height: 100vh; line-height: 1.6; }
a { color: var(--mid-blue); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--dark-blue); }
h2 { font-size: 1.3rem; font-weight: 700; color: var(--dark-blue); }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--dark-blue); }
p  { color: var(--dark-gray); line-height: 1.7; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.page { min-height: 100vh; }

/* ── Auth Page ── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #0d1b2a 0%, #15305c 55%, #1a3a6e 80%, #0d1b2a 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-md); width: 100%; max-width: 420px; padding: 2.5rem 2rem;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .logo-mark {
  width: 64px; height: 64px; background: linear-gradient(135deg, #0d1b2a, #1a3a6e);
  border-radius: 14px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(200,150,30,.35);
}
.auth-logo .logo-mark span { color: var(--white); font-size: 1.6rem; font-weight: 800; letter-spacing: -1px; }
.auth-logo h1 { font-size: 1.3rem; margin-bottom: .25rem; }
.auth-logo p  { font-size: .85rem; color: var(--dark-gray); }
.auth-card h2 { font-size: 1.1rem; margin-bottom: 1.5rem; text-align: center; }

/* ── Navbar ── */
.navbar {
  background: linear-gradient(90deg, #0d1b2a 0%, #15305c 100%); color: var(--white);
  padding: .85rem 1rem; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 16px rgba(13,27,42,.35);
  border-bottom: 1px solid rgba(200,150,30,.25);
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.navbar-brand { display: flex; align-items: center; gap: .6rem; }
.navbar-brand .brand-mark {
  width: 36px; height: 36px; background: linear-gradient(135deg, #c8961e, #e8b832);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.navbar-brand .brand-mark span { color: var(--white); font-weight: 800; font-size: .9rem; }
.navbar-brand .brand-name { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.navbar-brand .brand-sub { font-size: .7rem; opacity: .7; }
.navbar-actions { display: flex; align-items: center; gap: .75rem; }
.lang-btn {
  background: rgba(255,255,255,.15); color: var(--white);
  border-radius: 6px; padding: .3rem .75rem; font-size: .8rem; font-weight: 600;
  transition: var(--transition);
}
.lang-btn:hover { background: rgba(255,255,255,.25); }
.user-chip {
  background: rgba(255,255,255,.1); border-radius: 20px;
  padding: .3rem .9rem; font-size: .82rem; display: flex; align-items: center; gap: .4rem;
}
.user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }

/* ── Sidebar + Content Layout ── */
.app-layout { display: flex; min-height: calc(100vh - 58px); }
.sidebar {
  width: 230px; background: var(--white); border-right: 1px solid var(--mid-gray);
  padding: 1.25rem 0; flex-shrink: 0; position: sticky; top: 58px; height: calc(100vh - 58px);
  overflow-y: auto;
}
.sidebar-section { padding: .4rem 1rem .2rem; }
.sidebar-label { font-size: .7rem; font-weight: 700; color: var(--dark-gray); text-transform: uppercase; letter-spacing: .08em; }
.sidebar-nav { padding: .3rem 0; }
.sidebar-nav a, .sidebar-nav button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .6rem 1.2rem; font-size: .88rem; color: var(--dark-gray);
  border-radius: 0; background: none; text-align: left; transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav button:hover { background: var(--pale-blue); color: var(--mid-blue); }
.sidebar-nav a.active, .sidebar-nav button.active {
  background: linear-gradient(90deg, #fdf3dc, #fffbf0); color: #8a6510; font-weight: 600;
  border-left-color: #c8961e;
}
.sidebar-nav .nav-icon { width: 20px; text-align: center; font-size: 1.15rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-nav .nav-badge {
  margin-left: auto; background: var(--danger); color: var(--white);
  border-radius: 10px; padding: .1rem .45rem; font-size: .7rem; font-weight: 700;
}
.main-content { flex: 1; padding: 1.75rem 1.5rem; max-width: 900px; }

/* ── Cards ── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.25rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--dark-blue); display: flex; align-items: center; gap: .5rem; }
.card-subtitle { font-size: .82rem; color: var(--dark-gray); margin-top: .2rem; }

/* ── Stat Cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1rem; text-align: center; border-top: 3px solid #1a3a6e;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.gold { border-top-color: var(--gold); }
.stat-card.success { border-top-color: var(--success); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--dark-blue); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--dark-gray); margin-top: .4rem; }

/* ── Progress ── */
.progress-bar { height: 8px; background: var(--mid-gray); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--mid-blue); border-radius: 4px; transition: width .4s ease; }
.progress-fill.gold { background: var(--gold); }
.progress-fill.success { background: var(--success); }

/* ── Chapter List ── */
.chapter-list { display: flex; flex-direction: column; gap: .75rem; }
.chapter-item {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem;
  border-left: 4px solid var(--mid-gray); transition: var(--transition); cursor: pointer;
}
.chapter-item:hover { border-left-color: var(--mid-blue); box-shadow: var(--shadow-md); transform: translateX(2px); }
.chapter-item.completed { border-left-color: var(--success); }
.chapter-item.locked { opacity: .55; cursor: not-allowed; }
.chapter-num {
  width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #0d1b2a, #1a3a6e);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #e8b832; flex-shrink: 0;
}
.chapter-item.completed .chapter-num { background: var(--success-bg); color: var(--success); }
.chapter-info { flex: 1; min-width: 0; }
.chapter-title { font-weight: 600; font-size: .95rem; color: var(--dark-blue); }
.chapter-meta { font-size: .78rem; color: var(--dark-gray); margin-top: .15rem; }
.chapter-status { font-size: 1.1rem; }

/* ── Content Reader ── */
.reader-header {
  background: linear-gradient(135deg, #0d1b2a, #15305c); color: var(--white);
  padding: 1.25rem 1.5rem; border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: 0;
  border-bottom: 2px solid rgba(200,150,30,.4);
}
.reader-header h2 { color: var(--white); font-size: 1.15rem; }
.reader-header p { color: rgba(255,255,255,.7); font-size: .82rem; margin-top: .25rem; }
.reader-body { background: var(--white); border-radius: 0 0 var(--radius) var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.reader-section { margin-bottom: 1.75rem; }
.reader-section h3 {
  font-size: 1rem; color: var(--mid-blue); margin-bottom: .75rem;
  padding-bottom: .4rem; border-bottom: 2px solid var(--light-blue);
}
.reader-section p { margin-bottom: .6rem; font-size: .9rem; }
.reader-kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; margin-bottom: .5rem; }
.reader-kv dt { font-weight: 600; color: var(--dark-blue); font-size: .88rem; white-space: nowrap; }
.reader-kv dd { font-size: .88rem; color: var(--dark-gray); }
.knowledge-tag {
  display: inline-block; background: var(--pale-blue); color: var(--mid-blue);
  border-radius: 4px; padding: .15rem .55rem; font-size: .78rem; font-weight: 600; margin: .15rem;
}
.info-box {
  background: var(--pale-blue); border-left: 3px solid var(--mid-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .75rem 1rem; margin-bottom: .75rem; font-size: .88rem;
}
.info-box.gold { background: var(--light-gold); border-left-color: var(--gold); }
.info-box.danger { background: var(--danger-bg); border-left-color: var(--danger); }
.info-box strong { display: block; margin-bottom: .2rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: .75rem; }
.data-table th { background: #0d1b2a; color: var(--white); font-weight: 700; padding: .5rem .75rem; text-align: left; }
.data-table td { padding: .45rem .75rem; border-bottom: 1px solid var(--mid-gray); color: var(--dark-gray); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: #FAFAFA; }

/* ── Quiz & Exam ── */
.exam-header { text-align: center; padding: 1.5rem; }
.exam-header h2 { font-size: 1.3rem; color: var(--dark-blue); }
.exam-meta { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-top: .75rem; flex-wrap: wrap; }
.exam-meta span { font-size: .85rem; color: var(--dark-gray); display: flex; align-items: center; gap: .3rem; }
.timer-badge {
  background: linear-gradient(135deg, #0d1b2a, #15305c); color: var(--white);
  border-radius: 20px; padding: .3rem 1rem; font-size: 1rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: .05em;
  border: 1px solid rgba(200,150,30,.3);
}
.timer-badge.warning { background: var(--warning); }
.timer-badge.danger  { background: var(--danger); }

.question-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; margin-bottom: 1rem;
}
.question-num { font-size: .78rem; font-weight: 700; color: var(--mid-blue); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.question-type-badge {
  display: inline-block; font-size: .7rem; font-weight: 700; padding: .15rem .5rem;
  border-radius: 4px; margin-left: .5rem; text-transform: uppercase;
}
.badge-single   { background: #EDE8FF; color: #5B35CC; }
.badge-multiple { background: var(--light-gold); color: #8a6510; }
.badge-boolean  { background: #FFF3CD; color: #856404; }
.question-text { font-size: .95rem; font-weight: 600; color: var(--dark-blue); margin-bottom: 1rem; line-height: 1.5; }
.options-list { display: flex; flex-direction: column; gap: .5rem; }
.option-item {
  display: flex; align-items: flex-start; gap: .75rem; padding: .7rem .9rem;
  border: 2px solid var(--mid-gray); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); font-size: .9rem;
}
.option-item:hover { border-color: var(--mid-blue); background: var(--pale-blue); }
.option-item.selected { border-color: var(--mid-blue); background: var(--pale-blue); }
.option-item.correct  { border-color: var(--success); background: var(--success-bg); }
.option-item.wrong    { border-color: var(--danger);  background: var(--danger-bg);  }
.option-key {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--mid-gray); color: var(--dark-gray);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; margin-top: .05rem;
}
.option-item.selected .option-key { background: var(--mid-blue); color: var(--white); }
.option-item.correct  .option-key { background: var(--success); color: var(--white); }
.option-item.wrong    .option-key { background: var(--danger);  color: var(--white); }
.option-text { flex: 1; line-height: 1.5; }
.explanation-box {
  margin-top: .75rem; padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--light-gold); border-left: 3px solid var(--gold);
  font-size: .85rem; color: var(--dark-gray);
}
.explanation-box strong { color: var(--gold); }

.exam-progress { margin-bottom: 1.25rem; }
.exam-progress-info { display: flex; justify-content: space-between; font-size: .82rem; color: var(--dark-gray); margin-bottom: .4rem; }
.question-nav {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem;
}
.q-dot {
  width: 28px; height: 28px; border-radius: 6px; font-size: .75rem; font-weight: 700;
  background: var(--mid-gray); color: var(--dark-gray); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.q-dot.answered { background: var(--mid-blue); color: var(--white); }
.q-dot.current  { outline: 2px solid var(--dark-blue); outline-offset: 1px; }

/* ── Score Display ── */
.score-display { text-align: center; padding: 2rem 1rem; }
.score-circle {
  width: 130px; height: 130px; border-radius: 50%; margin: 0 auto 1.25rem;
  background: conic-gradient(var(--success) var(--pct,0%), var(--mid-gray) 0%);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.score-circle::before {
  content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--white);
}
.score-num { position: relative; z-index: 1; font-size: 2rem; font-weight: 800; color: var(--dark-blue); line-height: 1; }
.score-num small { font-size: .9rem; font-weight: 400; }
.score-label { font-size: 1.1rem; font-weight: 700; }
.score-label.pass    { color: var(--success); }
.score-label.fail    { color: var(--danger); }
.score-label.great   { color: var(--gold); }
.score-breakdown { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; }
.score-breakdown span { font-size: .85rem; color: var(--dark-gray); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.list-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.list-table th { background: #0d1b2a; color: var(--white); padding: .65rem .9rem; text-align: left; font-weight: 600; letter-spacing: .02em; }
table.list-table td { padding: .6rem .9rem; border-bottom: 1px solid var(--mid-gray); color: var(--dark-gray); }
table.list-table tr:hover td { background: var(--pale-blue); }
table.list-table .badge { padding: .15rem .55rem; border-radius: 4px; font-size: .75rem; font-weight: 700; }
table.list-table .badge-pass { background: var(--success-bg); color: var(--success); }
table.list-table .badge-fail { background: var(--danger-bg); color: var(--danger); }
table.list-table .badge-great { background: var(--light-gold); color: var(--gold); }
table.list-table .badge-pending { background: var(--gray); color: var(--dark-gray); }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--dark-blue); margin-bottom: .4rem; }
.form-input {
  width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--mid-gray);
  border-radius: var(--radius-sm); font-size: .92rem; transition: var(--transition);
  background: var(--white); color: var(--text);
}
.form-input:focus { border-color: #c8961e; outline: none; box-shadow: 0 0 0 3px rgba(200,150,30,.15); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23505050' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.5rem; }
.form-hint { font-size: .78rem; color: var(--dark-gray); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.4rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600;
  transition: var(--transition); cursor: pointer; border: none;
}
.btn-primary   { background: linear-gradient(135deg, #15305c 0%, #1a3a6e 100%); color: var(--white); box-shadow: 0 2px 8px rgba(13,27,42,.25); }
.btn-primary:hover   { background: linear-gradient(135deg, #0d1b2a 0%, #15305c 100%); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(13,27,42,.4); }
.btn-dark      { background: linear-gradient(135deg, #0d1b2a, #15305c); color: var(--white); }
.btn-dark:hover      { background: linear-gradient(135deg, #050d15, #0d1b2a); transform: translateY(-1px); }
.btn-gold      { background: linear-gradient(135deg, #c8961e, #e8b832); color: var(--white); box-shadow: 0 2px 8px rgba(200,150,30,.3); }
.btn-gold:hover      { background: linear-gradient(135deg, #a67a18, #c8961e); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(200,150,30,.45); }
.btn-outline   { background: transparent; color: var(--mid-blue); border: 1.5px solid var(--mid-blue); }
.btn-outline:hover   { background: var(--pale-blue); }
.btn-danger    { background: var(--danger); color: var(--white); }
.btn-danger:hover    { background: #9b2c20; }
.btn-success   { background: var(--success); color: var(--white); }
.btn-success:hover   { background: #155c32; }
.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges & Tags ── */
.tag {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .6rem; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.tag-blue    { background: var(--pale-blue); color: var(--mid-blue); }
.tag-gold    { background: var(--light-gold); color: var(--gold); }
.tag-success { background: var(--success-bg); color: var(--success); }
.tag-danger  { background: var(--danger-bg); color: var(--danger); }
.tag-gray    { background: var(--gray); color: var(--dark-gray); }

/* ── Alerts ── */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1rem; }
.alert-success { background: var(--success-bg); border-left: 3px solid var(--success); color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border-left: 3px solid var(--danger);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-left: 3px solid var(--warning); color: var(--warning); }
.alert-info    { background: var(--pale-blue);  border-left: 3px solid var(--mid-blue); color: var(--mid-blue); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-md);
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: var(--transition);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--mid-gray);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; font-size: 1.3rem; color: var(--dark-gray); padding: .1rem .5rem; border-radius: 4px; }
.modal-close:hover { background: var(--gray); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--mid-gray); display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Admin Tabs ── */
.admin-tabs { display: flex; gap: 0; background: var(--white); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; box-shadow: var(--shadow); }
.admin-tab {
  flex: 1; padding: .85rem .5rem; text-align: center; font-size: .85rem; font-weight: 600;
  color: var(--dark-gray); background: var(--white); border-bottom: 3px solid transparent;
  cursor: pointer; transition: var(--transition);
}
.admin-tab:hover { color: var(--mid-blue); background: var(--pale-blue); }
.admin-tab.active { color: #8a6510; border-bottom-color: #c8961e; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ── Notification Item ── */
.notif-item {
  display: flex; gap: 1rem; padding: .9rem 1rem;
  border-bottom: 1px solid var(--mid-gray); align-items: flex-start;
}
.notif-item:last-child { border-bottom: none; }
.notif-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: .1rem; }
.notif-content { flex: 1; }
.notif-title { font-size: .88rem; font-weight: 600; color: var(--dark-blue); }
.notif-meta  { font-size: .78rem; color: var(--dark-gray); margin-top: .15rem; }
.notif-item.unread { background: var(--pale-blue); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--dark-gray); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Divider ── */
.divider { height: 1px; background: var(--mid-gray); margin: 1.25rem 0; }
.divider-text { display: flex; align-items: center; gap: .75rem; color: var(--dark-gray); font-size: .8rem; margin: 1rem 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--mid-gray); }

/* ── Loader ── */
.loader { display: flex; align-items: center; justify-content: center; padding: 3rem; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--mid-gray);
  border-top-color: var(--mid-blue); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile Hamburger ── */
.hamburger { display: none; background: none; color: var(--white); font-size: 1.4rem; padding: .25rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; }
.sidebar-overlay.show { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .app-layout { flex-direction: column; }
  .sidebar {
    position: fixed; left: -240px; top: 58px; width: 230px; height: calc(100vh - 58px);
    z-index: 95; transition: left .25s ease; box-shadow: var(--shadow-md);
  }
  .sidebar.open { left: 0; }
  .main-content { padding: 1.25rem 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .admin-tab { font-size: .75rem; padding: .75rem .3rem; }
  .exam-meta { gap: .75rem; }
  .modal { max-width: 100%; }
  h1 { font-size: 1.4rem; }
  .navbar-brand .brand-sub { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .score-breakdown { flex-direction: column; align-items: center; gap: .4rem; }
  .auth-card { padding: 2rem 1.25rem; }
}

/* ── Utilities ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-blue   { color: var(--mid-blue); }
.text-gold   { color: var(--gold); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-gray   { color: var(--dark-gray); }
.text-sm     { font-size: .82rem; }
.text-xs     { font-size: .72rem; }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-1       { gap: .5rem; }
.gap-2       { gap: 1rem; }
.justify-between { justify-content: space-between; }
.flex-1      { flex: 1; }
.hidden      { display: none !important; }

/* ══════════════════════════════════════════════
   KNOWLEDGE CONTENT — Rich HTML Styles
   ══════════════════════════════════════════════ */

/* Reader body renders HTML */
.reader-body { line-height: 1.7; color: var(--text); }
.reader-body p { margin: 0 0 .75rem; }

/* Intro block */
.kc-intro {
  background: var(--pale-blue);
  border-left: 4px solid var(--mid-blue);
  padding: .75rem 1rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.25rem;
  font-size: .95rem;
}

/* Tables */
.kc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin-bottom: 1.25rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.kc-table th {
  background: var(--dark-blue);
  color: #fff;
  padding: .55rem .85rem;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
}
.kc-table td {
  padding: .5rem .85rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.kc-table tbody tr:last-child td { border-bottom: none; }
.kc-table tbody tr:hover { background: var(--pale-blue); }
.kc-label {
  font-weight: 600;
  color: var(--dark-blue);
  white-space: nowrap;
  min-width: 110px;
}

/* Badges */
.kc-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4;
}
.kc-badge-red    { background: #FEE2E2; color: #B91C1C; }
.kc-badge-orange { background: #FEF3C7; color: #92400E; }
.kc-badge-gray   { background: #F3F4F6; color: #6B7280; }
.kc-badge-green  { background: #D1FAE5; color: #065F46; }

/* Tip & Warning boxes */
.kc-tip {
  background: #FEF9C3;
  border: 1px solid #FDE047;
  border-radius: 8px;
  padding: .65rem 1rem;
  font-size: .86rem;
  margin: .75rem 0 1.25rem;
  line-height: 1.6;
}
.kc-warning {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: .65rem 1rem;
  font-size: .86rem;
  margin: .75rem 0 1.25rem;
  color: #991B1B;
  line-height: 1.6;
}

/* Card row (3-col advantages) */
.kc-card-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .875rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 600px) { .kc-card-row { grid-template-columns: 1fr; } }
.kc-card {
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
}
.kc-card-orange { background: var(--mid-blue); color: #fff; }
.kc-card-dark   { background: var(--dark-blue); color: #fff; }
.kc-card-num    { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.kc-card-title  { font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }
.kc-card-desc   { font-size: .8rem; opacity: .85; }

/* Highlight row (2-col highlights) */
.kc-highlight-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 540px) { .kc-highlight-row { grid-template-columns: 1fr; } }
.kc-highlight {
  background: var(--pale-blue);
  border-radius: 10px;
  padding: 1rem;
  font-size: .88rem;
  line-height: 1.6;
}
.kc-hi-icon { font-size: 1.4rem; display: block; margin-bottom: .35rem; }

/* Steps */
.kc-steps { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.25rem; }
.kc-step {
  display: flex;
  gap: .875rem;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: .875rem 1rem;
}
.kc-step:hover { border-color: var(--mid-blue); background: var(--pale-blue); }
.kc-step-num {
  background: var(--mid-blue);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kc-step-title { font-weight: 700; font-size: .93rem; margin-bottom: .2rem; }
.kc-step-desc  { font-size: .84rem; color: #555; }

/* Process grid */
.kc-process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.kc-process-item {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: .875rem;
  text-align: center;
}
.kc-process-item:hover { border-color: var(--mid-blue); box-shadow: 0 2px 8px rgba(232,96,60,.15); }
.kc-process-name { font-weight: 700; font-size: .92rem; color: var(--dark-blue); margin-bottom: .15rem; }
.kc-process-en   { font-size: .75rem; color: var(--mid-blue); margin-bottom: .4rem; }
.kc-process-desc { font-size: .78rem; color: #666; line-height: 1.5; }

/* Two-column layout */
.kc-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .875rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 560px) { .kc-two-col { grid-template-columns: 1fr; } }
.kc-col {
  border-radius: 10px;
  padding: 1rem;
  font-size: .87rem;
  line-height: 1.6;
}
.kc-col-a { background: #FEF3EF; border: 1px solid #FDDDD5; }
.kc-col-b { background: #F0F4FF; border: 1px solid #DBEAFE; }
.kc-col-header { font-weight: 700; font-size: .92rem; margin-bottom: .5rem; color: var(--dark-blue); }
.kc-col-note   { margin-top: .6rem; font-size: .8rem; color: #555; }
.kc-struct-list { margin: 0; padding-left: 1.25rem; }
.kc-struct-list li { margin-bottom: .2rem; }

/* Image grid */
.kc-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.25rem;
}
.kc-img-grid figure {
  margin: 0;
  text-align: center;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: .5rem;
  transition: box-shadow .2s;
}
.kc-img-grid figure:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.kc-img-grid img {
  width: 100%;
  height: 100px;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}
.kc-img-grid figcaption {
  font-size: .72rem;
  color: #555;
  margin-top: .4rem;
  line-height: 1.3;
}

/* Image row (new V3 layout) */
.kc-img-row { display: flex; gap: .6rem; margin: .75rem 0; flex-wrap: wrap; }
.kc-img-cell { flex: 1; min-width: 90px; max-width: 33%; }
.kc-img-wrap { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; text-align: center; }
.kc-img { width: 100%; max-height: 160px; object-fit: contain; display: block; cursor: zoom-in; transition: transform .2s; }
.kc-img:hover { transform: scale(1.03); }
.kc-img-caption { font-size: .68rem; color: #666; padding: .3rem .4rem; margin: 0; }

/* A/B structure comparison */
.kc-ab-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.kc-ab-box { border-radius: 12px; padding: 1rem 1.2rem; }
.kc-ab-a { background: linear-gradient(135deg,#fff8f0,#ffeedd); border: 2px solid #E8603C; }
.kc-ab-b { background: linear-gradient(135deg,#f0f4ff,#e0e8ff); border: 2px solid #4a6fa5; }
.kc-ab-title { font-weight: 700; font-size: 1rem; margin-bottom: .25rem; }
.kc-ab-a .kc-ab-title { color: #E8603C; }
.kc-ab-b .kc-ab-title { color: #4a6fa5; }
.kc-ab-subtitle { font-size: .78rem; color: #888; margin-bottom: .75rem; }
.kc-ab-list { margin: 0 0 .75rem; padding-left: 1.2rem; font-size: .88rem; line-height: 2; }
.kc-ab-note { font-size: .78rem; color: #555; background: rgba(255,255,255,.6); border-radius: 6px; padding: .5rem .7rem; }

/* Highlight / warning box */
.kc-highlight-box { background: #fff3cd; border-left: 4px solid #E8603C; border-radius: 6px; padding: .75rem 1rem; font-size: .88rem; color: #5a3200; margin: .75rem 0; }

/* Step highlight */
.kc-step-highlight { border-left: 3px solid #E8603C !important; background: #fff8f5 !important; }

@media (max-width: 480px) {
  .kc-ab-wrap { grid-template-columns: 1fr; }
  .kc-img-cell { max-width: 48%; }
}

/* Quote box */
.kc-quote {
  background: var(--pale-blue);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-size: .92rem;
  line-height: 1.7;
  margin-bottom: .5rem;
}
.kc-quote-label {
  font-weight: 700;
  font-size: .8rem;
  color: var(--mid-blue);
  margin-bottom: .4rem;
}

/* code inline */
.reader-body code {
  background: #F3F4F6;
  border-radius: 4px;
  padding: .1em .4em;
  font-size: .85em;
  font-family: monospace;
}

/* ══════════════════════════════════════════════
   WYSIWYG VISUAL EDITOR
   ══════════════════════════════════════════════ */

/* Toolbar */
.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem;
  padding: .35rem .5rem;
  background: #F8F9FA;
  border: 1px solid var(--mid-gray);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.wt-group { display: flex; gap: .15rem; align-items: center; }
.wt-sep { width: 1px; height: 18px; background: var(--mid-gray); margin: 0 .2rem; }
.wt-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: .2rem .4rem;
  font-size: .78rem;
  cursor: pointer;
  line-height: 1;
  color: var(--text);
  display: inline-flex; align-items: center; gap: .2rem;
  white-space: nowrap;
}
.wt-btn:hover { background: #E5E7EB; border-color: var(--mid-gray); }
.wt-btn-icon { font-size: .75rem; }

/* Mode toggle buttons */
.wt-mode-btn {
  border: 1px solid var(--mid-gray);
  background: #fff;
  border-radius: 4px;
  padding: .15rem .45rem;
  font-size: .72rem;
  cursor: pointer;
  color: var(--dark-gray);
  display: inline-flex; align-items: center; gap: .2rem;
}
.wt-mode-btn:hover { background: var(--pale-blue); border-color: var(--mid-blue); color: var(--mid-blue); }
.wt-mode-btn.active-tab {
  background: var(--mid-blue);
  color: #fff;
  border-color: var(--mid-blue);
}

/* Visual editor area */
.wysiwyg-editor {
  min-height: 160px;
  border: 1px solid var(--mid-gray);
  border-radius: 0 0 6px 6px;
  padding: .75rem;
  background: #fff;
  outline: none;
  font-size: .88rem;
  line-height: 1.7;
  cursor: text;
  overflow-y: auto;
}
.wysiwyg-editor:focus {
  border-color: var(--mid-blue);
  box-shadow: 0 0 0 2px rgba(232,96,60,.15);
}
.wysiwyg-editor[contenteditable="false"] {
  cursor: default;
  background: #FAFAFA;
}

/* Table editing in WYSIWYG */
.wysiwyg-editor table { width: 100%; border-collapse: collapse; margin: .5rem 0; }
.wysiwyg-editor td, .wysiwyg-editor th {
  border: 1px solid #CBD5E1;
  padding: .4rem .6rem;
  min-width: 60px;
  vertical-align: top;
}
.wysiwyg-editor th { background: #F1F5F9; font-weight: 600; }
.wysiwyg-editor td:focus, .wysiwyg-editor th:focus { outline: 2px solid var(--mid-blue); }

/* Apply kc-* styles inside editor for live preview */
.wysiwyg-editor .kc-intro { background: var(--pale-blue); border-left: 4px solid var(--mid-blue); padding: .5rem .75rem; border-radius: 0 6px 6px 0; margin: .4rem 0; font-size: .88rem; }
.wysiwyg-editor .kc-tip { background: #FEF9C3; border: 1px solid #FDE047; border-radius: 6px; padding: .5rem .75rem; margin: .4rem 0; font-size: .85rem; }
.wysiwyg-editor .kc-warning { background: #FEF2F2; border: 1px solid #FECACA; border-radius: 6px; padding: .5rem .75rem; margin: .4rem 0; font-size: .85rem; color: #991B1B; }
.wysiwyg-editor img { max-width: 160px; height: auto; border-radius: 6px; border: 1px solid #eee; vertical-align: middle; }
.wysiwyg-editor figure { display: inline-block; text-align: center; margin: .25rem; vertical-align: top; }
.wysiwyg-editor figcaption { font-size: .72rem; color: #666; margin-top: .2rem; }


/* ── TOP ONE LABEL Extra Enhancements ── */

/* Score circle — gold gradient arc */
.score-circle {
  background: conic-gradient(#c8961e var(--pct,0%), var(--mid-gray) 0%) !important;
}

/* Progress fill — navy→gold gradient */
.progress-fill {
  background: linear-gradient(90deg, #0d1b2a, #1a3a6e, #c8961e) !important;
}

/* Q-dot answered — navy */
.q-dot.answered {
  background: linear-gradient(135deg, #0d1b2a, #1a3a6e) !important;
}

/* Option selected key — navy */
.option-item.selected .option-key {
  background: linear-gradient(135deg, #0d1b2a, #1a3a6e) !important;
}

/* Chapter item hover: gold left border */
.chapter-item:hover {
  border-left-color: #c8961e !important;
  box-shadow: 0 4px 20px rgba(200,150,30,.15) !important;
}

/* Card hover lift */
.card {
  transition: box-shadow .2s ease !important;
}

/* Login card — deeper shadow */
.auth-card {
  box-shadow: 0 8px 48px rgba(13,27,42,.35) !important;
  border: 1px solid rgba(200,150,30,.15);
}

/* Btn outline: navy border */
.btn-outline {
  border-color: #1a3a6e !important;
  color: #1a3a6e !important;
}
.btn-outline:hover {
  background: var(--pale-blue) !important;
  transform: translateY(-1px);
}

/* Nav badge: gold */
.sidebar-nav .nav-badge {
  background: linear-gradient(135deg, #c8961e, #e8b832) !important;
  color: #fff !important;
}

/* Scrollbar — subtle gold tint */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f5f6f8; }
::-webkit-scrollbar-thumb { background: #c8d8f0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #c8961e; }

/* form focus — gold ring */
.form-input:focus {
  border-color: #c8961e !important;
  box-shadow: 0 0 0 3px rgba(200,150,30,.15) !important;
}

/* WYSIWYG active tab — gold */
.wt-mode-btn.active-tab {
  background: #c8961e !important;
  border-color: #c8961e !important;
}

/* kc-table th — midnight navy */
.kc-table th {
  background: #0d1b2a !important;
}
