/* =====================================================================
   MASTERHIVE — Light Theme · nền trắng, chữ đen, điểm nhấn mật ong
   ===================================================================== */
:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --surface-2: #FFFBF0;
  --text: #1C1917;
  --text-2: #44403C;
  --muted: #78716C;
  --border: #E7E5E4;
  --border-2: #F1EFEC;

  --honey: #F59E0B;
  --honey-600: #D97706;
  --honey-700: #B45309;
  --honey-50: #FFFBEB;
  --honey-100: #FEF3C7;
  --honey-200: #FDE68A;

  --green: #16A34A;  --green-50: #F0FDF4;  --green-100: #DCFCE7;
  --yellow: #EAB308; --yellow-bg: #E3A008;
  --red: #DC2626;    --red-50: #FEF2F2;    --red-100: #FEE2E2;
  --gray-100: #F5F5F4;

  --marina: #7C3AED; --marina-50: #F5F3FF;
  --oasis: #0E7490;  --oasis-50: #ECFEFF;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .05);
  --shadow: 0 1px 3px rgba(28, 25, 23, .06), 0 6px 18px rgba(28, 25, 23, .05);
  --shadow-lg: 0 20px 50px rgba(28, 25, 23, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); font-weight: 600; }
.text-green { color: var(--green); font-weight: 600; }

/* ---------- Banner bản mẫu ---------- */
.proto-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 7px 24px; font-size: 12.5px;
  background: repeating-linear-gradient(-45deg, var(--honey-100), var(--honey-100) 12px, var(--honey-50) 12px, var(--honey-50) 24px);
  border-bottom: 1px solid var(--honey-200); color: var(--honey-700);
}
.role-switch { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.role-switch select { border: 1px solid var(--honey-200); background: #fff; border-radius: 8px; padding: 3px 8px; font-weight: 600; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px; padding: 12px 24px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.brand-logo { width: 42px; height: 42px; display: grid; place-items: center; background: var(--honey-50); border: 1px solid var(--honey-100); border-radius: 12px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.3px; }
.brand-name span { color: var(--honey-600); }
.brand-sub { font-size: 12px; color: var(--muted); }

.filters { display: flex; gap: 8px; }
.select-pill {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  transition: border-color .2s, box-shadow .2s;
}
.select-pill:hover { border-color: var(--honey-200); }
.select-pill:focus-within { border-color: var(--honey); box-shadow: 0 0 0 3px var(--honey-100); }
.select-pill span { font-size: 12px; color: var(--muted); font-weight: 500; }
.select-pill select { border: 0; background: transparent; font-weight: 600; padding: 4px 4px; outline: none; }
.select-pill select:disabled { color: var(--text); opacity: 1; cursor: not-allowed; }
.select-pill.locked { background: var(--gray-100); }

.search {
  flex: 1; display: flex; align-items: center; gap: 8px; max-width: 460px; margin-left: auto;
  padding: 0 14px; height: 40px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--honey); box-shadow: 0 0 0 3px var(--honey-100); }
.search input { flex: 1; border: 0; outline: none; background: transparent; color: var(--text); }

.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--honey-200), var(--honey)); color: var(--text); font-weight: 700; font-size: 13px;
}
.avatar.lg { width: 56px; height: 56px; font-size: 19px; border-radius: 16px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tab {
  position: relative; border: 0; background: none; padding: 12px 14px; font-weight: 600; color: var(--muted);
  transition: color .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--honey); }
.tab-count:not(:empty) { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; }

.container { padding: 20px 24px 60px; max-width: 1560px; margin: 0 auto; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
  animation: rise .45s var(--ease) both;
}
.kpi:nth-child(2) { animation-delay: .04s; } .kpi:nth-child(3) { animation-delay: .08s; }
.kpi:nth-child(4) { animation-delay: .12s; } .kpi:nth-child(5) { animation-delay: .16s; }
button.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--honey-200); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -.6px; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.kpi-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--honey); }
.kpi.warn .kpi-accent { background: var(--red); }
.kpi.warn .kpi-value { color: var(--red); }
.kpi.info .kpi-accent { background: var(--marina); }
.kpi-hint { position: absolute; right: 12px; top: 12px; font-size: 11px; color: var(--honey-700); font-weight: 600; opacity: 0; transition: opacity .2s; }
button.kpi:hover .kpi-hint { opacity: 1; }

