:root {
  color-scheme: light;
  --ink: #13202a;
  --muted: #6b7782;
  --paper: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --line: #dfe6eb;
  --brand: #204d70;
  --brand-dark: #153851;
  --brand-soft: #e5eff6;
  --teal: #117c72;
  --amber: #a86400;
  --rose: #b53c55;
  --shadow: 0 12px 30px rgba(22, 50, 71, 0.08);
  --radius: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { border: 0; }
button, label[role="button"] { -webkit-tap-highlight-color: transparent; }

.app-frame { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px clamp(16px, 4vw, 38px); background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mark { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: #fff; background: var(--brand); border-radius: var(--radius); font-weight: 850; letter-spacing: .04em; }
.eyebrow { color: var(--teal); font-size: .68rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.brand-title { margin: 2px 0 0; font-size: 1rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions, .header-actions, .button-row, .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-chip, .tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: .73rem; font-weight: 800; white-space: nowrap; }
.tag.green { color: #14684f; background: #ddf2e7; }
.tag.amber { color: #7b4b00; background: #f9e9ca; }
.tag.blue { color: #285b87; background: #e0ecf7; }

.app-body { display: flex; min-height: calc(100vh - 72px); }
.sidebar { position: sticky; top: 72px; width: 236px; height: calc(100vh - 72px); display: flex; flex-direction: column; gap: 4px; padding: 24px 14px; background: #fff; border-right: 1px solid var(--line); }
.sidebar-label { padding: 0 11px 7px; color: #8a959e; font-size: .68rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.nav-button { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 11px; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; font-size: .86rem; font-weight: 750; }
.nav-button:hover, .nav-button.active { color: var(--brand-dark); background: var(--brand-soft); }
.nav-glyph { width: 21px; display: inline-grid; place-items: center; font-size: 1.04rem; font-weight: 900; }
.sidebar-spacer { flex: 1; }
.sidebar-user { display: grid; gap: 3px; margin: 10px 6px 0; padding: 12px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; overflow: hidden; }
.sidebar-user strong { color: var(--ink); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { width: min(100%, 1220px); min-width: 0; padding: 30px clamp(16px, 4vw, 42px) 50px; }
.mobile-nav { display: none; }

.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 24px; }
.page-header h1 { margin: 4px 0 7px; color: var(--brand-dark); font-size: clamp(1.65rem, 3.3vw, 2.45rem); line-height: 1.05; letter-spacing: 0; }
.page-header p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.5; }
.header-actions { justify-content: flex-end; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-card { min-height: 126px; display: grid; align-content: start; gap: 8px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-card strong { color: var(--brand-dark); font-size: 2rem; line-height: 1; }
.metric-card span { font-weight: 800; }
.metric-card small { color: var(--muted); font-size: .74rem; }
.dashboard-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wide-panel { grid-column: 1 / -1; }
.panel { min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2 { margin: 0; color: var(--brand-dark); font-size: 1rem; line-height: 1.15; }
.data-list { display: grid; gap: 8px; }
.data-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 7px; }
.data-row.stacked { align-items: flex-start; flex-direction: column; }
.data-row strong { line-height: 1.25; }
.data-row span, .data-row p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.row-between { width: 100%; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.row-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini-progress { display: block; width: 72px; height: 6px; overflow: hidden; border-radius: 999px; background: #dae3e9; }
.mini-progress span { display: block; height: 100%; background: var(--teal); }
.pulse-grid { display: grid; gap: 13px; }
.pulse-row { display: grid; grid-template-columns: 150px 1fr 45px; align-items: center; gap: 12px; font-size: .82rem; }
.pulse-row .bar { height: 9px; overflow: hidden; border-radius: 999px; background: #e7edf1; }
.pulse-row .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #4ca89a); }
.pulse-row strong { text-align: right; font-size: .78rem; }
.quick-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 15px 18px; background: var(--brand-dark); border-radius: var(--radius); color: #fff; }
.quick-strip div { display: grid; gap: 4px; }
.quick-strip span { color: #c9d8e3; font-size: .8rem; }

.btn, .icon-button, .text-button, .file-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 14px; border-radius: 7px; cursor: pointer; font-weight: 800; }
.btn { color: var(--ink); background: #e9eff2; }
.btn.primary { color: #fff; background: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.warning { color: #fff; background: var(--amber); }
.btn.danger { color: #fff; background: var(--rose); }
.btn.ghost { color: var(--brand); background: transparent; border: 1px solid var(--line); }
.btn.wide { width: 100%; }
.btn:disabled, .icon-button:disabled { opacity: .55; cursor: not-allowed; }
.icon-button { width: 40px; min-width: 40px; padding: 0; color: var(--brand); background: #eef3f6; }
.icon-button.subtle { width: 34px; min-width: 34px; min-height: 34px; border: 1px solid var(--line); background: #fff; }
.icon-button:hover, .text-button:hover { background: var(--brand-soft); }
.text-button { min-height: 30px; padding: 0 5px; color: var(--brand); background: transparent; font-size: .76rem; }
.status { margin: 0 0 14px; padding: 11px 13px; border-radius: 7px; color: #205b56; background: #e1f2ee; font-size: .82rem; font-weight: 750; }
.status.error { color: #8e2841; background: #f9e1e7; }

.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { color: #445663; font-size: .78rem; font-weight: 800; }
.input, .select, .textarea { width: 100%; min-height: 43px; border: 1px solid #cbd7df; border-radius: 7px; padding: 10px 11px; color: var(--ink); background: #fff; outline: none; }
.textarea { min-height: 105px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(17, 124, 114, .13); }
.split-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 14px; align-items: start; }
.helper-panel, .empty-state { display: grid; gap: 6px; padding: 18px; color: var(--muted); background: var(--surface-soft); border: 1px dashed #c9d6df; border-radius: 7px; }
.helper-panel strong { color: var(--brand-dark); }
.empty-state { min-height: 90px; place-items: center; text-align: center; font-size: .84rem; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #fff; cursor: pointer; font-size: .78rem; font-weight: 800; }
.tab.active { color: var(--brand); background: var(--brand-soft); border-color: #c8dce9; }
.report-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }

.scan-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(250px, .9fr); gap: 14px; margin-bottom: 14px; }
.camera-panel { position: relative; min-height: 300px; overflow: hidden; display: grid; place-items: center; background: #122332; border-radius: var(--radius); }
.camera-video { width: 100%; height: 100%; min-height: 300px; display: block; object-fit: cover; }
.camera-overlay { position: absolute; inset: 22% 15%; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .82); border-radius: 12px; color: #fff; text-align: center; pointer-events: none; }
.camera-overlay span { max-width: 170px; padding: 7px; background: rgba(18, 35, 50, .75); border-radius: 5px; font-size: .74rem; }
.camera-status { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 8px 10px; color: #fff; background: rgba(18, 35, 50, .78); border-radius: 6px; font-size: .73rem; }
.manual-scan { display: grid; align-content: center; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.capture-panel { display: grid; gap: 18px; }
.capture-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.capture-heading h2 { margin: 4px 0 5px; color: var(--brand-dark); }
.capture-heading p { margin: 0; color: var(--muted); font-size: .8rem; }
.attendance-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.attendance-input { display: grid; gap: 7px; }
.attendance-input > span { color: #445663; font-size: .79rem; font-weight: 800; }
.stepper-input { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 7px; }
.stepper-input button { min-height: 43px; border: 1px solid var(--line); border-radius: 7px; color: var(--brand); background: var(--surface-soft); cursor: pointer; font-size: 1.2rem; }
.capture-total { display: flex; align-items: center; justify-content: space-between; padding: 14px; color: var(--muted); background: var(--brand-soft); border-radius: 7px; }
.capture-total strong { color: var(--brand-dark); font-size: 1.25rem; }
.success-panel { max-width: 620px; margin: 30px auto; padding: 34px; text-align: center; background: var(--surface); border: 1px solid #bde2d1; border-radius: var(--radius); box-shadow: var(--shadow); }
.success-panel h2 { margin: 13px 0 6px; color: #14684f; }
.success-panel p { margin: 0 0 18px; color: var(--muted); }
.success-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto; border-radius: 50%; color: #fff; background: #19855f; font-size: 1.8rem; font-weight: 900; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th { padding: 10px 8px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td { padding: 12px 8px; border-bottom: 1px solid #edf1f3; vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.certificate-preview { max-width: 620px; margin: 0 auto; padding: 34px; text-align: center; border: 8px double #bdd2df; background: #fff; }
.certificate-preview h2 { margin: 9px 0 4px; color: var(--brand-dark); }
.certificate-preview p { margin: 0; color: var(--muted); }
.certificate-number { margin: 24px 0 2px; color: var(--brand); font-size: 3rem; font-weight: 850; }
.certificate-preview > span { color: var(--muted); font-size: .8rem; }
.certificate-preview .button-row { justify-content: center; margin-top: 24px; }
.period-editor { display: grid; gap: 8px; overflow-x: auto; }
.period-row { min-width: 620px; display: grid; grid-template-columns: 44px minmax(150px, 1fr) 130px 130px 36px; gap: 8px; align-items: center; }
.period-code { display: grid; place-items: center; height: 42px; color: var(--brand); background: var(--brand-soft); border-radius: 7px; font-weight: 850; }
.import-tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.file-button { color: var(--brand); background: var(--brand-soft); }
.file-button input { display: none; }
.danger-zone { display: grid; gap: 6px; margin-top: 14px; padding: 13px; border: 1px solid #f1c9d2; border-radius: 7px; color: var(--rose); background: #fff8f9; font-size: .8rem; }
.danger-zone span { color: var(--muted); }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.about-grid .panel:last-child { grid-column: 1 / -1; }
.about-grid p { margin: 0; color: var(--muted); line-height: 1.65; }
.security-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 1.5rem 1rem;
  background: #101c2e url("/login-background-v18.jpg") center / cover no-repeat;
}
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.6rem;
  width: min(100%, 30rem);
  padding: 2.15rem;
  border: 1px solid #cbd6e4;
  border-top: 4px solid #2445c7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(27, 45, 82, .09);
}
.login-heading {
  display: flex;
  align-items: center;
  gap: .85rem;
  min-width: 0;
  padding: 0 0 1.55rem;
  border-bottom: 1px solid #d7dfeb;
  color: #18253c;
  animation: login-rise 530ms cubic-bezier(.16, 1, .3, 1) both;
}
.login-heading .mark { width: 45px; height: 45px; flex: 0 0 45px; color: #fff; background: #2445c7; letter-spacing: 0; }
.login-heading h1 { margin: 0; font-size: 2.15rem; font-weight: 780; line-height: 1.1; letter-spacing: 0; }
.login-panel {
  min-width: 0;
  color: #18253c;
  animation: login-rise 560ms 100ms cubic-bezier(.16, 1, .3, 1) backwards;
}
.login-panel h2 { margin: 0 0 1.25rem; font-size: 1.5rem; line-height: 1.15; }
.login-form { display: grid; gap: 1.15rem; }
.login-form .field { gap: .5rem; }
.login-form .field > span, .login-password-field > label { color: #27354d; font-weight: 700; font-size: .95rem; }
.login-form .input { min-height: 54px; border-color: #8293aa; color: #18253c; background: #f8fafd; transition: border-color 160ms ease, box-shadow 160ms ease; }
.login-form .input:focus { border-color: #3654d4; box-shadow: 0 0 0 3px rgba(54, 84, 212, .15); }
.login-password-control { position: relative; }
.login-password-control .input { padding-right: 3rem; }
.login-visibility {
  position: absolute;
  inset: 2px 2px 2px auto;
  display: grid;
  place-items: center;
  width: 44px;
  border-radius: 6px;
  color: #4d5d73;
  background: transparent;
  cursor: pointer;
}
.login-visibility svg { width: 19px; height: 19px; pointer-events: none; }
.login-visibility:hover { color: #243eae; background: #eef2ff; }
.login-visibility:focus-visible, .login-submit:focus-visible { outline: 2px solid #3654d4; outline-offset: 2px; }
.btn.login-submit { min-height: 54px; width: 100%; background: #2445c7; transition: background-color 150ms, transform 150ms; }
.btn.login-submit:hover { background: #1d36a0; }
.btn.login-submit:active:not(:disabled) { transform: translateY(1px); }
.btn.login-submit:disabled { opacity: 1; background: #4962c5; cursor: wait; }
.login-spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; }
.login-form[aria-busy="true"] .login-spinner { display: block; animation: login-spin 720ms linear infinite; }
.login-error { margin: 0; padding: .7rem .8rem; border-radius: 6px; background: #fbeced; color: #882c37; font-size: .85rem; line-height: 1.45; }
.login-error:empty { display: none; }
.login-note { margin: 1.45rem 0 0; color: #48596e; font-size: .875rem; line-height: 1.55; }
.login-note strong { display: block; color: #27354d; }
.login-waiting { min-height: 100svh; display: grid; justify-items: center; align-content: center; gap: .65rem; color: var(--muted); }
.login-waiting p { margin: 0; }
@keyframes login-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (max-width: 520px) {
  .login-wrap {
    background-image: linear-gradient(transparent 11rem, #101c2e 22rem), url("/login-background-v18.jpg");
    background-position: center, left -4.5rem;
    background-size: 100% 100%, auto 27rem;
  }
  .login-layout { gap: 1.3rem; padding: 1.35rem; }
  .login-heading { padding-bottom: 1.2rem; }
  .login-heading h1 { font-size: 1.86rem; }
  .login-heading .mark { width: 40px; height: 40px; flex-basis: 40px; }
  .login-panel h2 { font-size: 1.3rem; margin-bottom: 1rem; }
}
@media (max-width: 360px) {
  .login-heading h1 { font-size: 1.68rem; }
  .login-layout { padding: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .login-heading, .login-panel, .login-form[aria-busy="true"] .login-spinner { animation: none; }
  .btn.login-submit, .login-form .input { transition: none; }
  .btn.login-submit:active:not(:disabled) { transform: none; }
}
.loading-panel p { margin-bottom: 0; }
.loading-state { padding: 50px; text-align: center; color: var(--muted); }

@media (max-width: 950px) {
  .sidebar { width: 208px; }
  .content { padding-left: 24px; padding-right: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .topbar { height: 62px; padding: 10px 14px; }
  .top-signout, .role-chip { display: none; }
  .app-body { min-height: calc(100vh - 62px); }
  .sidebar { display: none; }
  .content { padding: 22px 14px calc(88px + var(--safe-bottom)); }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; padding: 7px 7px calc(7px + var(--safe-bottom)); background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -7px 24px rgba(22, 50, 71, .08); }
  .mobile-nav .nav-button { min-height: 55px; display: grid; place-items: center; gap: 2px; padding: 4px 2px; text-align: center; font-size: .62rem; }
  .mobile-nav .nav-glyph { height: 20px; }
  .page-header { display: grid; align-items: start; gap: 14px; margin-bottom: 18px; }
  .header-actions { justify-content: flex-start; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 104px; padding: 13px; }
  .metric-card strong { font-size: 1.6rem; }
  .dashboard-layout, .split-layout, .scan-layout, .about-grid, .security-grid { grid-template-columns: 1fr; }
  .wide-panel, .about-grid .panel:last-child { grid-column: auto; }
  .quick-strip { align-items: flex-start; flex-direction: column; }
  .form-grid.two, .form-grid.three, .report-controls, .attendance-inputs { grid-template-columns: 1fr; }
  .report-controls { gap: 9px; }
  .camera-panel, .camera-video { min-height: 250px; }
  .pulse-row { grid-template-columns: 98px 1fr 39px; gap: 8px; font-size: .73rem; }
  .panel { padding: 14px; }
  .data-row { align-items: flex-start; flex-direction: column; }
  .data-row .row-right { justify-content: flex-start; }
  .row-between { align-items: flex-start; }
  .capture-heading { display: grid; }
}

.workflow-page { display: grid; gap: 1rem; max-width: 64rem; }
.workflow-page > h1 { font-size: 1.9rem; margin: 0; }
.workflow-stack, .workflow-form { display: grid; gap: .9rem; }
.workflow-form { max-width: 43rem; }
.workflow-form .field[hidden] { display: none; }
.workflow-row { border-bottom: 1px solid var(--line); padding: .65rem 0; overflow-wrap: anywhere; }
.workflow-row h2, .workflow-row h3 { font-size: 1.1rem; margin: 0; }
.workflow-row p { margin: .4rem 0; }
.workflow-home { margin-bottom: 1rem; }
.workflow-details { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.workflow-details > summary { cursor: pointer; font-weight: 650; padding: .3rem 0; }
.workflow-details[open] > .workflow-form { margin-top: .6rem; }
.workflow-check { display: flex; align-items: flex-start; gap: .6rem; min-height: 2rem; }
.workflow-check input { flex: 0 0 auto; }
.workflow-message:empty { display: none; }
.workflow-message { color: #a52e42; }
.workflow-mark { max-width: 34rem; }
.student-workspace { max-width: 72rem; }
.student-workspace > .field { max-width: 28rem; }
.student-workspace-body, .student-workspace-stack, .student-results { display: grid; gap: .9rem; min-width: 0; }
.student-workspace h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.student-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid #cbd7df; }
.student-tabs button {
  position: relative; color: #485f6e; background: transparent; font-weight: 700; font-size: .9rem;
  min-height: 44px; padding: .55rem .8rem; cursor: pointer; border-bottom: 2px solid transparent;
}
.student-tabs button[aria-selected="true"] { color: var(--brand-dark); border-bottom-color: var(--teal); background: var(--brand-soft); }
.student-workspace-panel { min-width: 0; }
.student-filters {
  display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(7rem, .8fr) minmax(9rem, 1fr) auto;
  align-items: end; gap: .6rem; min-width: 0;
}
.student-filters-compact { grid-template-columns: minmax(12rem, 2fr) minmax(9rem, 1fr) auto; }
.student-filters .btn { min-height: 43px; }
.student-workspace .btn { text-decoration: none; }
.student-result-bar, .student-page-buttons, .student-tag-row, .student-preview-actions, .student-context {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; min-width: 0;
}
.student-result-bar, .student-context { justify-content: space-between; }
.student-result-bar p, .student-picker-results p, .student-dialog p { margin: 0; }
.student-page-buttons .btn, .student-table .btn, .student-selection .btn, .student-picker-results .btn { min-height: 36px; padding: .3rem .65rem; font-size: .79rem; }
.student-page-buttons span { min-width: 3.2rem; text-align: center; }
.student-table {
  width: 100%; table-layout: auto; border: 1px solid var(--line); background: var(--surface);
  border-collapse: separate; border-spacing: 0; border-radius: 8px; font-size: .88rem;
}
.student-table th {
  background: #eaf0f4; padding: .7rem .8rem; color: #445663; font-size: .73rem;
  letter-spacing: 0; text-transform: none; white-space: normal;
}
.student-table th:first-child { border-top-left-radius: 7px; }
.student-table th:last-child { border-top-right-radius: 7px; }
.student-table td { padding: .5rem .8rem; white-space: normal; overflow-wrap: anywhere; }
.student-table tr:focus-within td { background: #f2f7fa; }
.student-table-action { width: 1%; text-align: right; }
.student-table-action .btn { white-space: nowrap; }
.student-cell { display: grid; gap: .16rem; min-width: 0; overflow-wrap: anywhere; }
.student-muted { color: #536674; font-size: .8rem; }
.student-tag-row .tag { max-width: 100%; white-space: normal; }
.student-empty { display: grid; justify-items: start; gap: .65rem; min-height: 6rem; align-content: center; border-block: 1px solid var(--line); padding: .9rem 0; }
.student-context { background: #e7f1f5; border-radius: 7px; padding: .65rem .8rem; }
.student-preview-actions { align-items: end; }
.student-preview-actions .field { min-width: min(11rem, 100%); }
.student-row-error { margin: 0; color: #8e2841; }
.student-dialog {
  width: min(41rem, calc(100% - 1.6rem)); max-height: calc(100dvh - 1.6rem); padding: 1rem;
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); overflow: auto;
}
.student-dialog::backdrop { background: rgba(21, 42, 56, .48); }
.student-dialog h2 { font-size: 1.2rem; margin: 0 0 .85rem; }
.student-dialog .workflow-check[hidden], .student-dialog p[hidden] { display: none; }
.student-picker, .student-selection, .student-picker-results { display: grid; gap: .35rem; min-width: 0; }
.student-picker-results { background: #f5f8fa; border-block: 1px solid var(--line); padding: .4rem .55rem; max-height: 13rem; overflow: auto; }
.student-picker-results[hidden] { display: none; }
.student-selection { max-height: 9rem; overflow: auto; }
.student-selection-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .25rem .04rem; }
.student-selection .student-selection-item { background: #edf4f8; border-radius: 6px; padding-inline: .45rem; }
.student-tabs button:focus-visible, .student-workspace-panel:focus-visible, .student-workspace .btn:focus-visible, .student-dialog .btn:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}
@media (hover: hover) {
  .student-tabs button:not([aria-selected="true"]):hover { color: var(--brand-dark); background: #eaf1f5; }
  .student-table tbody tr:hover td { background: #f2f7fa; }
}
@media (max-width: 850px) {
  .student-filters, .student-filters-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-filters > :first-child { grid-column: 1 / -1; }
  .student-filters > .btn { justify-self: start; }
}
@media (max-width: 600px) {
  .student-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-tabs button { text-align: left; }
  .student-filters:not(.student-filters-compact) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .student-filters:not(.student-filters-compact) > .field:first-child { grid-column: 1 / span 3; }
  .student-filters:not(.student-filters-compact) > .field:not(:first-child) { grid-column: span 2; }
  .student-filters:not(.student-filters-compact) > .btn { grid-column: 4; grid-row: 1; width: 100%; padding-inline: .25rem; font-size: .75rem; }
  .student-table, .student-table tbody { display: block; }
  .student-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .student-table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    gap: .3rem .5rem; padding: .6rem .7rem; border-bottom: 1px solid var(--line);
  }
  .student-table tbody tr:last-child { border-bottom: 0; }
  .student-table tbody td { display: block; grid-column: 1; padding: 0; border: 0; }
  .student-table tbody .student-table-action { grid-column: 2; grid-row: 1 / span 3; width: auto; }
  .student-table-action .btn { white-space: normal; max-width: 7rem; }
  .student-table-no-action tbody tr { grid-template-columns: minmax(0, 1fr); }
}
.profile-summary, .profile-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.profile-toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(10rem, 1fr); gap: .75rem; }
.profile-directory-list { list-style: none; padding: 0; margin: 0; }
.profile-directory-heading, .profile-directory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 7.75rem;
  align-items: center;
  gap: .9rem;
  padding: .65rem .2rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.profile-directory-heading { font-weight: 700; }
.profile-directory-row > .btn { white-space: nowrap; }
.profile-secondary { font-size: .85rem; margin-top: .2rem; }
.profile-announcement { margin: 0; }
.profile-teachers-link { margin-bottom: 1rem; }
.profile-editor { width: min(42rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 1.15rem; border: 1px solid var(--line); border-radius: 8px; }
.profile-editor::backdrop { background: rgba(21, 42, 56, .46); }
.profile-editor h2 { margin: 0 0 .3rem; font-size: 1.3rem; }
.profile-editor > .profile-secondary { margin-bottom: 1rem; }
.profile-balances { margin-top: .75rem; }
@media (max-width: 600px) {
  .profile-toolbar { grid-template-columns: minmax(0, 1fr); }
  .profile-directory-heading { display: none; }
  .profile-directory-row { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem .7rem; }
  .profile-directory-row > .btn { grid-column: 2; grid-row: 1 / span 2; white-space: normal; }
  .profile-directory-row > div:nth-child(2) { grid-column: 1; }
  .profile-editor .form-grid.two { grid-template-columns: minmax(0, 1fr); }
}
.leave-print { max-width: 52rem; margin: 1rem auto; padding: 1rem 0; }
.leave-print table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.leave-print th, .leave-print td { border: 1px solid var(--line); padding: .4rem; text-align: left; overflow-wrap: anywhere; }

@media print {
  .workflow-no-print, .workflow-page > h1, .workflow-page > .field { display: none !important; }
  .leave-print { color: #000; margin: 0; }
  .leave-print tr { break-inside: avoid; }
  .topbar, .sidebar, .mobile-nav, .page-header, .report-controls, .report-tabs, .panel-heading, .btn, .icon-button { display: none !important; }
  body, .app-frame, .content { background: #fff; }
  .content { padding: 0; }
  .certificate-preview { display: block; max-width: none; margin-top: 28mm; box-shadow: none; }
}
