/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'DM Sans', system-ui, sans-serif; background: #F3F6FB; color: #374151; }

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
  --navy:    #1A1035;
  --gold:    #C9A84C;
  --purple:  #7C3AED;
  --lpurple: #EDE9FE;
  --blue:    #007AC2;
  --green:   #16A34A;
  --lgreen:  #DCFCE7;
  --orange:  #E05C2A;
  --lorange: #FEF0EA;
  --red:     #DC2626;
  --grey:    #374151;
  --lgrey:   #F9FAFB;
  --mgrey:   #6B7280;
  --white:   #FFFFFF;
  --border:  #E5E7EB;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
#app         { display: flex; flex-direction: column; height: 100vh; }
#layout      { display: flex; flex: 1; overflow: hidden; }
#sidebar     { width: 210px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; padding: 16px 0; transition: width 0.2s; }
#main        { flex: 1; padding: 24px; overflow-y: auto; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
nav {
  background: var(--navy); color: var(--white);
  padding: 0 20px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 14px rgba(0,0,0,0.22); flex-shrink: 0;
}
.nav-brand   { display: flex; align-items: center; gap: 10px; }
.nav-logo    { width: 34px; height: 34px; background: var(--blue); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; }
.nav-title   { font-weight: 800; font-size: 16px; }
.nav-sub     { font-size: 10px; color: #ADC8E6; }
.nav-right   { display: flex; align-items: center; gap: 14px; }
.nav-badge   { position: relative; cursor: pointer; font-size: 20px; }
.notif-dot   { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; background: var(--orange); border-radius: 50%; font-size: 9px; color: var(--white); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.avatar      { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; cursor: pointer; color: var(--white); }
.pwa-dot     { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.pwa-status  { display: flex; align-items: center; font-size: 10px; }

/* ── Role Selector ────────────────────────────────────────────────────────── */
#role-select {
  padding: 5px 10px; border-radius: 6px; border: none;
  background: #2A4A8C; color: var(--white); font-size: 12px;
  cursor: pointer; font-family: inherit;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer; font-size: 13px;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0; margin-right: 10px;
  transition: all 0.15s; color: #5A6A7E;
}
.nav-item:hover  { background: #F0F4FC; }
.nav-item.active { background: #EEF4FF; color: var(--navy); font-weight: 700; border-left-color: var(--blue); }
.nav-item .icon  { font-size: 15px; }
.sidebar-footer  { padding: 0 18px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: auto; }
.sidebar-footer .sf-label  { font-size: 10px; color: #B0C0D8; margin-bottom: 3px; }
.sidebar-footer .sf-name   { font-size: 12px; font-weight: 700; color: #4A5A6E; }
.sidebar-footer .sf-role   { font-size: 11px; color: var(--mgrey); }
.access-badge { display: inline-block; margin-top: 6px; font-size: 10px; background: var(--navy); color: var(--gold); padding: 3px 8px; border-radius: 6px; font-weight: 700; }

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-title { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 3px; }
.page-sub   { font-size: 12px; color: var(--mgrey); margin-bottom: 20px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { background: var(--white); border-radius: 12px; padding: 20px; box-shadow: 0 1px 8px rgba(0,0,0,0.07); border: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 14px; }

/* ── Grid Layouts ─────────────────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }

/* ── KPI Cards ────────────────────────────────────────────────────────────── */
.kpi-card { border-radius: 12px; padding: 18px; box-shadow: 0 1px 8px rgba(0,0,0,0.07); border: 1px solid var(--border); background: var(--white); }
.kpi-label { font-size: 11px; color: var(--mgrey); margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.kpi-sub   { font-size: 11px; color: var(--mgrey); }

/* ── Welcome Bar ──────────────────────────────────────────────────────────── */
.welcome-bar { background: #EEF4FF; border-radius: 10px; padding: 12px 18px; margin-bottom: 22px; display: flex; align-items: center; gap: 12px; border: 1px solid #C5D8F5; }
.welcome-bar .wb-name { font-weight: 700; color: var(--navy); font-size: 14px; }
.welcome-bar .wb-role { font-size: 12px; color: var(--mgrey); }
.role-badge { margin-left: auto; font-size: 11px; background: var(--navy); color: var(--gold); padding: 4px 10px; border-radius: 6px; font-weight: 700; }

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-track { height: 7px; background: #E8EEF8; border-radius: 99px; overflow: hidden; margin-top: 5px; }
.progress-fill  { height: 100%; border-radius: 99px; transition: width 0.6s ease; background: var(--blue); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
button { font-family: inherit; cursor: pointer; border-radius: 8px; font-weight: 700; transition: opacity 0.15s; }
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: var(--white); border: none; padding: 8px 18px; font-size: 13px; }
.btn-outline  { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); padding: 8px 18px; font-size: 13px; }
.btn-ghost    { background: #F0F4FC; color: var(--grey); border: none; padding: 8px 18px; font-size: 13px; }
.btn-gold     { background: var(--gold); color: var(--white); border: none; padding: 8px 18px; font-size: 13px; }
.btn-sm       { padding: 4px 12px; font-size: 11px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
input, textarea, select {
  font-family: inherit; width: 100%; padding: 9px 12px;
  border-radius: 8px; border: 1.5px solid var(--border);
  font-size: 12px; color: var(--grey); outline: none; background: var(--lgrey);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { border-color: var(--blue); }

/* ── NDPR Badge ───────────────────────────────────────────────────────────── */
.ndpr-badge { background: #F0FDF4; border: 1px solid #86EFAC; border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.ndpr-badge .ndpr-title { font-size: 11px; font-weight: 700; color: var(--green); }
.ndpr-badge .ndpr-body  { font-size: 10px; color: var(--mgrey); margin-top: 2px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
table  { width: 100%; border-collapse: collapse; font-size: 13px; }
th     { text-align: left; padding: 8px 12px; color: var(--mgrey); font-weight: 600; font-size: 12px; border-bottom: 2px solid var(--border); }
td     { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.td-bold { font-weight: 600; color: var(--navy); }

/* ── Eval Items ───────────────────────────────────────────────────────────── */
.eval-item { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 10px; cursor: pointer; transition: all 0.15s; }
.eval-item:hover { border-color: var(--blue); }
.eval-item.active { background: #EEF4FF; border-color: #C5D8F5; }
.eval-item .ei-course { font-size: 13px; font-weight: 700; color: var(--navy); }
.eval-item .ei-lect   { font-size: 11px; color: var(--mgrey); margin-top: 2px; }

/* ── Stars ────────────────────────────────────────────────────────────────── */
.stars { display: flex; gap: 6px; margin-bottom: 18px; }
.star  { font-size: 32px; cursor: pointer; color: #E0E8F5; transition: color 0.1s; }
.star.on { color: #F5A623; }

/* ── Tag Pills ────────────────────────────────────────────────────────────── */
.tag-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag { padding: 5px 14px; border-radius: 20px; border: none; cursor: pointer; font-size: 12px; font-weight: 600; font-family: inherit; transition: all 0.15s; }
.tag.active   { background: var(--navy); color: var(--white); }
.tag.inactive { background: #EEF4FF; color: var(--navy); }

/* ── Survey Items ─────────────────────────────────────────────────────────── */
.survey-item { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.survey-item:last-child { border-bottom: none; }
.survey-title { font-size: 13px; font-weight: 600; color: var(--navy); }
.survey-meta  { font-size: 11px; color: var(--mgrey); margin: 3px 0; }

/* ── AI Callout ───────────────────────────────────────────────────────────── */
.ai-callout { border: 1px solid var(--purple); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: #FAFAFF; }
.ai-callout .ai-head { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.ai-callout .ai-body { font-size: 12px; color: var(--grey); line-height: 1.7; }
.ai-callout .ai-footer { font-size: 10px; color: var(--mgrey); font-style: italic; margin-top: 8px; }

/* ── Heatmap ──────────────────────────────────────────────────────────────── */
.heatmap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.heatmap-cell { border-radius: 8px; padding: 10px 8px; text-align: center; }
.heatmap-cell .hc-score { font-size: 16px; font-weight: 800; color: var(--white); }
.heatmap-cell .hc-label { font-size: 9px; color: rgba(255,255,255,0.85); margin-top: 2px; }
.heatmap-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hm-leg { display: flex; align-items: center; gap: 4px; font-size: 9px; color: var(--mgrey); }
.hm-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ── Bar Chart ────────────────────────────────────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 110px; padding-top: 8px; overflow-x: auto; }
.bar-col   { flex: 0 0 auto; min-width: 36px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-score { font-size: 9px; font-weight: 700; color: var(--navy); }
.bar-label { font-size: 8px; color: var(--mgrey); text-align: center; }
.bar-col   { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-score { font-size: 10px; font-weight: 700; color: var(--navy); }
.bar-fill  { width: 100%; border-radius: 4px 4px 0 0; transition: height 0.5s; position: relative; }
.bar-trend { position: absolute; top: -14px; right: 0; font-size: 9px; }
.bar-label { font-size: 9px; color: var(--mgrey); text-align: center; }

/* ── Chat ─────────────────────────────────────────────────────────────────── */
.chat-list { max-height: 240px; overflow-y: auto; margin-bottom: 12px; }
.chat-msg  { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 8px; }
.chat-msg.unread { background: #EEF4FF; border-color: #C5D8F5; }
.chat-msg.mine   { background: #F0F9FF; }
.chat-from { font-size: 12px; font-weight: 700; color: var(--navy); }
.chat-from.mine { color: var(--blue); }
.chat-time { font-size: 11px; color: var(--mgrey); }
.chat-text { font-size: 12px; color: #4A5A6E; margin-top: 3px; }
.chat-input-row { display: flex; gap: 8px; }

/* ── Audit Log ────────────────────────────────────────────────────────────── */
.audit-info { background: #F0F4FC; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: 11px; color: var(--mgrey); }

/* ── NUC Report Box ───────────────────────────────────────────────────────── */
.nuc-box { background: var(--lgrey); border-radius: 8px; padding: 16px; border: 1px solid var(--border); margin-top: 12px; }
.nuc-box-head { font-size: 11px; font-weight: 700; color: var(--purple); margin-bottom: 8px; }
.nuc-body { font-size: 11px; color: var(--grey); line-height: 1.7; white-space: pre-line; }
.nuc-actions { margin-top: 12px; display: flex; gap: 10px; }

/* ── Success State ────────────────────────────────────────────────────────── */
.success-state { text-align: center; padding: 40px 0; }
.success-icon  { font-size: 52px; margin-bottom: 12px; }
.success-title { font-size: 16px; font-weight: 700; color: var(--green); }
.success-sub   { font-size: 12px; color: var(--mgrey); margin-top: 6px; margin-bottom: 16px; }
.success-ndpr  { background: var(--lgreen); border: 1px solid #86EFAC; border-radius: 8px; padding: 8px 14px; font-size: 11px; color: var(--green); font-weight: 700; margin-bottom: 16px; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 50px 0; color: #C0D0E8; }
.empty-icon  { font-size: 44px; margin-bottom: 10px; }
.empty-text  { font-size: 13px; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert-success { background: var(--lgreen); border-radius: 8px; padding: 8px 14px; font-size: 12px; color: var(--green); font-weight: 700; margin-top: 10px; }
.alert-info    { background: #DBEAFE; border-radius: 8px; padding: 8px 14px; font-size: 12px; color: var(--blue); margin-bottom: 14px; }
.generating    { background: var(--lgrey); border-radius: 8px; padding: 16px; text-align: center; }
.generating-title { font-size: 13px; color: var(--purple); font-weight: 600; margin-bottom: 4px; }
.generating-sub   { font-size: 11px; color: var(--mgrey); }

/* ── Notification Item ────────────────────────────────────────────────────── */
.notif-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--grey); }
.notif-item:last-child { border-bottom: none; }

/* ── Shared Docs ──────────────────────────────────────────────────────────── */
.doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc-item:last-child { border-bottom: none; }
.doc-type  { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; }
.doc-meta  { flex: 1; }
.doc-name  { font-size: 12px; font-weight: 600; color: var(--navy); }
.doc-date  { font-size: 11px; color: var(--mgrey); }

/* ── External Badge ───────────────────────────────────────────────────────── */
.ext-notice { background: #F0F4FC; border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; font-size: 11px; color: var(--mgrey); display: flex; gap: 8px; align-items: center; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }