:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Arial,sans-serif;background:#f3f6fc;color:#192a47;--navy:#173c7a;--blue:#2674d1;--light:#eff4fd;--line:#dfE6f1;--sub:#61718d;--green:#047857;--red:#bb263b}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.5}input,select,textarea{outline-color:#6c99f2;border:1px solid #cad6e7;border-radius:10px;min-height:42px;padding:10px 12px;background:#fff;width:100%;color:#1f3358}textarea{min-height:94px;resize:vertical}input[type=number]{min-width:80px}label{font-size:13px;color:#3d506d;display:flex;flex-direction:column;gap:6px;font-weight:650}h1,h2,h3,p{margin-top:0}h1{font-size:26px;letter-spacing:-.6px}h2{font-size:20px;letter-spacing:-.3px}h3{font-size:15px}p{line-height:1.48}.hidden{display:none!important}.muted{color:var(--sub)}.tiny{font-size:12px}.overline{font-size:10px;font-weight:800;letter-spacing:1.5px;color:#7b8da9;margin:0 0 6px}.card{background:#fff;border:1px solid #e2e9f5;border-radius:18px;padding:21px;box-shadow:0 12px 40px #1941760b;margin-bottom:16px}.auth-shell{min-height:100vh;display:grid;grid-template-columns:minmax(320px,1fr) minmax(320px,480px);gap:6vw;padding:5vw 7vw;background:linear-gradient(140deg,#133573 0%,#173c7a 46%,#f4f6ff 46.2%,#e6edff 100%)}.auth-identity{align-self:center;color:white}.auth-identity h1{font-size:clamp(32px,4vw,55px);margin:14px 0 9px}.auth-identity p{color:#dfe9ff}.auth-identity .overline{color:#c1dcff}.auth-identity .auth-note{color:#cadbff}.disclaimer{font-size:12px;margin-top:32px}.emblem{width:74px;height:74px;display:grid;place-items:center;background:linear-gradient(140deg,#e7f2ff,#a9d2ff);border:3px solid #ffffff7d;color:#163879;font-size:49px;font-weight:900;border-radius:22px;box-shadow:0 18px 45px #09182b34}.auth-card{align-self:center;background:#fff;border-radius:22px;padding:26px;box-shadow:0 22px 65px #061f5540}.segmented{display:flex;gap:5px;flex-wrap:wrap;background:#eef3fc;padding:5px;border-radius:12px;margin-bottom:22px}.tab{flex:1 1 110px;border:0;background:transparent;padding:10px 7px;border-radius:9px;color:#536582;font-weight:700;font-size:12px}.tab.active{background:#fff;box-shadow:0 2px 8px #1c3d6920;color:#124c9b}.form-grid{display:grid;gap:15px}.form-grid h2{margin:0}.password{display:flex;gap:5px}.password .small{width:70px;background:#e9eff9;border:0;border-radius:9px;font-size:12px;color:#385981;font-weight:750}.primary{background:linear-gradient(135deg,#1960b8,#3b8be1);border:0;color:white;font-weight:750;border-radius:10px;min-height:43px;padding:10px 18px}.secondary{background:#e9f1fe;border:1px solid #c7defb;color:#184c91;border-radius:10px;padding:9px 14px;font-weight:700}.danger{background:#fce6eb;border:1px solid #efbac5;color:#a82039;border-radius:9px;padding:9px 14px;font-weight:700}.outline{background:#ffffff17;border:1px solid #ffffff6b;color:#fff;border-radius:9px;padding:8px 13px;font-weight:700}.full{width:100%}.warning{border:1px solid #f7cf79;background:#fff5df;padding:12px;color:#845b0b;border-radius:10px;margin-top:12px;font-size:13px}.app-shell{display:flex;min-height:100vh}.sidebar{position:fixed;left:0;top:0;bottom:0;width:255px;background:linear-gradient(170deg,#1d4484,#123166 75%);color:white;display:flex;flex-direction:column;z-index:10}.brand{display:flex;align-items:center;gap:11px;padding:25px 17px}.brand strong{display:block;font-size:17px}.brand small{font-size:10px;color:#a5c3f7}.small-emblem{width:42px;height:42px;font-size:30px;border-radius:13px}.user-card{background:#ffffff12;border:1px solid #ffffff1c;padding:13px;margin:0 12px 20px;border-radius:12px;font-size:13px}.user-card .role{font-size:11px;color:#b1cafa;margin-top:5px}.navigation{display:flex;flex-direction:column;gap:4px;padding:0 11px}.nav-btn{text-align:left;background:transparent;border:0;border-radius:10px;color:#c5d7f6;padding:12px 14px;font-weight:650;font-size:13px}.nav-btn.active,.nav-btn:hover{background:#4287e6;color:white}.sidebar-bottom{margin-top:auto;padding:20px;font-size:11px;color:#bfd1f0;line-height:2.4}.main{margin-left:255px;flex:1;min-width:0}.topbar{background:white;padding:23px 30px;display:flex;align-items:center;gap:17px;justify-content:space-between;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:2}.topbar h1{font-size:22px;margin:0}.role-pill{font-size:12px;font-weight:800;border-radius:99px;padding:9px 13px;background:#ecf3ff;color:#1b55ac}.menu-toggle{display:none;border:0;background:#e9f1ff;color:#1d4d8d;font-size:22px;border-radius:8px;width:42px;height:42px}.view{max-width:1250px;padding:24px 30px}.footer{color:#7789a3;font-size:11px;padding:8px 30px 30px}.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}.kpi{background:white;border:1px solid #dfe8f7;border-radius:16px;padding:20px;box-shadow:0 9px 22px #123c700a}.kpi strong{font-size:24px;color:#194779;display:block}.kpi small{color:#6d7b90;font-weight:650}.row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.two-col{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.three-col{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.form-rows{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.span2{grid-column:span 2}.table-wrap{overflow-x:auto}.grid-table{width:100%;border-collapse:collapse;font-size:13px;min-width:540px}.grid-table th{background:#f2f6fd;color:#61738e;text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.5px}.grid-table th,.grid-table td{padding:11px 12px;border-bottom:1px solid #e8edf5}.grid-table td:last-child{text-align:left}.tag{font-size:11px;padding:5px 8px;border-radius:7px;background:#eaf2ff;color:#20519a;font-weight:750;display:inline-flex}.tag.good{background:#e4f9ee;color:#166b45}.tag.pending{background:#fff0cf;color:#996216}.tag.bad{background:#ffe7ed;color:#a7223d}.grade-red{color:#c51b35!important;font-weight:800}.grade-black{color:#000!important;font-weight:800}.subject-row{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #e9eef8;padding:10px 0;gap:10px}.subject-row small{color:#6d7a90}.tabs{display:flex;gap:7px;flex-wrap:wrap;margin:0 0 16px}.mini-tab{background:white;border:1px solid #dbe4f3;padding:8px 14px;border-radius:10px;color:#3e5574;font-weight:700}.mini-tab.active{background:#2c73d0;color:#fff}.notice{border-left:4px solid #4d87df;background:#f1f6ff;border-radius:5px;padding:12px 14px;margin-bottom:12px;color:#294e81;font-size:13px}.student-theme{--navy:#563397}.student-theme .sidebar{background:linear-gradient(160deg,#6b4bb8,#402b79)}.student-theme .role-pill{background:#f0eaff;color:#663fb0}.student-theme .nav-btn.active,.student-theme .nav-btn:hover{background:#8e70d2}.student-theme .kpi strong{color:#603bb0}.adviser-theme .sidebar{background:linear-gradient(160deg,#117e78,#105d64)}.adviser-theme .nav-btn.active,.adviser-theme .nav-btn:hover{background:#19a59a}.teacher-theme .sidebar{background:linear-gradient(160deg,#1b8060,#1f554c)}.teacher-theme .nav-btn.active,.teacher-theme .nav-btn:hover{background:#369a7c}.principal-theme .sidebar{background:linear-gradient(160deg,#303f71,#202b56)}.empty{padding:23px;color:#7c8aa2;border:1px dashed #c9d5e7;border-radius:10px;text-align:center}.toolbar{display:flex;gap:9px;flex-wrap:wrap;margin-bottom:14px}.toolbar select{max-width:240px}.fieldset{border:1px solid #e2eaf4;border-radius:12px;padding:13px;margin:0 0 12px}.fieldset legend{font-weight:750;font-size:13px}.status-text{font-size:12px;color:#667894}.details{font-size:12px;color:#50688c}.check-label{display:flex;flex-direction:row;align-items:center}.check-label input{width:auto;min-height:auto}.form-footer{display:flex;gap:10px;justify-content:flex-start;margin-top:8px}.error-note{color:#a51d34;font-size:13px}.success-note{color:#176c52;font-size:13px}
@media(max-width:1100px){.kpi-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:780px){.auth-shell{grid-template-columns:1fr;gap:15px;padding:23px 14px;background:linear-gradient(160deg,#183d7a 0%,#1c4c94 31%,#eff4ff 31.2%)}.auth-identity{padding:5px 12px}.auth-identity h1{font-size:28px}.auth-identity .emblem{width:55px;height:55px;font-size:37px}.auth-identity .disclaimer{display:none}.auth-card{padding:18px}.sidebar{transform:translateX(-105%);transition:transform .2s;box-shadow:6px 0 35px #102b5655}.sidebar.open{transform:translateX(0)}.main{margin-left:0}.menu-toggle{display:block}.topbar{padding:17px;gap:10px}.topbar h1{font-size:19px}.role-pill{font-size:10px;padding:7px}.view{padding:16px}.footer{padding:10px 16px 25px}.form-rows,.two-col,.three-col{grid-template-columns:1fr}.span2{grid-column:auto}}@media(max-width:400px){.kpi-grid{gap:8px}.kpi{padding:12px}.kpi strong{font-size:21px}.nav-btn{padding:9px 10px}}

/* GNHS v3.6: distinguish emergency contact section. */
.form-subheading {padding:10px 12px;border-left:4px solid #851e3a;background:#fff4f6;font-weight:700;color:#681e33;border-radius:6px;}
.sensitive-info {border:1px solid #d5aebb;background:#fffafa;overflow-wrap:anywhere;}


/* Hybrid input: larger tap targets on touchscreen PCs, tablets and phones.
   Mouse and keyboard operation remains unchanged. */
button, a, select, summary, [role="button"] { touch-action: manipulation; }
.table-wrap { -webkit-overflow-scrolling: touch; }
button:focus-visible, a:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid #ad385b;
  outline-offset: 2px;
}
@media (any-pointer: coarse) {
  button, .nav-btn, .mini-tab, .tab, .menu-toggle,
  [role="button"], summary { min-height: 46px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 46px; }
  input[type="checkbox"], input[type="radio"] {
    width: 20px; height: 20px; min-width: 20px; min-height: 20px;
    accent-color: #7d2040;
  }
  .nav-btn { padding-top: 12px; padding-bottom: 12px; }
  .grid-table th, .grid-table td { padding-top: 13px; padding-bottom: 13px; }
}


/* Keep Sign Out reachable on short screens and long staff menus. */
.sidebar {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
}
.sidebar > .brand,
.sidebar > .user-card,
.sidebar > .sidebar-bottom {
  flex-shrink: 0;
}
.sidebar > .navigation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-bottom: 12px;
}
.sidebar > .navigation > .nav-btn {
  flex-shrink: 0;
}
.sidebar > .sidebar-bottom {
  margin-top: 0;
  padding: 10px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,.25);
  background: rgba(32, 6, 22, .28);
  font-size: 11px;
  line-height: 1.4;
}
.sidebar #logout {
  display: block;
  margin-top: 6px;
  width: 100%;
  min-height: 46px;
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid rgba(255,255,255,.65);
  background: rgba(255,255,255,.16);
  color: #fff;
}
.sidebar #logout:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Accessible notification buttons and compact message previews. */
.auth-notification-zone{display:flex;justify-content:flex-end;margin-bottom:8px}
.notification-bell{position:relative;flex:0 0 auto;min-width:44px;min-height:44px;border:1px solid #d0def2;background:#f5f8ff;color:#1d4e8e;border-radius:12px;font-size:22px;display:inline-flex;align-items:center;justify-content:center}
.notification-bell:focus-visible{outline:3px solid #3b8be1;outline-offset:2px}
.notification-bell-count{position:absolute;right:-6px;top:-8px;min-width:20px;height:20px;padding:2px 4px;line-height:16px;text-align:center;border-radius:999px;background:#c12743;color:#fff;font-size:11px;font-weight:800;border:2px solid white}
.notification-bell-count[hidden]{display:none}
.topbar-identity{display:flex;align-items:center;gap:9px}
.announcement-entry{border:1px solid #dfe7f3;border-radius:12px;padding:13px;margin:0 0 11px;background:#fff}
.announcement-summary{display:flex;align-items:center;justify-content:space-between;gap:12px}
.announcement-summary-text{min-width:0;overflow-wrap:anywhere}
.announcement-summary .secondary{white-space:nowrap}
.announcement-unread-label{font-size:11px;font-weight:750;color:#9b1e37;display:inline-block;margin-top:5px}
.announcement-detail{border-top:1px solid #e3e9f2;margin-top:10px;padding-top:12px;overflow-wrap:anywhere}
@media(max-width:480px){.topbar-identity{gap:5px}.notification-bell{min-width:42px;min-height:42px}.announcement-entry{padding:10px}.announcement-summary{gap:7px}}

.auth-shell{position:relative}
.auth-notification-zone{position:absolute;top:16px;right:20px;z-index:6}
@media(max-width:780px){.auth-notification-zone{top:12px;right:14px}}

.section-password-dialog { border: 1px solid #e4cbd3; border-radius: 18px; padding: 24px; width: min(440px, calc(100vw - 32px)); max-height: 90dvh; overflow: auto; }
.section-password-dialog::backdrop { background: rgb(25 10 16 / .5); }
.section-password-dialog h2, .section-password-dialog p { margin: 0; }
#sectionPasswordError { color: #a21c35; }
@media (max-width: 600px) {
 .section-directory .table-wrap { overflow: visible; }
 .section-directory .grid-table, .section-directory tbody { display: block; min-width: 0; width: 100%; }
 .section-directory thead { display: none; }
 .section-directory tr { display: grid; grid-template-columns: 1fr; border: 1px solid #eadce1; border-radius: 12px; margin: 12px 0; padding: 12px; }
 .section-directory td { display: block; white-space: normal; overflow-wrap: anywhere; border: 0; padding: 6px 0; }
 .section-directory td:nth-child(2)::before { content: 'Adviser: '; font-weight: 600; }
 .section-directory td:nth-child(3)::before { content: 'Enrolled / Capacity: '; font-weight: 600; }
 .section-directory td:nth-child(4)::before { content: 'Subjects: '; font-weight: 600; }
 .section-directory [data-edit-section] { float: right; }
}

.section-directory [data-edit-section], .section-directory [data-delete-section] { margin: 4px; }

.auth-shell.session-recovery #loginForm,
.auth-shell.session-recovery #staffRegisterForm,
.auth-shell.session-recovery #activateForm,
.auth-shell.session-recovery [data-auth-tab] { display: none !important; }
#loginConnectionNotice button { margin: 6px 6px 0 0; }
