:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --navy: #142c49;
  --blue: #2f78b9;
  --blue-dark: #225f96;
  --blue-soft: #eaf4fb;
  --sky: #d8ebf7;
  --ink: #172538;
  --muted: #6d7f95;
  --line: #d8e3ed;
  --paper: #ffffff;
  --background: #f3f7fb;
  box-sizing: border-box;
}

*, *::before, *::after { box-sizing: inherit; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--background); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.portal-boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.portal-boot span { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 18px; color: white; background: var(--blue); font-size: calc(var(--text-title) * var(--list-text-scale, 1)); font-weight: 900; box-shadow: 0 14px 30px #2f78b933; }
.portal-boot p { margin: 0; }

.login-page { position: relative; isolation: isolate; min-height: 100vh; display: grid; grid-template-columns: minmax(430px, 1.08fr) minmax(460px, .92fr); grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; color: white; background: radial-gradient(circle at 82% 14%, #58b9e733 0 15%, transparent 38%), linear-gradient(125deg, #0d2e53 0%, #15598c 48%, #39a1d3 100%); }
.login-page::before { position: absolute; z-index: -1; inset: 0; background: linear-gradient(105deg, #071d386e 0 38%, transparent 70%); content: ""; pointer-events: none; }
.login-brand-panel { position: relative; display: flex; min-height: 0; flex-direction: column; overflow: hidden; padding: 48px clamp(38px, 6vw, 92px) 24px; color: white; }
.portal-brand { display: inline-flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.portal-brand > span { display: grid; width: 48px; height: 48px; place-items: center; border: 2px solid #ffffff72; border-radius: 15px; background: #ffffff17; font-size: calc(var(--text-section) * var(--list-text-scale, 1)); font-weight: 950; }
.portal-brand div { display: grid; }
.portal-brand strong { font-size: calc(var(--text-title) * var(--list-text-scale, 1)); letter-spacing: -.04em; }
.portal-brand small { opacity: .75; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 700; }
.login-copy { position: relative; z-index: 1; max-width: 720px; margin: auto 0; padding: clamp(58px, 9vh, 100px) 0 46px; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.login-copy .eyebrow { max-width: 690px; color: white; font-size: clamp(calc(var(--text-title) * 1.55), 4vw, calc(var(--text-title) * 2.3)); font-weight: 850; letter-spacing: -.055em; line-height: .98; text-transform: none; }
.login-copy h1 { margin: 0; }
.login-copy > p { max-width: 620px; margin: 25px 0 0; color: #e5f5ff; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); line-height: 1.65; }
.login-benefits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.5vw, 34px); max-width: 700px; margin-top: 38px; }
.login-benefit { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; color: #f2f9fe; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 750; line-height: 1.35; }
.login-benefit-icon { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid #ffffff4d; border-radius: 50%; background: #ffffff13; box-shadow: inset 0 1px 0 #ffffff22; }
.login-benefit-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-decoration { position: absolute; z-index: 0; right: -115px; bottom: -165px; width: 470px; height: 470px; border: 1px solid #ffffff24; border-radius: 50%; pointer-events: none; }
.login-decoration span { position: absolute; inset: 58px; border: 1px solid #ffffff2b; border-radius: 50%; }
.login-decoration span:nth-child(2) { inset: 115px; }
.login-decoration span:nth-child(3) { inset: 172px; background: #ffffff18; }
.login-form-panel { position: relative; display: grid; grid-column: 2; grid-row: 1 / span 2; min-height: 100vh; place-items: center; padding: 52px clamp(32px, 5vw, 86px) 52px 24px; }
.login-form-panel::before, .login-form-panel::after { position: absolute; width: min(76%, 520px); height: min(68%, 590px); border: 1px solid #ffffff2c; border-radius: 36px; background: #ffffff13; content: ""; pointer-events: none; }
.login-form-panel::before { transform: translate(22px, -8px) rotate(3deg); }
.login-form-panel::after { transform: translate(-18px, 16px) rotate(-3deg); }
.login-card { position: relative; z-index: 1; width: min(100%, 540px); border: 1px solid #ffffffd9; border-radius: 30px; padding: clamp(32px, 4vw, 54px); color: var(--ink); background: #fffffff7; box-shadow: 0 34px 85px #061b355c, 0 2px 0 #ffffff inset; backdrop-filter: blur(12px); }
.login-card-heading { margin-bottom: 28px; }
.login-symbol { display: grid; width: 52px; height: 52px; margin-bottom: 25px; place-items: center; border-radius: 15px; color: white; background: linear-gradient(145deg, var(--blue-dark), #2f91cd); font-size: calc(var(--text-section) * var(--list-text-scale, 1)); box-shadow: 0 10px 22px #2f78b933; }
.login-card h2 { margin: 0; font-size: clamp(calc(var(--text-section) * var(--list-text-scale, 1)), 2.2vw, calc(var(--text-title) * 1.45)); letter-spacing: -.045em; }
.login-card-heading > p:last-child { margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.login-card .portal-field input { min-height: 54px; background: #f5f9fc; }
.login-card > .portal-button { width: 100%; min-height: 54px; margin-top: 6px; }
.portal-field { display: grid; gap: 8px; margin-bottom: 18px; }
.portal-field > span, .portal-date-panel label span { color: #53687e; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.portal-field input, .portal-field textarea, .portal-date-panel input { width: 100%; border: 1px solid #cbd9e5; border-radius: 13px; outline: none; padding: 14px 15px; color: var(--ink); background: white; transition: border .2s, box-shadow .2s; }
.portal-field textarea { resize: vertical; line-height: 1.5; }
.portal-field input:focus, .portal-field textarea:focus, .portal-date-panel input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px #2f78b91a; }
.portal-button { display: flex; min-height: 49px; align-items: center; justify-content: center; border: 0; border-radius: 13px; padding: 0 24px; cursor: pointer; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .035em; text-decoration: none; }
.portal-button.primary { color: white; background: var(--blue); box-shadow: 0 10px 24px #2f78b92b; }
.portal-button.primary:hover { background: var(--blue-dark); }
.portal-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.portal-button.admin { border: 1px solid #bdd1e1; color: var(--navy); background: #f2f7fb; }
.portal-button.subtle { border: 1px solid #cbd9e5; color: var(--navy); background: white; }
.admin-divider { display: flex; align-items: center; gap: 12px; margin: 25px 0 15px; color: #8b9bad; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.admin-divider::before, .admin-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }

.teacher-portal { min-height: 100vh; }
.portal-header { position: sticky; z-index: 10; top: 0; display: flex; min-height: 76px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 clamp(20px, 4vw, 64px); color: var(--navy); background: #ffffffed; backdrop-filter: blur(15px); }
.portal-brand.compact > span { width: 42px; height: 42px; border: 0; color: white; background: var(--blue); font-size: calc(var(--text-section) * var(--list-text-scale, 1)); }
.portal-brand.compact strong { font-size: calc(var(--text-title) * var(--list-text-scale, 1)); }
.portal-brand.compact small { color: var(--muted); }
.portal-header-actions { display: flex; align-items: center; gap: 11px; }
.scope-badge { border-radius: 999px; padding: 8px 12px; color: var(--blue-dark); background: var(--blue-soft); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.logout-button { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--navy); background: white; cursor: pointer; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 800; }
.portal-content { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 80px; }
.teacher-welcome { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.teacher-avatar { display: grid; width: 70px; height: 70px; flex: 0 0 auto; place-items: center; border-radius: 21px; color: white; background: var(--blue); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 900; box-shadow: 0 12px 25px #2f78b92a; }
.teacher-welcome h1 { margin: 0; font-size: calc(var(--text-title) * var(--list-text-scale, 1)); letter-spacing: -.05em; }
.teacher-profile-copy { min-width: 0; flex: 1; }
.teacher-profile-copy > .teacher-profile-email { margin: 6px 0 0; color: var(--muted); }
.change-password-button { flex: 0 0 auto; margin-left: auto; border: 1px solid #1f649a; border-radius: 12px; padding: 13px 17px; color: white; background: var(--blue); box-shadow: 0 9px 22px #2f78b927; cursor: pointer; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .055em; }
.change-password-button:hover { background: var(--blue-dark); }
.password-panel { display: grid; grid-template-columns: minmax(250px, 1.2fr) repeat(3, minmax(170px, .75fr)) auto; align-items: end; gap: 15px; margin: -7px 0 28px 90px; border: 1px solid #bad7e9; border-radius: 17px; padding: 18px; background: #edf7fc; box-shadow: 0 10px 28px #1f659514; }
.password-panel h2 { margin: 0; font-size: calc(var(--text-title) * var(--list-text-scale, 1)); letter-spacing: -.03em; }
.password-panel > div:first-child > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.password-panel .portal-field { margin: 0; }
.password-actions { display: flex; gap: 8px; }
.password-actions .portal-button { min-height: 45px; padding: 0 14px; white-space: nowrap; }
.portal-date-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.portal-active-date-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid #4b8abe; border-radius: 16px; color: white; background: linear-gradient(135deg, #173a60, var(--blue)); box-shadow: 0 14px 35px #2f78b926; }
.portal-active-date-trigger { display: grid; width: 100%; min-height: 78px; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 10px; border: 0; padding: 11px 14px; color: inherit; background: transparent; cursor: pointer; }
.portal-active-date-trigger:hover { background: #ffffff12; }
.portal-active-date-trigger:focus-visible { outline: 3px solid #ffffffe8; outline-offset: -5px; }
.portal-active-date-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 13px; background: #ffffff18; }
.portal-active-date-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.portal-active-date-copy { display: grid; min-width: 0; justify-items: center; gap: 3px; text-align: center; }
.portal-active-date-copy > span { color: currentColor; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 850; letter-spacing: .12em; opacity: .8; text-transform: uppercase; }
.portal-active-date-copy strong { overflow: hidden; font-size: calc(var(--text-section) * var(--list-text-scale, 1)); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.portal-active-date-chevron { display: grid; width: 48px; height: 48px; place-items: center; font-size: calc(var(--text-title) * var(--list-text-scale, 1)); line-height: 1; }
.portal-active-date-input { position: absolute; right: auto; bottom: 0; left: 50%; width: min(340px, calc(100% - 24px)) !important; height: 1px; min-height: 0 !important; border: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; transform: translateX(-50%); }
.portal-date-panel.has-date-warning .portal-active-date-card { border-color: #c99012; color: #3f3000; background: linear-gradient(135deg, #ffe58a, #f4c646); box-shadow: 0 12px 30px #a6740033; }
.portal-date-panel.has-date-warning .portal-active-date-icon { background: #5e43001c; }
.portal-date-panel.has-date-warning .portal-active-date-trigger:hover { background: #5e430014; }
.portal-date-panel.has-date-warning .portal-active-date-trigger:focus-visible { outline-color: #483400e0; }
.portal-active-date-reset { justify-self: center; max-width: 100%; border: 1px solid #d6a52b; border-radius: 999px; padding: 7px 16px; color: #5b4100; background: #fff2b8; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 800; line-height: 1.35; text-align: center; white-space: normal; cursor: pointer; }
.portal-active-date-reset:hover, .portal-active-date-reset:focus-visible { border-color: #b47f00; background: #ffe799; }
.portal-absence-history { overflow: hidden; margin-top: 18px; border: 1px solid #acd2ea; border-radius: 18px; background: white; box-shadow: 0 9px 24px #1d42600d; }
.portal-absence-history-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 24px; padding: 17px 22px; color: var(--navy); background: #edf7fc; }
.portal-absence-history-title { display: flex; align-items: center; gap: 9px; }
.portal-absence-history-title h2 { margin: 0; font-size: calc(var(--text-title) * var(--list-text-scale, 1)); font-weight: 750; letter-spacing: -.025em; }
.portal-absence-history-header > p { margin: 0; color: #416784; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 800; text-align: right; }
.portal-history-toggle { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid #9cc9e5; border-radius: 8px; color: #236b9f; background: white; cursor: pointer; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 900; line-height: 1; }
.portal-history-toggle:hover { background: #dff1fb; }
.portal-history-collapse-icon { display: none; }
.portal-absence-history.expanded .portal-history-collapse-icon { display: inline; }
.portal-absence-history.expanded .portal-history-expand-icon { display: none; }
.portal-absence-history-table-wrap { overflow-x: auto; border-top: 1px solid #cde2ef; }
.portal-absence-history-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.portal-absence-history-table th { padding: 13px 20px; color: #566b80; background: #f7fafc; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
.portal-absence-history-table th:first-child, .portal-absence-history-table td:first-child { width: 20%; }
.portal-absence-history-table th:nth-child(2), .portal-absence-history-table td:nth-child(2) { width: 14%; text-align: center; }
.portal-absence-history-table th:last-child, .portal-absence-history-table td:last-child { width: 28%; text-align: center; }
.portal-absence-history-table th button { display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.portal-absence-history-table th button span { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 7px; color: #2874aa; background: #e3f2fb; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); }
.portal-absence-history-table td { border-top: 1px solid #e0eaf1; padding: 14px 20px; color: var(--navy); font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 750; }
.portal-absence-history-table tbody tr:hover td { background: #f8fbfd; }
.portal-absence-history-status { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; border-radius: 999px; padding: 0 12px; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 850; }
.portal-absence-history-status.justified { color: #246c49; background: #e1f4e8; }
.portal-absence-history-status.pending { color: #8b5a19; background: #fff0c9; }
.portal-absence-history-empty { padding: 28px 20px; color: var(--muted); text-align: center; }
.portal-absence-history.has-pending { border-color: #e7aaa5; background: #fff9f8; }
.portal-absence-history.has-pending .portal-absence-history-header { color: #7a3732; background: #fbe7e5; }
.portal-absence-history.has-pending .portal-absence-history-header > p { color: #9b4841; }
.portal-absence-history.has-pending .portal-history-toggle { border-color: #dfa29d; color: #a43f38; background: #fff8f7; }
.portal-absence-history.has-pending .portal-absence-history-table-wrap { border-top-color: #edc3bf; }
.portal-absence-history.has-pending .portal-absence-history-table th { color: #81514d; background: #fff1ef; }
.portal-absence-history.has-pending .portal-absence-history-table td { border-top-color: #f0d2cf; background: #fffafa; }
.portal-absence-history.has-pending .portal-absence-history-table tbody tr:hover td { background: #fff3f1; }
.portal-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 45px 0 19px; }
.portal-section-heading h2 { margin: 0; font-size: calc(var(--text-title) * var(--list-text-scale, 1)); letter-spacing: -.035em; }
.portal-section-heading p:last-child { margin: 8px 0 0; color: var(--muted); }
.portal-schedule { display: grid; gap: 12px; }
.portal-class-card { overflow: hidden; border: 1px solid var(--line); border-left: 5px solid var(--class-color, #68afe0); border-radius: 17px; background: white; box-shadow: 0 5px 18px #1e45650b; transition: border .2s, box-shadow .2s, transform .2s; }
.portal-class-card.selected { border-color: #8fc2e1; border-left-color: var(--class-color, var(--blue)); box-shadow: 0 12px 28px #286fa719; }
.portal-class-card.registered { border-color: #88c8a1; border-left-color: #3f9662; background: #e8f6ec; box-shadow: 0 7px 20px #397f5415; }
.portal-class-card.registered .class-selector { background: #e8f6ec; }
.portal-class-card.registered.selected { border-color: #69b487; border-left-color: #2f8452; box-shadow: 0 12px 28px #397f5424; }
.portal-class-card.registered.selected .class-selector { background: #dff2e5; }
.portal-class-card.center-availability-card { border-color: #79bd93; border-left-color: #2f9560; background: #f0faf4; box-shadow: 0 7px 20px #2f845218; }
.portal-class-card.center-availability-card .class-selector { background: #f0faf4; cursor: default; }
.portal-class-card.center-availability-card .class-action { color: #176a43; background: #d9f2e3; }
.portal-class-card.cultural-outing-availability-card { border-color: #b99ad7; border-left-color: #8051b5; background: #f8f3fc; box-shadow: 0 7px 20px #6b3e9118; }
.portal-class-card.cultural-outing-availability-card .class-selector { background: #f8f3fc; }
.portal-class-card.cultural-outing-availability-card .class-action { color: #6b3598; background: #eadcf6; white-space: normal; line-height: 1.2; text-align: center; }
.portal-class-card.cultural-outing-availability-card .center-availability-details { border-top-color: #ddcceb; color: #694785; background: #fbf8fd; }
.portal-class-card.cultural-outing-availability-card .center-availability-details strong { color: #6b3598; }
.center-availability-details { display: grid; gap: 3px; border-top: 1px solid #c7e6d2; padding: 13px 20px; color: #426a53; background: #f6fcf8; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.center-availability-details strong { color: #177247; }
.portal-class-card.invalid { border-color: #c85959; }
.class-selector { display: grid; width: 100%; grid-template-columns: 34px 140px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 17px 20px; text-align: left; color: inherit; background: transparent; }
.class-slot-selection { position: relative; display: grid; width: 30px; height: 30px; place-items: center; cursor: pointer; }
.class-slot-selection input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.class-slot-selection span { display: grid; width: 28px; height: 28px; place-items: center; border: 2px solid #b7c9d8; border-radius: 9px; color: transparent; background: white; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 950; transition: border-color .18s, color .18s, background .18s, box-shadow .18s; }
.class-slot-selection input:focus-visible + span { box-shadow: 0 0 0 4px #2f78b91f; }
.class-slot-selection input:checked + span { border-color: var(--blue); color: white; background: var(--blue); }
.class-slot-selection input:disabled + span { cursor: not-allowed; background: #edf1f4; opacity: .48; }
.class-time { color: #526b82; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 850; }
.class-information { display: grid; gap: 4px; }
.class-information strong { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.class-information small { color: var(--muted); }
.assigned-substitute-message { max-width: 280px; color: #236b49; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 850; line-height: 1.35; text-align: right; }
.assigned-coverage-message { display: grid; max-width: 310px; justify-items: end; gap: 2px; color: #236b49; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); line-height: 1.35; text-align: right; }
.assigned-coverage-message strong { font-weight: 900; }
.assigned-coverage-message small { color: #547363; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 750; }
.assigned-coverage-details { display: grid; gap: 3px; border-top: 1px solid #c7e6d2; padding: 13px 20px; color: #315d45; background: #f2faf5; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.assigned-coverage-details strong { color: #23734b; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.class-action { border-radius: 999px; padding: 8px 11px; color: var(--blue-dark); background: var(--blue-soft); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 850; }
.requested .class-action { color: #23734b; background: #e5f5ec; }
.class-row-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.class-status-stack { display: grid; justify-items: end; gap: 6px; }
.class-work-editor { display: none; grid-template-columns: 1fr 280px; gap: 18px; border-top: 1px solid #cfe4f2; padding: 18px 20px; background: #f4f9fd; }
.portal-class-card.selected .class-work-editor { display: grid; }
.class-work-editor .portal-field { margin: 0; }
.attachment-field { display: grid; align-content: center; justify-items: start; gap: 6px; border: 1px dashed #90bad8; border-radius: 13px; padding: 14px; cursor: pointer; background: white; }
.attachment-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attachment-field span { color: var(--blue-dark); font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 900; }
.attachment-field small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); text-overflow: ellipsis; white-space: nowrap; }
.attachment-field[hidden] { display: none; }
.attachment-picker-list { display: grid; gap: 7px; }
.attachment-limit { color: var(--muted); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 750; }
.existing-attachment-list { display: grid; gap: 5px; }
.existing-attachment-list .remove-attachment-option { border: 1px solid #d8e4ed; border-radius: 9px; padding: 7px 9px; background: #f8fbfd; }
.existing-attachment-list .remove-attachment-option span { color: #a23c35; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 900; }
.work-help { grid-column: 1 / -1; margin: -7px 0 10px; color: var(--muted); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); }
.existing-work { display: none; border-top: 1px solid #d9eee2; padding: 12px 20px; color: #4b6f5a; background: #f4fbf7; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.portal-class-card.selected .existing-work { display: block; }
.existing-work p { margin: 4px 0; }
.existing-work a { color: #246fa8; font-weight: 800; }
.managed-request-note { display: block; margin-top: 7px; color: var(--muted); font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); }
.existing-request-editor { display: none; border-top: 1px solid #cfe4f2; padding: 18px 20px; background: #f4f9fd; }
.portal-class-card.selected .existing-request-editor { display: block; }
.guard-assignment-editor { display: none; border-top: 1px solid #f0d3bc; padding: 18px 20px; background: #fff9f4; }
.portal-class-card.selected .guard-assignment-editor { display: block; }
.guard-assignment-fields { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.5fr); align-items: end; gap: 18px; }
.guard-type-options { display: flex; align-items: center; gap: 9px; min-width: 0; margin: 0; border: 0; padding: 0; }
.guard-type-options legend { width: 100%; margin-bottom: 8px; color: #9c4d19; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.guard-type-option { position: relative; display: grid; flex: 1; cursor: pointer; }
.guard-type-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.guard-type-option span { display: grid; min-height: 44px; place-items: center; border: 1px solid #e1b994; border-radius: 11px; color: #a24e17; background: white; font-size: calc(var(--text-body) * var(--list-text-scale, 1)); font-weight: 900; letter-spacing: .045em; }
.guard-type-option input:checked + span { border-color: #d06b24; color: white; background: #dc762e; box-shadow: 0 7px 18px #d36e2526; }
.guard-type-option input:focus-visible + span { box-shadow: 0 0 0 4px #df7b3024; }
.guard-observations-field { margin: 0; }
.guard-observations-field > span { color: #9c4d19; }
.guard-observations-field textarea { min-height: 78px; border-color: #e3c4aa; }
.request-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 17px; }
.request-editor-grid .portal-field { margin: 0; }
.request-editor-side { display: grid; align-content: start; gap: 9px; }
.remove-attachment-option { display: flex; align-items: center; gap: 8px; color: #6e4d49; font-size: calc(var(--text-secondary) * var(--list-text-scale, 1)); font-weight: 750; }
.portal-schedule-reason { margin-bottom: 14px; border: 1px solid #b9d8eb; border-radius: 17px; padding: 18px 20px; background: #edf7fc; box-shadow: 0 7px 20px #1d42600d; }
.portal-schedule-reason .portal-field { margin: 0; }
.portal-request-submit { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 22px; border: 1px solid #b8d6e8; border-radius: 19px; padding: 20px 22px; background: white; box-shadow: 0 9px 25px #1d42600d; }
.portal-request-submit > div { display: grid; gap: 5px; }
.portal-request-submit strong { color: var(--navy); font-size: calc(var(--text-body) * var(--list-text-scale, 1)); }
.portal-request-submit small { color: var(--muted); }
.portal-submit-request { min-width: 230px; }
.portal-empty { display: grid; justify-items: center; border: 1px dashed #bdd0df; border-radius: 20px; padding: 48px 20px; text-align: center; background: white; }
.portal-empty span { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 15px; color: var(--blue); background: var(--blue-soft); font-size: calc(var(--text-section) * var(--list-text-scale, 1)); }
.portal-empty h3 { margin: 14px 0 5px; }
.portal-empty p { margin: 0; color: var(--muted); }
.portal-toast { position: fixed; z-index: 50; left: 50%; bottom: 22px; width: min(440px, calc(100vw - 44px)); border-radius: 14px; padding: 15px 18px; color: white; background: #236b49; box-shadow: 0 18px 45px #10294035; opacity: 0; pointer-events: none; text-align: center; transform: translate(-50%, 15px); transition: .25s; }
.portal-toast.show { opacity: 1; transform: translate(-50%, 0); }
.portal-toast.error { background: #783d38; }

@media (max-width: 850px) {
  .login-page { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow: visible; }
  .login-brand-panel { min-height: auto; padding: 28px 24px 16px; }
  .login-copy { max-width: none; padding: 52px 0 20px; }
  .login-copy .eyebrow { max-width: 620px; font-size: clamp(calc(var(--text-title) * 1.4), 8vw, calc(var(--text-title) * 2)); }
  .login-benefits { max-width: none; }
  .login-form-panel { grid-column: 1; grid-row: 2; min-height: auto; padding: 30px 18px 38px; }
  .login-form-panel::before, .login-form-panel::after { width: min(82%, 500px); height: calc(100% - 80px); }
  .login-footer { grid-column: 1; grid-row: 3; }
  .portal-date-panel { grid-template-columns: 1fr; }
  .portal-absence-history-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .portal-absence-history-header > p { text-align: left; }
  .class-selector { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px 12px; }
  .class-slot-selection { grid-column: 1; grid-row: 1 / span 2; }
  .class-time, .class-information { grid-column: 2; }
  .class-row-controls { grid-column: 3; grid-row: 1 / span 2; align-self: center; align-items: flex-end; flex-direction: column; }
  .class-work-editor { grid-template-columns: 1fr; }
  .password-panel { grid-template-columns: 1fr 1fr; margin-left: 0; }
  .password-panel > div:first-child, .password-actions { grid-column: 1 / -1; }
  .request-editor-grid { grid-template-columns: 1fr; }
  .guard-assignment-fields { grid-template-columns: 1fr; }
  .work-help { grid-column: auto; }
}

@media (max-width: 560px) {
  .login-copy { padding-top: 38px; }
  .login-copy > p { margin-top: 18px; }
  .login-benefits { grid-template-columns: 1fr; gap: 12px; margin-top: 26px; }
  .login-benefit { grid-template-columns: 40px minmax(0, 1fr); }
  .login-benefit-icon { width: 40px; height: 40px; }
  .login-form-panel { padding-inline: 14px; }
  .login-form-panel::before, .login-form-panel::after { display: none; }
  .login-card { border-radius: 24px; padding: 28px 22px; }
  .scope-badge { display: none; }
  .portal-content { width: min(100% - 24px, 1180px); padding-top: 25px; }
  .teacher-avatar { width: 57px; height: 57px; border-radius: 17px; }
  .teacher-welcome h1 { font-size: calc(var(--text-title) * var(--list-text-scale, 1)); }
  .teacher-welcome { flex-wrap: wrap; }
  .change-password-button { margin-left: auto; }
  .portal-absence-history-table { min-width: 520px; }
  .portal-section-heading { align-items: stretch; flex-direction: column; }
  .class-selector { padding: 16px 14px; }
  .class-row-controls { align-items: flex-end; }
  .class-work-editor { padding: 17px 14px; }
  .existing-work { padding-left: 14px; }
  .existing-request-editor { padding: 17px 14px; }
  .guard-assignment-editor { padding: 17px 14px; }
  .portal-schedule-reason { padding: 17px 14px; }
  .password-panel { grid-template-columns: 1fr; }
  .password-panel > * { grid-column: auto !important; }
  .password-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .portal-request-submit { align-items: stretch; flex-direction: column; }
  .portal-submit-request { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.login-footer { position: relative; z-index: 1; grid-column: 1; grid-row: 2; align-self: end; padding: 0 clamp(38px, 6vw, 92px) 34px; color: #e1f2fc; font-size: var(--text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.login-footer a, .login-footer a:visited, .login-footer a:hover, .login-footer a:active { color: inherit; }
.login-footer a { text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }
.login-footer a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 2px; }

@media (max-width: 850px) {
  .login-footer { grid-column: 1; grid-row: 3; padding: 0 24px 28px; text-align: center; }
}

@media (max-width: 560px) {
  .login-footer { padding-inline: 18px; }
}

.portal-home-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; padding:28px; border-radius:18px; background:linear-gradient(110deg,#102b4b,#315d89); margin-bottom:24px; }
button.portal-home-action { display:grid; grid-template-columns:44px minmax(0,1fr); align-items:center; gap:16px; padding:24px; min-height:132px; border:1px solid #ffffff30; border-radius:10px; text-align:left; cursor:pointer; }
.portal-home-action.primary { background:white; color:#15375f; }
.portal-home-action.secondary { background:#ffffff18; color:white; }
.portal-home-action > span:first-child { display:grid; place-items:center; width:44px; height:44px; border-radius:12px; background:#2888c4; color:white; font-size:24px; }
.portal-home-action strong,.portal-home-action small { display:block; }
.portal-home-action strong { font-size:var(--text-section); }
.portal-home-action small { font-size:var(--text-secondary); margin-top:6px; }
.portal-home-action:focus-visible,.portal-home-action[aria-pressed=true] { outline:3px solid #83c9ef; outline-offset:3px; }
.portal-weekly { background:white; padding:20px; border:1px solid #dce7f0; border-radius:14px; margin-top:24px; }
.portal-weekly-scroll { overflow-x:auto; }
.portal-weekly table { width:100%; min-width:760px; border-collapse:collapse; table-layout:fixed; }
.portal-weekly th,.portal-weekly td { padding:10px; border:1px solid #dce7f0; vertical-align:top; overflow-wrap:anywhere; }
.portal-weekly th { background:#edf5fc; }
.portal-weekly-class { background:var(--class-color,#edf5fc); color:#172333; padding:8px; border-radius:7px; margin-bottom:5px; }
.portal-weekly-class span { display:block; }
.portal-weekly-class.non-working { background:#e5e7eb; color:#374151; }
@media(max-width:700px) { .portal-home-actions { grid-template-columns:minmax(0,1fr); padding:16px; } }
.portal-weekly-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
.portal-weekly-header h2 { margin:0; }

.portal-content > .portal-date-panel { grid-template-columns: minmax(0, 1fr); margin-bottom: 24px; }

.portal-substitution-board { margin-top: 24px; border: 1px solid #dce7f0; border-radius: 16px; background: #fff; overflow: hidden; }
.portal-board-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; background: #405b7c; color: #fff; padding: 22px; }
.portal-board-heading h2 { margin: 0; font-size: var(--text-section); }
.portal-board-heading p { margin: 7px 0 0; }
.portal-board-totals { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-board-totals span { padding: 7px 10px; border-radius: 8px; background: #ffffff25; }
.portal-board-totals .is-covered { background: #d9f8e4; color: #137c3b; }
.portal-board-totals .is-pending { background: #fff0b5; color: #795600; }
.portal-board-slot { display: grid; grid-template-columns: minmax(142px,180px) minmax(0,1fr); }
.portal-board-slot + .portal-board-slot { border-top: 3px solid #edf2f7; }
.portal-board-slot-time { margin: 0; padding: 18px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; color: #fff; background: #173a60; font-size: var(--text-body); }
.portal-board-slot-time strong { white-space: nowrap; }
.portal-board-slot-time span { font-size: var(--text-secondary); font-weight: 400; color: #d7e7f5; }
.portal-board-list { min-width: 0; }
.portal-board-row { min-width: 0; display: grid; grid-template-columns: minmax(145px,1fr) 18px minmax(145px,1fr) minmax(135px,.8fr) auto; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid #dce7f0; border-left: 4px solid #38865b; background: #f4fbf6; overflow-wrap: anywhere; }
.portal-board-row:last-child { border-bottom: 0; }
.portal-board-row.is-pending { border-left-color: #b18219; background: #fffaf0; }
.portal-board-person { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.portal-board-person small { flex: 0 0 auto; color: #63768a; font-size: var(--text-secondary); }
.portal-board-person strong { min-width: 0; }
.portal-board-person.is-substitute strong { color: #137c3b; }
.portal-board-row.is-pending .portal-board-person.is-substitute strong { color: #795600; }
.portal-board-arrow { color: #2d7dbb; text-align: center; font-weight: 700; }
.portal-board-class { min-width: 0; color: #63768a; }
.portal-board-class strong { color: #172333; }
.portal-board-state { color: #137c3b; font-size: var(--text-secondary); white-space: nowrap; }
.portal-board-row.is-pending .portal-board-state { color: #795600; }
.portal-board-state .substitution-state-capsule {
  --state-color: #52697d;
  --state-border: #c8d5de;
  --state-icon-bg: #e9eff3;
  --state-fill: #eef3f6;
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--state-border);
  border-radius: 11px;
  padding: 4px 9px 4px 5px;
  color: var(--state-color);
  background: var(--state-fill);
  font: inherit;
  font-size: calc(var(--text-secondary) * var(--list-text-scale, 1));
  line-height: 1.18;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.portal-board-state .substitution-state-capsule.is-success { --state-color: #17633c; --state-border: #9bd1b3; --state-icon-bg: #dff3e8; --state-fill: #edf9f2; }
.portal-board-state .substitution-state-capsule.is-danger { --state-color: #972f29; --state-border: #f0b1ac; --state-icon-bg: #ffe0dd; --state-fill: #fff0ef; }
.portal-board-state .substitution-state-icon { display: grid; flex: 0 0 23px; width: 23px; height: 23px; place-items: center; border-radius: 50%; color: var(--state-color); background: var(--state-icon-bg); font-size: 13px; font-weight: 950; line-height: 1; }
.portal-board-state .substitution-state-copy { display: flex; min-width: 0; align-items: center; gap: 1px; white-space: nowrap; }
.portal-board-state .substitution-state-copy strong { color: currentColor; font-weight: 850; }
.portal-board-empty { padding: 30px; text-align: center; color: #63768a; }
@media (max-width: 1100px) {
  .portal-board-row { grid-template-columns: minmax(0,1fr) 18px minmax(0,1fr) auto; }
  .portal-board-class { grid-column: 1 / 4; grid-row: 2; }
  .portal-board-state { grid-column: 4; grid-row: 2; }
}
@media (max-width: 700px) {
  .portal-board-slot { grid-template-columns: minmax(0,1fr); }
  .portal-board-slot-time { padding: 10px 14px; flex-direction: row; align-items: center; justify-content: space-between; }
  .portal-board-row { padding: 10px 12px; }
}
@media (max-width: 480px) {
  .portal-board-row { grid-template-columns: minmax(0,1fr) 14px minmax(0,1fr); gap: 6px; }
  .portal-board-person { align-items: flex-start; flex-direction: column; gap: 1px; }
  .portal-board-class { grid-column: 1 / 3; }
  .portal-board-state { grid-column: 3; }
}
@media (max-width: 1050px) { button.portal-home-action { padding: 18px; gap: 10px; grid-template-columns: minmax(0,1fr); } }