/* ---------- Card / toolbar / table ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-2); flex-wrap: wrap; }
.toolbar h2 { font-size: 15px; margin: 0 8px 0 2px; }
.toolbar .spacer { flex: 1; }
.count { color: var(--muted); font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; white-space: nowrap;
}
.btn:hover { background: var(--gray-100); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--honey); border-color: var(--honey); color: var(--text); }
.btn-primary:hover { background: var(--honey-600); border-color: var(--honey-600); box-shadow: 0 4px 12px rgba(245, 158, 11, .35); }
.btn-dark { background: var(--text); border-color: var(--text); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-danger-text { color: var(--red); }
.btn-outline-green { border: 2px solid var(--green); color: var(--green); background: #fff; }
.btn-outline-green:hover { background: var(--green-50); }
.btn-outline-yellow { border: 2px solid var(--yellow); color: #A16207; background: #fff; }
.btn-outline-yellow:hover { background: #FEFCE8; }
.btn-outline-red { border: 2px solid var(--red); color: var(--red); background: #fff; }
.btn-outline-red:hover { background: var(--red-50); }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-2); transition: background .15s, border-color .15s; }
.icon-btn:hover { background: var(--gray-100); border-color: var(--border); }

.btn-icon-action {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.btn-icon-action svg {
  pointer-events: none;
}
.btn-icon-action:hover {
  background: var(--gray-100);
  border-color: var(--border-2);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.btn-icon-action:active {
  transform: translateY(0) scale(0.96);
}
.btn-icon-action.primary {
  background: var(--honey-50);
  border-color: #FDE68A;
  color: #92400E;
}
.btn-icon-action.primary:hover {
  background: var(--honey);
  border-color: var(--honey-600);
  color: var(--text);
  box-shadow: 0 3px 8px rgba(245, 158, 11, .25);
}
.btn-icon-action.danger {
  color: var(--muted);
}
.btn-icon-action.danger:hover {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #DC2626;
  box-shadow: 0 3px 8px rgba(220, 38, 38, .18);
}
.btn-danger-text {
  color: #DC2626 !important;
}
.btn-danger-text:hover {
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
}

.chip-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; font-size: 12.5px; background: #fff; user-select: none; cursor: pointer; transition: all .15s; }
.chip-toggle input { accent-color: var(--honey-600); margin: 0; }
.chip-toggle:has(input:checked) { background: var(--honey-50); border-color: var(--honey); color: var(--honey-700); }
.mini-select { height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: #fff; font-weight: 500; }

/* Multiselect Popover */
.multiselect-wrap { position: relative; display: inline-block; }
.multiselect-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: #fff; font-size: 13px; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 10px; height: 32px; font-weight: 500;
  transition: border-color .15s, background .15s; user-select: none;
}
.multiselect-btn:hover { border-color: var(--honey-600); }
.multiselect-btn .arrow { font-size: 10px; color: var(--muted); }
.multiselect-popover {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 200px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 8px; z-index: 100;
}
.multiselect-popover-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border-2);
  font-size: 11.5px;
}
.multiselect-popover-head button {
  background: none; border: none; padding: 0; color: var(--honey-700);
  font-weight: 600; cursor: pointer; text-decoration: underline; font-size: 11.5px;
}
.multiselect-popover-head button:hover { color: var(--honey-800); }
.multiselect-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; user-select: none; font-size: 13px;
  transition: background .12s;
}
.multiselect-item:hover { background: var(--gray-100); }
.multiselect-item input[type="checkbox"] {
  accent-color: var(--honey-600); margin: 0; width: 15px; height: 15px; cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 290px);
  position: relative;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
}
table.data { width: 100%; min-width: 960px; border-collapse: separate; border-spacing: 0; }
table.data th {
  position: sticky; top: 0; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none;
  background: #FCFBF9; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 2;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; white-space: nowrap; }
table.data tbody tr { transition: background .15s; cursor: pointer; }
table.data tbody tr:hover { background: var(--honey-50); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.actions { text-align: right; width: 1%; white-space: nowrap; padding-right: 14px; }
.cell-name b { display: block; font-weight: 600; }
.cell-name small { color: var(--muted); font-size: 12px; }
.new-dot { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--green-100); color: var(--green); font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

.mini-table-wrap { overflow-x: auto; margin-top: 8px; border: 1px solid var(--border-2); border-radius: 10px; background: #fff; }
.mini-table-wrap table.mini { min-width: 640px; }
.search-results-box { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 6px; background: #fff; box-shadow: var(--shadow); }
.search-result-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.search-result-item:hover { background: var(--honey-50); }
.search-result-item:last-child { border-bottom: 0; }
.selected-target-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1.5px solid var(--honey); background: var(--honey-50); border-radius: 12px; margin-top: 8px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-green { background: var(--green-50); color: var(--green); border-color: var(--green-100); }
.badge-amber { background: var(--honey-50); color: var(--honey-700); border-color: var(--honey-100); }
.badge-red { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.badge-gray { background: var(--gray-100); color: var(--muted); border-color: var(--border); }
.campus-marina { background: var(--marina-50); color: var(--marina); border-color: #E9E3FF; }
.campus-oasis { background: var(--oasis-50); color: var(--oasis); border-color: #CFF6FA; }
.program-bee { background: var(--honey-100); color: var(--honey-700); }
.program-buttercup { background: #FEF9C3; color: #A16207; }
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 11.5px; letter-spacing: .3px; text-shadow: 0 1px 1px rgba(0,0,0,.18); }
.tag-GREEN { background: var(--green); }
.tag-YELLOW { background: var(--yellow-bg); }
.tag-RED { background: var(--red); }
.inv-yes { background: var(--green-50); color: var(--green); border-color: var(--green-100); }
.inv-no { background: #FFF7ED; color: #C2410C; border-color: #FFEDD5; }

/* ---------- Drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(28, 25, 23, .28); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(92vw, 1600px);
  z-index: 41;
  background: var(--bg);
  box-shadow: -10px 0 40px rgba(0, 0, 0, .2);
  border-left: 1px solid var(--border);
  transform: translateX(105%);
  transition: transform .32s var(--ease), width .2s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer.fullscreen {
  width: 100vw !important;
  max-width: 100vw !important;
  border-left: none;
}
@media (max-width: 768px) {
  .drawer { width: 100vw !important; }
}
.dr-head { padding: 18px 22px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dr-top { display: flex; gap: 14px; align-items: flex-start; }
.dr-title { flex: 1; min-width: 0; }
.dr-title h2 { margin: 0; font-size: 20px; letter-spacing: -.4px; }
.dr-title .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.legacy { font-size: 11.5px; color: var(--muted); background: var(--gray-100); border-radius: 6px; padding: 1px 6px; }
.dr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fin-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 14px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fin-strip div { background: var(--surface); padding: 9px 12px; }
.fin-strip small { display: block; color: var(--muted); font-size: 11.5px; }
.fin-strip b { font-size: 15px; }
.dr-tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dr-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; animation: rise .35s var(--ease) both; }
.section h3 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.section h3 .spacer { flex: 1; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.info-grid div small { display: block; color: var(--muted); font-size: 11.5px; }
.info-grid div span { font-weight: 500; }
.alert-note { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--red-50); color: var(--red); font-weight: 600; font-size: 13px; }
.sib { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 10px; margin-top: 6px; }
.sib.link { cursor: pointer; transition: background .15s, border-color .15s; }
.sib.link:hover { background: var(--honey-50); border-color: var(--honey-200); }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 8px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.tl-item::before { content: ''; position: absolute; left: -18px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--border); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.tl-item.active::before { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.tl-item.active { border-color: var(--green-100); background: var(--green-50); }
.tl-item .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.formula { font-size: 12px; color: var(--muted); margin-top: 2px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.mini td { padding: 8px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
table.mini tr:last-child td { border-bottom: 0; }
table.mini tfoot td { font-weight: 700; border-top: 1px solid var(--border); }
.alloc-list { font-size: 11.5px; color: var(--muted); }
.select-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px;
  background: var(--text); color: #fff; border-radius: 12px; animation: rise .25s var(--ease);
}
.select-bar .spacer { flex: 1; }
.audit-item { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.audit-item:last-child { border-bottom: 0; }
.audit-item b { display: block; }
.locked-note { font-size: 12px; color: var(--muted); background: var(--gray-100); border-radius: 8px; padding: 6px 10px; }

/* ---------- Modal (Mặc định Toàn màn hình 100vw x 100vh để rộng rãi, dễ quan sát) ---------- */
#modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(28, 25, 23, .45);
  display: flex; justify-content: center; align-items: stretch;
  padding: 0;
  overflow: hidden;
  animation: fade .18s;
}
.modal {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 !important;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  animation: fade .2s var(--ease);
}
.modal-wide {
  width: 100vw !important;
  max-width: 100vw !important;
}
/* Chế độ thu nhỏ (Compact) nếu người dùng bấm nút Thu nhỏ trên thanh tiêu đề */
.modal-backdrop:has(.modal.compact) {
  align-items: flex-start;
  padding: 24px 20px;
  overflow-y: auto;
}
.modal.compact {
  width: min(920px, 95vw) !important;
  max-width: min(920px, 95vw) !important;
  height: auto !important;
  max-height: 92vh !important;
  margin: auto !important;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.modal. modal-wide.compact, .modal.modal-email.compact {
  width: min(1240px, 96vw) !important;
  max-width: min(1240px, 96vw) !important;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.modal-head.tone-YELLOW, .modal-head.tone-RED, .modal-head.tone-GREEN { color: #fff; border-bottom: 0; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.modal-head.tone-YELLOW { background: var(--yellow-bg); }

/* ---------- Custom Class Picker (Chống tràn màn hình & chọn lớp trực quan) ---------- */
.custom-class-picker { position: relative; width: 100%; }
.picker-trigger {
  min-height: 42px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: border-color .15s, box-shadow .15s; user-select: none;
}
.picker-trigger:hover, .picker-trigger:focus, .picker-trigger.open {
  border-color: var(--honey); box-shadow: 0 0 0 3px var(--honey-100);
}
.picker-selected-text { font-size: 13px; color: var(--text); line-height: 1.35; flex: 1; text-align: left; }
.picker-selected-text.placeholder { color: var(--muted); font-style: italic; }
.picker-arrow { color: var(--muted); font-size: 11px; transition: transform .2s; }
.picker-trigger.open .picker-arrow { transform: rotate(180deg); }

.picker-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14); z-index: 99;
  display: flex; flex-direction: column; overflow: hidden; animation: pop .18s var(--ease);
}
.picker-search-bar { padding: 8px 10px; border-bottom: 1px solid var(--border-2); background: #FAF9F6; }
.picker-search-bar input {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 12.5px; background: #fff; outline: none;
}
.picker-search-bar input:focus { border-color: var(--honey); }
.picker-filters {
  display: flex; gap: 4px; padding: 6px 10px; background: #fff;
  border-bottom: 1px solid var(--border-2); overflow-x: auto;
}
.picker-filter-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 600; color: var(--muted);
  cursor: pointer; white-space: nowrap; transition: all .12s;
}
.picker-filter-btn:hover { border-color: var(--honey); color: var(--text); }
.picker-filter-btn.active { background: var(--honey-100); border-color: var(--honey-400); color: var(--honey-900); }

.picker-options-list { max-height: 260px; overflow-y: auto; padding: 4px 6px; }
.picker-group-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); padding: 6px 8px 3px; letter-spacing: .4px;
}
.picker-option {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; transition: background .12s; border-bottom: 1px solid #f8f8f8;
}
.picker-option:hover { background: var(--honey-50); }
.picker-option.selected { background: var(--honey-100); font-weight: 600; }
.picker-footer {
  padding: 6px 12px 8px; border-top: 1px solid var(--border-2);
  background: #FCFBF9; text-align: center; font-size: 11.5px; color: var(--muted);
}
.modal-head.tone-RED { background: var(--red); }
.modal-head.tone-GREEN { background: var(--green); }
.modal-head[class*="tone-"] .icon-btn { color: #fff; }
.modal-head[class*="tone-"] .icon-btn:hover { background: rgba(255,255,255,.18); border-color: transparent; }
.modal-body {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 14px 32px;
  border-top: 1px solid var(--border);
  background: #FCFBF9;
  flex-shrink: 0;
}
.modal-foot .left { margin-right: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: 70px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--honey); box-shadow: 0 0 0 3px var(--honey-100); }
.field input:disabled { background: var(--gray-100); color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .err { font-size: 11.5px; color: var(--red); font-weight: 600; }
.span-2 { grid-column: span 2; }
.money-input { position: relative; }
.money-input input { width: 100%; height: 52px; font-size: 24px; font-weight: 800; padding-right: 40px; letter-spacing: -.5px; }
.money-input em { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 700; color: var(--muted); font-size: 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; transition: all .15s; }
.chip:hover { border-color: var(--honey); background: var(--honey-50); }
.seg { display: flex; padding: 3px; background: var(--gray-100); border-radius: 10px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; font-weight: 600; color: var(--muted); transition: all .15s; }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.alloc-box { margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.alloc-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--honey-50); border-bottom: 1px solid var(--honey-100); font-size: 13px; }
.alloc-head label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.alloc-head input { accent-color: var(--honey-600); }
.alloc-body { padding: 6px 12px 10px; }
.alloc-body input { width: 120px; height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; text-align: right; font-weight: 600; }
.alloc-summary { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--gray-100); font-size: 12.5px; }
.alloc-summary.credit { background: var(--green-50); color: var(--green); font-weight: 600; }
.alloc-summary.error { background: var(--red-50); color: var(--red); font-weight: 600; }
.pay-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--honey-100); }
.pay-head .grow { flex: 1; }
.warn-box { padding: 10px 12px; border-radius: 10px; background: #FFF7ED; color: #9A3412; font-size: 12.5px; margin-bottom: 12px; border: 1px solid #FFEDD5; }

/* Resolver */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.cmp-card h4 { margin: 0 0 10px; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.cmp-row { display: grid; grid-template-columns: 105px 1fr; gap: 6px; padding: 4px 0; font-size: 13px; }
.cmp-row small { color: var(--muted); }
mark { background: var(--honey-200); padding: 0 3px; border-radius: 4px; }
mark.red { background: var(--red-100); color: var(--red); }
.reason { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: var(--gray-100); font-size: 13px; }
.choice-help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.choice-help div { padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--border); }
.choice-help b { color: var(--text); display: block; font-size: 12.5px; }
.suggest { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: currentColor; }
.suggest span { color: #fff; }

/* Inbox */
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; padding: 14px; }
.inbox-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; transition: transform .2s var(--ease), box-shadow .2s; animation: rise .35s var(--ease) both; }
.inbox-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.inbox-card.YELLOW { border-left: 4px solid var(--yellow-bg); }
.inbox-card.RED { border-left: 4px solid var(--red); }
.inbox-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inbox-card h4 { margin: 0; font-size: 15px; }
.section-title { display: flex; align-items: center; gap: 8px; padding: 14px 14px 0; font-size: 14px; font-weight: 700; }

/* Column config */
.col-list { display: flex; flex-direction: column; gap: 6px; }
.col-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; transition: background .15s, box-shadow .15s; }
.col-item.dragging { opacity: .5; }
.col-item.over { box-shadow: 0 -2px 0 var(--honey); }
.col-item .grip { cursor: grab; color: var(--muted); user-select: none; }
.col-item label { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.col-item input { accent-color: var(--honey-600); width: 16px; height: 16px; }

/* Context menu */
.ctx-menu { position: fixed; z-index: 70; min-width: 230px; padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); display: none; animation: pop .15s var(--ease); }
.ctx-menu.show { display: block; }
.ctx-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; text-align: left; font-weight: 500; }
.ctx-menu button:hover { background: var(--honey-50); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border-2); margin: 4px 0; }
.ctx-menu .ico { width: 18px; text-align: center; }

/* Toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--text); color: #fff; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn .3s var(--ease); }
.toast.ok::before { content: '✓  '; color: var(--honey); font-weight: 800; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .search { order: 5; max-width: none; flex-basis: 100%; }
  .brand { min-width: 0; }
  .user-chip span { display: none; }
  .tabs, .container { padding-left: 14px; padding-right: 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .compare, .info-grid, .choice-help { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .fin-strip { grid-template-columns: 1fr 1fr; }
}

/* =====================================================================
   SCOPE 1: LOGIN SCREEN & USER AUTH MENU
   ===================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(135deg, #FFFDF8 0%, #FEF9EE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade .25s var(--ease);
}
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(28, 25, 23, .12), 0 0 0 1px rgba(245, 158, 11, .1);
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.login-logo {
  width: 60px;
  height: 60px;
  background: var(--honey-100);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(245, 158, 11, .25);
}
.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -.5px;
}
.login-title span { color: var(--honey-600); }
.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-input-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.login-input-group input {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  background: #fafaf9;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-input-group input:focus {
  outline: none;
  background: #fff;
  border-color: var(--honey);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .15);
}
.login-btn {
  height: 44px;
  background: var(--honey);
  color: #1c1917;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, .3);
  transition: transform .15s, background .15s, box-shadow .15s;
  margin-top: 4px;
}
.login-btn:hover {
  background: var(--honey-600);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, .4);
}
.login-google-btn {
  height: 44px;
  background: #fff;
  color: #374151;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
  cursor: pointer;
  width: 100%;
}
.login-google-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .09);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 2px 0;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}
.login-quick-section {
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-quick-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .5px;
  text-align: center;
}
.login-quick-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-chip-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: background .15s, border-color .15s, transform .15s;
  text-align: left;
}
.login-chip-btn:hover {
  background: var(--honey-50);
  border-color: var(--honey);
  transform: translateY(-1px);
}
.login-chip-btn .chip-ico {
  font-size: 16px;
}
.login-chip-btn .chip-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.login-chip-btn .chip-desc {
  font-size: 11px;
  color: var(--muted);
}
.login-error {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--red-50);
  border: 1px solid var(--red-100);
  color: var(--red);
  font-size: 12.5px;
  font-weight: 500;
}
.user-chip {
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 10px;
  transition: background .15s;
  position: relative;
  user-select: none;
}
.user-chip:hover {
  background: var(--honey-50);
}
.user-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  min-width: 250px;
  z-index: 60;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: pop .15s var(--ease);
}
.user-menu-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-menu-header .u-name { font-weight: 700; font-size: 14px; color: var(--text); }
.user-menu-header .u-email { font-size: 11.5px; color: var(--muted); }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background .15s;
}
.user-menu-item:hover { background: var(--honey-50); }
.user-menu-item.logout { color: var(--red); font-weight: 600; }
.user-menu-item.logout:hover { background: var(--red-50); }

/* =====================================================================
   ĐĂNG KÝ HỌC TIẾP HÀNG LOẠT (BULK RE-ENROLLMENT)
   ===================================================================== */
