/* ============================================================================
 * EzStarAcademy Portal - Corporate Perfex CRM Layout & Mobile-First Theme
 * Palette matched to ezstaracademy.com: Obsidian (#080D17), Crimson (#E11D2E), White (#FFFFFF)
 * ============================================================================ */

:root {
  --obsidian: #080d17;
  --obsidian-soft: #101829;
  --obsidian-border: rgba(255, 255, 255, 0.08);
  --crimson: #e11d2e;
  --crimson-hover: #c01524;
  --crimson-soft: rgba(225, 29, 46, 0.09);

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-alt: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ink: #111827;
  --ink-muted: #6b7280;

  --ok-bg: #ecfdf5;
  --ok-ink: #065f46;
  --warn-bg: #fffbeb;
  --warn-ink: #92400e;
  --err-bg: #fef2f2;
  --err-ink: #991b1b;
  --info-bg: #f1f5f9;
  --info-ink: #334155;

  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", "Segoe UI", -apple-system, sans-serif;
  --font-num: "Inter", "Segoe UI", -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Segoe UI Mono", Consolas, monospace;
  --radius: 5px;
  --radius-lg: 8px;
  --ctrl-h: 36px;
  --sidebar-w: 248px;
  --topbar-h: 58px;
  --mobile-nav-h: 60px;
}

[data-theme="dark"] {
  --bg: #070b14;
  --surface: #0f172a;
  --surface-alt: #152038;
  --border: #1e2d4a;
  --border-strong: #2b3e63;
  --ink: #f3f4f6;
  --ink-muted: #9ca3af;
  --ok-bg: rgba(16, 185, 129, 0.16);
  --ok-ink: #6ee7b7;
  --warn-bg: rgba(245, 158, 11, 0.16);
  --warn-ink: #fcd34d;
  --err-bg: rgba(239, 68, 68, 0.18);
  --err-ink: #fca5a5;
  --info-bg: rgba(255, 255, 255, 0.08);
  --info-ink: #cbd5e1;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
a { color: var(--crimson); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Perfex-Style Shell Layout (Sidebar + Workspace) ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--obsidian);
  color: #e5e7eb;
  border-right: 1px solid var(--obsidian-border);
  display: flex; flex-direction: column;
  z-index: 60;
  transition: width 0.2s ease, transform 0.22s ease;
}
.sidebar.collapsed { width: 66px; }
.sidebar.collapsed .sb-text,
.sidebar.collapsed .sb-group-label,
.sidebar.collapsed .sb-user-meta { display: none !important; }
.sidebar.collapsed .sb-head { justify-content: center; padding: 0 10px; }
.sidebar.collapsed .sb-brand { display: none; }
.sidebar.collapsed .sb-collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .sb-link { justify-content: center; padding: 10px; }

.sb-head {
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--obsidian-border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  overflow: hidden;
}
.sb-brand {
  display: inline-flex; align-items: center; gap: 10px; color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.015em;
}
.sb-brand:hover { text-decoration: none; }
.sb-brand img { height: 26px; max-width: 56px; width: auto; object-fit: contain; display: block; flex-shrink: 0; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sb-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #64748b; padding: 10px 10px 6px;
}
.sb-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sb-link {
  width: 100%; border: none; background: transparent; color: #cbd5e1;
  padding: 9px 12px; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 11px;
  cursor: pointer; text-align: left; position: relative;
  transition: background 0.15s, color 0.15s;
}
.sb-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.sb-link:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.sb-link.active {
  background: rgba(225, 29, 46, 0.16);
  color: #ffffff;
  font-weight: 600;
}
.sb-link.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  background: var(--crimson); border-radius: 0 3px 3px 0;
}
.sb-link.active svg { color: var(--crimson); opacity: 1; }

.sb-foot {
  border-top: 1px solid var(--obsidian-border);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.sb-pwd-reminder {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.sb-pwd-reminder:hover { background: rgba(245, 158, 11, 0.22); }

.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-avatar {
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--crimson); color: #fff;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-user-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user-role { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.sb-foot-actions { display: flex; gap: 6px; }
.sb-foot-btn {
  flex: 1; height: 30px; border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.15); background: transparent; color: #cbd5e1;
  font-family: var(--font-sans); font-size: 11px; font-weight: 600; cursor: pointer;
}
.sb-foot-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sb-foot-btn.danger { border-color: rgba(225, 29, 46, 0.45); color: #fda4af; }
.sb-foot-btn.danger:hover { background: var(--crimson); border-color: var(--crimson); color: #fff; }

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(8, 13, 23, 0.55);
  z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

/* ---------------- Workspace & Sticky Topbar ---------------- */
.workspace {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
  transition: margin-left 0.2s ease;
}
.workspace.expanded { margin-left: 66px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  min-height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 22px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17.5px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;
}
.topbar-sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-muted); }

.topbar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topbar-controls input,
.topbar-controls select {
  height: var(--ctrl-h); padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.month-group { display: inline-flex; align-items: center; }
.month-group button {
  height: var(--ctrl-h); width: 30px; border: 1px solid var(--border-strong);
  background: var(--surface-alt); color: var(--ink); cursor: pointer; font-weight: 700;
}
.month-group button:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.month-group button:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.month-group input { border-radius: 0 !important; width: 152px; }

.icon-btn {
  width: var(--ctrl-h); height: var(--ctrl-h);
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-alt); }
.icon-btn svg { width: 16px; height: 16px; display: block; }
.icon-btn-dark { border-color: rgba(255,255,255,0.16); background: transparent; color: #fff; }
.icon-btn-dark:hover { background: rgba(255,255,255,0.08); }
.mobile-menu-btn { display: none; }

/* ---------------- Main Content, Cards, Perfex Stat Strips & Subtabs ---------------- */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 22px 28px;
  min-width: 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.card-subtle { background: var(--surface-alt); }
.card-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 14.5px; font-weight: 700; letter-spacing: -0.015em;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 92px;
}
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.kpi-val {
  margin-top: 6px;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink);
}
.kpi-sub { margin-top: 4px; font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Perfex-Style Horizontal Sub-Tabs inside Modules */
.subtabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 16px; overflow-x: auto;
}
.subtab-btn {
  border: none; background: transparent; color: var(--ink-muted);
  padding: 10px 14px; font-family: var(--font-sans); font-size: 12.5px; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.subtab-btn:hover { color: var(--ink); }
.subtab-btn.active { color: var(--crimson); border-bottom-color: var(--crimson); }

/* ---------------- Buttons & Uniform Form Inputs ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctrl-h); padding: 0 14px;
  border-radius: var(--radius);
  font-family: var(--font-sans); font-weight: 600; font-size: 12.5px; letter-spacing: 0.005em;
  cursor: pointer; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--crimson); border-color: var(--crimson); color: #ffffff; }
.btn-primary:hover { background: var(--crimson-hover); border-color: var(--crimson-hover); color: #ffffff; }
.btn-dark { background: var(--obsidian); border-color: var(--obsidian); color: #ffffff; }
.btn-dark:hover { background: #1e293b; color: #ffffff; }
.btn-danger { background: var(--err-bg); border-color: #fca5a5; color: var(--err-ink); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink); }
.field input, .field select {
  width: 100%; height: var(--ctrl-h); padding: 0 10px;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-family: var(--font-sans); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.field textarea {
  width: 100%; padding: 9px 10px;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-family: var(--font-sans); font-size: 13px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--crimson); box-shadow: 0 0 0 2px var(--crimson-soft);
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cell-actions { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }

/* Custom Styled File Picker */
.file-picker {
  display: flex; align-items: center; gap: 10px;
  height: var(--ctrl-h); padding: 0 10px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-alt); cursor: pointer;
  overflow: hidden; transition: border-color 0.15s, background 0.15s;
}
.file-picker:hover { border-color: var(--crimson); background: var(--crimson-soft); }
.file-picker input[type="file"] { display: none; }
.file-picker-btn {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 4px 8px; border-radius: 3px; background: var(--obsidian); color: #fff; flex-shrink: 0;
}
.file-picker-name { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Clean Corporate Tables (Tabular Numbers, ZERO Word Breaking) ---------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface-alt); color: var(--ink-muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle; word-break: normal; overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }
tbody tr.selected-row { background: var(--crimson-soft) !important; }
.nowrap { white-space: nowrap; }
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-err { background: var(--err-bg); color: var(--err-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-muted { background: var(--surface-alt); color: var(--ink-muted); }

/* ---------------- Attendance Grid (Frozen Sticky ID + Student + WhatsApp) ---------------- */
.att-table th.att-sticky-1,
.att-table td.att-sticky-1 {
  position: sticky; left: 0; z-index: 3;
  min-width: 72px; width: 72px; white-space: nowrap;
  background: var(--surface);
}
.att-table th.att-sticky-2,
.att-table td.att-sticky-2 {
  position: sticky; left: 72px; z-index: 3;
  min-width: 230px; white-space: nowrap;
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
}
.att-table thead th.att-sticky-1,
.att-table thead th.att-sticky-2 { background: var(--surface-alt); z-index: 4; }
.att-cell {
  text-align: center; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600;
  cursor: pointer; user-select: none; min-width: 72px; white-space: nowrap;
  transition: background 0.1s;
}
.att-cell:hover { background: var(--crimson-soft); }
.att-cell.att-active { outline: 2px solid var(--crimson); outline-offset: -2px; background: var(--crimson-soft); }
.att-cell.att-dirty { box-shadow: inset 0 -3px 0 var(--crimson); }
.att-extra-hdr { color: var(--crimson) !important; }

.brush-pills { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.brush-pill {
  min-width: 34px; height: 32px; padding: 0 9px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: 12px; font-weight: 700; cursor: pointer;
}
.brush-pill.active { background: var(--crimson); border-color: var(--crimson); color: #fff; }

/* ---------------- Progress Bar & Embedded PDF Viewer ---------------- */
.progress-track { width: 100%; height: 8px; background: var(--surface-alt); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: var(--crimson); width: 0%; transition: width 0.25s; }
.pdf-frame { width: 100%; height: 620px; border: 1px solid var(--border); border-radius: var(--radius); background: #111827; }

/* ---------------- Context Menu, Modals & Toasts ---------------- */
.ctx-menu {
  position: fixed; z-index: 120; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 12px 28px rgba(8, 13, 23, 0.2); min-width: 220px; padding: 6px;
}
.ctx-item {
  width: 100%; text-align: left; border: none; background: transparent; color: var(--ink);
  padding: 8px 10px; border-radius: var(--radius); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.ctx-item:hover { background: var(--crimson-soft); color: var(--crimson); }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 0; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(8, 13, 23, 0.65);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--crimson);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}
.modal-card.modal-card-lg { max-width: 820px; }

.toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 150; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  padding: 11px 15px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); border-left: 3px solid var(--crimson);
  background: var(--obsidian); color: #ffffff;
}
.toast.ok { border-left-color: #10b981; }
.toast.err { border-left-color: #ef4444; }

/* ---------------- Login Page (Full-Viewport Pinned Footer + Unified Brand Card) ---------------- */
body.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.site-header {
  position: sticky; top: 0; z-index: 40; height: 64px;
  background: var(--obsidian); color: #fff; border-bottom: 2px solid var(--crimson);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 24px;
}
.header-center { justify-self: center; }
.header-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.header-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.header-brand img { height: 36px; width: auto; object-fit: contain; display: block; }

.login-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.login-shell {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(8, 13, 23, 0.12);
}
[data-theme="dark"] .login-shell {
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.login-shell-head {
  background: var(--obsidian);
  color: #ffffff;
  text-align: center;
  padding: 28px 28px 24px;
  border-bottom: 2px solid var(--crimson);
}
.login-shell-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
}
.login-shell-head h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}
.login-shell-head p {
  margin: 0 auto;
  max-width: 320px;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}
.login-shell-body {
  padding: 26px 28px 24px;
}
.login-shell-body .field input {
  height: 40px;
  padding: 0 12px;
  font-size: 13.5px;
}
.pwd-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pwd-input-wrap input {
  width: 100%;
  padding-right: 40px !important;
}
.pwd-eye-btn {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pwd-eye-btn:hover { color: var(--ink); background: var(--surface-alt); }
.pwd-eye-btn svg { width: 16px; height: 16px; }
.login-msg-slot {
  font-size: 12.5px;
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 12px;
  line-height: 1.45;
}
.login-submit-btn {
  width: 100%;
  height: 42px;
  font-size: 13.5px;
  font-weight: 600;
}
.login-aux-row {
  text-align: center;
  margin-top: 14px;
}
.login-text-link {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.login-text-link:hover { color: var(--crimson); }
.login-sub-heading {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.login-sub-copy {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.site-footer {
  margin-top: auto;
  background: var(--obsidian); color: #cbd5e1; border-top: 2px solid var(--crimson);
  padding: 18px 24px; font-size: 12.5px;
}
.footer-inner { max-width: 1400px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { height: 28px; width: auto; object-fit: contain; display: block; }

/* ---------------- Mobile Bottom Nav Bar & True Phone Responsiveness ---------------- */
.mobile-bottom-nav { display: none; }

@media (max-width: 1120px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); width: 264px !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed .sb-text,
  .sidebar.collapsed .sb-group-label,
  .sidebar.collapsed .sb-user-meta,
  .sidebar.collapsed .sb-brand-text { display: initial !important; }
  .workspace, .workspace.expanded { margin-left: 0; padding-bottom: calc(var(--mobile-nav-h) + 12px); }
  .mobile-menu-btn { display: inline-flex; }
  .sb-collapse-btn { display: none; }
  .topbar { padding: 10px 14px; }
  .topbar-controls { width: 100%; }
  .topbar-controls > * { flex: 1 1 auto; }
  .month-group input { width: 100%; min-width: 120px; }
  .app-main { padding: 14px 12px 20px; }
  .card { padding: 14px; }
  .grid-2, .form-grid, .form-grid-4, .grid-kpi { grid-template-columns: 1fr; }
  .pdf-frame { height: 440px; }
  .toast-host { bottom: calc(var(--mobile-nav-h) + 12px); right: 12px; left: 12px; max-width: none; }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    height: var(--mobile-nav-h);
    background: var(--obsidian);
    border-top: 2px solid var(--crimson);
  }
  .mb-item {
    border: none; background: transparent; color: #94a3b8;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10px; font-weight: 600; cursor: pointer; padding: 4px 2px;
  }
  .mb-item svg { width: 18px; height: 18px; }
  .mb-item.active { color: #ffffff; }
  .mb-item.active svg { color: var(--crimson); }
}

/* ---------------- Staff Profile Avatar Image & Shimmer Skeletons ---------------- */
.sb-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; display: block; }
.sb-user-clickable { cursor: pointer; padding: 4px; border-radius: var(--radius); transition: background 0.15s; }
.sb-user-clickable:hover { background: rgba(255, 255, 255, 0.06); }

@keyframes ezShimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
  background-size: 800px 100%;
  animation: ezShimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius);
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-title { height: 20px; width: 38%; margin-bottom: 14px; }
.skeleton-kpi { height: 92px; border-radius: var(--radius-lg); }


/* ---------------- Persistent Background AI Grading Bar ---------------- */
.bg-job-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  font-size: 12.5px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 35;
}
.bg-job-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
50% { opacity: 0.45; transform: scale(0.85); } }
.bg-job-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.bg-job-progress { flex: 1; max-width: 240px; height: 6px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; border: 1px solid var(--border); }

/* ---------------- Clean Action Dropdown Menus (Decluttered Toolbars) ---------------- */
.action-menu { position: relative; display: inline-flex; }
.action-menu-trigger { display: inline-flex; align-items: center; gap: 5px; }
.action-menu-list {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 215px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px rgba(8, 13, 23, 0.16);
  padding: 5px;
  z-index: 70;
}
.action-menu.open .action-menu-list { display: flex; flex-direction: column; gap: 2px; }
.action-menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.action-menu-item:hover { background: var(--surface-alt); }
.action-menu-item.danger { color: var(--err-ink); }
.action-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ---------------- Sticky Split-Pane PDF Preview & Question Quick-Jump (27+ Qs) ---------------- */
.grading-split {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 16px;
  align-items: start;
}
.pdf-sticky-card {
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 24px);
}
.pdf-sticky-card .pdf-frame {
  width: 100%;
  height: calc(100vh - var(--topbar-h) - 145px);
  min-height: 520px;
}
.q-jump-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.q-jump-pill {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: all 0.12s;
}
.q-jump-pill:hover { border-color: var(--crimson); color: var(--crimson); }
.q-jump-pill.ok { border-color: rgba(22, 163, 74, 0.35); background: rgba(22, 163, 74, 0.08); color: var(--ok-ink); }
.q-jump-pill.warn { border-color: rgba(217, 119, 6, 0.4); background: rgba(217, 119, 6, 0.1); color: var(--warn-ink); }
.q-acc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  margin-bottom: 8px;
  overflow: hidden;
}
.q-acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}
.q-acc > summary::-webkit-details-marker { display: none; }
.q-acc[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface); }
.q-acc-body { padding: 12px; }