.bulk-flow-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.bulk-flow-arrow {
  font-size: 20px;
  color: var(--honey-600);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 18px;
}
.bulk-info-box {
  background: var(--surface-2);
  border: 1px solid var(--honey-200);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.bulk-table-container {
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: none;
  overflow-y: visible;
  background: #fff;
}
.modal.compact .bulk-table-container {
  max-height: 380px;
  overflow-y: auto;
}
.bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.bulk-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
}
.bulk-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}
.bulk-table tr:hover td {
  background: var(--honey-50);
}
.bulk-table tr.row-disabled td {
  opacity: 0.65;
  background: #fafafa;
}
.bulk-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--honey-600);
  cursor: pointer;
}
.bulk-discount-select {
  height: 32px;
  font-size: 12px;
  border-radius: 8px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.bulk-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  margin-top: 14px;
}
.bulk-summary-bar .highlight {
  font-size: 16px;
  font-weight: 800;
  color: var(--honey-900);
}

/* =====================================================================
   QUẢN LÝ LỚP HỌC (CLASS MANAGEMENT & ROSTER)
   ===================================================================== */
.days-chk-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.day-chk-label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
  transition: all .15s;
}
.day-chk-label:hover {
  border-color: var(--honey-400);
  background: var(--honey-50);
}
.day-chk-label input {
  accent-color: var(--honey-600);
}
.day-chk-label:has(input:checked) {
  border-color: var(--honey-500);
  background: var(--honey-100);
}
.class-roster-box {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.class-roster-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.class-roster-stat small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.class-roster-stat b {
  font-size: 13px;
  color: var(--text);
}

/* =====================================================================
   PARENT EMAIL SYSTEM STYLES (0 VNĐ/THÁNG)
   ===================================================================== */

/* Kích thước modal email toàn màn hình rộng 2 cột */
.modal-email:not(.compact) {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
}

/* Bố cục 2 cột rộng rãi trên Desktop */
.email-composer-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .email-composer-layout {
    grid-template-columns: 1fr;
  }
}

.email-form-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.email-preview-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FAF9F6;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  position: sticky;
  top: 0;
}

/* Thanh thẻ biến chèn nhanh */
.var-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 6px 0;
}

.var-chip-btn {
  background: var(--honey-50);
  border: 1px solid var(--honey-200);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--honey-700);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.var-chip-btn:hover {
  background: var(--honey-100);
  border-color: var(--honey);
  transform: translateY(-1px);
}

/* Bộ điều hướng xem trước học sinh */
.email-preview-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}

.email-preview-box {
  flex: 1;
  overflow-y: visible;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  font-size: 13.5px;
  line-height: 1.65;
  max-height: none;
  word-break: break-word;
}

/* Bảng danh sách học sinh trong Modal Gửi Lớp / Nhắc nợ */
.email-roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.email-roster-table th {
  background: #FAF9F6;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.email-roster-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-2);
  vertical-align: middle;
}

.email-roster-table tr:hover {
  background: var(--honey-50);
  cursor: pointer;
}

.email-roster-table tr.selected {
  background: var(--honey-100);
}

/* Ô nhập ghi chú riêng & email inline */
.em-note-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11.5px;
  background: #fff;
}

.em-note-input:focus {
  border-color: var(--honey);
  outline: none;
  box-shadow: 0 0 0 2px var(--honey-100);
}

.em-email-input {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  width: 150px;
}

.em-email-input:focus {
  border-color: var(--honey);
  outline: none;
}

/* Thanh hạn ngạch và tiến trình */
.quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--honey-200);
  color: var(--honey-700);
}

.email-progress-bar {
  width: 100%;
  height: 7px;
  background: var(--border-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.email-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--honey), var(--green));
  transition: width .25s ease;
}

/* Lịch sử email trong Drawer */
.email-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.email-history-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: background .15s;
}

.email-history-item:hover {
  background: #FAF9F6;
}

.email-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.email-tag-sent {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-200);
}

.email-tag-draft {
  background: var(--honey-50);
  color: var(--honey-700);
  border: 1px solid var(--honey-200);
}

.email-tag-failed {
  background: var(--red-50);
  color: var(--red-700);
  border: 1px solid var(--red-200);
}