@media (max-width: 960px) {
  .grading-split { grid-template-columns: 1fr; }
  .pdf-sticky-card { position: static; max-height: none; }
  .pdf-sticky-card .pdf-frame { height: 460px; min-height: 400px; }
  .bg-job-bar { flex-wrap: wrap; padding: 8px 14px; }
  .bg-job-progress { display: none; }
}


/* ---------------- Crisp UX Polish: Rotating SVG Chevrons, Segmented Controls & Alert Badge ---------------- */
.chev {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--ink-muted);
  transition: transform 0.16s ease;
}
.action-menu.open .chev { transform: rotate(180deg); color: var(--ink); }

.icon-btn-rel { position: relative; }
.icon-btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--crimson);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  font-variant-numeric: tabular-nums;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.toast-close:hover { opacity: 1; }

.seg-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.seg-tab {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg-tab:hover { color: var(--ink); }
.seg-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(8, 13, 23, 0.1);
}

/* === Pure Corporate Precision Override (Zero Dots, Zero AI Pill Boxes, Exact Table Alignment) === */
:root {
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Manrope", system-ui, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Manrope", system-ui, sans-serif;
  --font-num: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Manrope", system-ui, sans-serif;
}

/* Strip ALL dots and boxes from badges: pure crisp corporate typography */
.badge,
.status-chip-btn {
  display: inline !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-family: var(--font-sans) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.005em !important;
}
.badge::before,
.status-chip-btn::before {
  display: none !important;
  content: none !important;
}
.badge-ok { color: #15803d !important; }
.badge-warn { color: #b45309 !important; }
.badge-err { color: #b91c1c !important; }
.badge-info { color: var(--ink) !important; }
.badge-muted { color: var(--ink-muted) !important; font-weight: 500 !important; }

[data-theme="dark"] .badge-ok { color: #4ade80 !important; }
[data-theme="dark"] .badge-warn { color: #fbbf24 !important; }
[data-theme="dark"] .badge-err { color: #f87171 !important; }

.status-chip-btn {
  cursor: pointer !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  text-decoration-thickness: 1px !important;
}
.status-chip-btn.is-err { color: #b91c1c !important; }
[data-theme="dark"] .status-chip-btn.is-err { color: #f87171 !important; }
.status-chip-btn:hover { opacity: 0.78 !important; }

/* Remove sidebar footer boxes & dots completely: clean corporate text links */
.sb-pwd-reminder,
.sb-pwd-note,
.sb-status-row {
  width: 100% !important;
  display: block !important;
  text-align: left !important;
  padding: 2px 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #9ca3af !important;
  font-family: var(--font-sans) !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
  line-height: 1.4 !important;
  cursor: pointer !important;
  transition: color 0.14s !important;
}
.sb-pwd-reminder::before,
.sb-pwd-note::before,
.sb-status-row::before {
  display: none !important;
  content: none !important;
}
.sb-status-row.is-ok { color: #9ca3af !important; }
.sb-status-row.is-warn,
.sb-pwd-reminder,
.sb-pwd-note { color: #fbbf24 !important; }
.sb-status-row.is-err { color: #f87171 !important; }
.sb-pwd-reminder:hover,
.sb-pwd-note:hover,
.sb-status-row:hover {
  color: #ffffff !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  background: transparent !important;
  border: none !important;
}

/* Razor-Exact Table Column Alignment (Uniform Horizontal Padding + Strict Left/Right Rules) */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th,
th {
  padding: 10px 14px !important;
  text-align: left;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  white-space: nowrap;
}
tbody td,
td {
  padding: 11px 14px !important;
  text-align: left;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
thead th.num,
th.num,
tbody td.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums !important;
  white-space: nowrap;
}

/* Clean subtle legal footer */
.app-legal-footer {
  margin-top: auto;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.app-legal-footer a { color: var(--ink-muted); font-weight: 500; }
.app-legal-footer a:hover { color: var(--ink); text-decoration: underline; }

/* === Attendance Sticky Scroll Isolation (Zero Bleed Over Sticky Columns) === */
.att-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.att-table th.att-sticky-1,
.att-table td.att-sticky-1 {
  position: sticky !important;
  left: 0 !important;
  z-index: 6 !important;
  background: var(--surface) !important;
}
.att-table th.att-sticky-2,
.att-table td.att-sticky-2 {
  position: sticky !important;
  left: 72px !important;
  z-index: 6 !important;
  background: var(--surface) !important;
  border-right: 1px solid var(--border-strong) !important;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.06) !important;
}
.att-table thead th.att-sticky-1,
.att-table thead th.att-sticky-2 {
  z-index: 8 !important;
  background: var(--surface-alt) !important;
}
.att-table tbody tr:hover td.att-sticky-1,
.att-table tbody tr:hover td.att-sticky-2 {
  background: var(--surface-alt) !important;
}
.att-cell {
  position: relative;
  z-index: 1;
}
.att-cell.att-active {
  outline: none !important;
  box-shadow: inset 0 0 0 2px var(--crimson) !important;
  background: var(--crimson-soft) !important;
}
.att-cell.att-dirty.att-active {
  box-shadow: inset 0 0 0 2px var(--crimson), inset 0 -3px 0 var(--crimson) !important;
}

/* === Zero-Glitch Collapsible Sidebar (No White-Line Seam, No Scrollbar Flash, No Text Wrap) === */
.sidebar {
  overflow: hidden !important;
  transition: none !important;
  box-shadow: 1px 0 0 var(--obsidian);
}
.workspace {
  transition: none !important;
}
.sb-head,
.sb-brand,
.sb-group,
.sb-group-label,
.sb-link,
.sb-user,
.sb-user-meta,
.sb-foot,
.sb-foot-actions {
  white-space: nowrap;
  overflow: hidden;
}
.sb-scroll {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: none !important;
}
.sb-scroll::-webkit-scrollbar {
  display: none !important;
}
.sidebar.collapsed {
  width: 66px !important;
}
.workspace.expanded {
  margin-left: 66px !important;
}
.sidebar.collapsed .sb-head {
  justify-content: center !important;
  padding: 0 10px !important;
}
.sidebar.collapsed .sb-brand,
.sidebar.collapsed .sb-group,
.sidebar.collapsed .sb-group-label,
.sidebar.collapsed .sb-link span,
.sidebar.collapsed .sb-text,
.sidebar.collapsed .sb-user-meta {
  display: none !important;
}
.sidebar.collapsed .sb-link {
  justify-content: center !important;
  padding: 10px !important;
}
.sidebar.collapsed .sb-user {
  justify-content: center !important;
}
.sidebar.collapsed .sb-collapse-btn svg {
  transform: rotate(180deg);
}
@media (max-width: 960px) {
  .sidebar { transition: transform 0.2s ease !important; }
  .workspace.expanded { margin-left: 0 !important; }
}
