:root {
  --sidebar: #171717; --accent: #ffc928; --text: #171717; --muted: #737373;
  --border: #e7e7e7; --surface: #f7f7f8; --white: #fff; --red: #cf2e3d;
  --sidebar-width: 248px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; font-family: Inter, Arial, sans-serif; color: var(--text); background: var(--surface); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar-width); background: var(--sidebar); color: #fff; display: flex; flex-direction: column; }
.brand { height: 176px; display: flex; align-items: center; justify-content: center; flex-direction: row; gap: 10px; border-bottom: 1px solid #252525; padding: 18px 12px; }
/* The seal is a square JPG, so it is clipped to its circle to hide the white corners on the black sidebar. */
.brand-logo { width: 96px; height: 96px; object-fit: contain; border-radius: 50%; flex: 0 0 auto; }
.brand-name { font-size: 14px; line-height: 1.15; text-align: center; font-weight: 800; letter-spacing: .2px; }
.sidebar-nav { padding: 18px 14px; flex: 1; min-height: 0; overflow-y: auto; }
/* Nothing is shown until the signed-in account is verified. Each role then sees only its own controls. */
body:not([data-role]) > .sidebar, body:not([data-role]) > .shell { visibility: hidden; }
body:not([data-role]) [data-roles],
body[data-role="student"] [data-roles]:not([data-roles~="student"]),
body[data-role="teacher"] [data-roles]:not([data-roles~="teacher"]),
body[data-role="admin"] [data-roles]:not([data-roles~="admin"]) { display: none !important; }
.nav-item, .subjects-toggle { width: 100%; height: 48px; border: 0; border-radius: 7px; background: transparent; color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 16px; font-size: 14px; font-weight: 600; text-align: left; }
.nav-item svg, .subjects-toggle svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-item:hover, .subjects-toggle:hover { background: #272727; }
.nav-item.active, .nav-item.active:hover { background: var(--accent); color: #171717; }
.nav-item.active svg { color: #171717; }
.subjects-toggle.has-active { background: #272727; }
.subjects-toggle.has-active > svg:first-child { color: var(--accent); }
.subjects-toggle .nav-chevron { margin-left: auto; transition: transform .2s; width: 17px; }
.subjects-toggle.expanded .nav-chevron { transform: rotate(180deg); }
.subject-links { display: grid; margin: 2px 0 8px 22px; overflow: hidden; }
.subject-links.collapsed { display: none; }
.subject-links button { border: 0; border-radius: 7px; background: transparent; color: #d1d1d1; height: 38px; text-align: left; padding: 0 12px 0 30px; position: relative; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject-links button::before { content: ""; position: absolute; left: 10px; top: 18px; width: 4px; height: 4px; border-radius: 50%; background: #a7a7a7; }
.subject-links button:hover { color: var(--accent); background: #222; }
.subject-links button.active, .subject-links button.active:hover { background: var(--accent); color: #171717; font-weight: 700; }
.subject-links button.active::before { background: #171717; }
.shell { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; height: 76px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 34px; gap: 20px; }
.icon-button { width: 42px; height: 42px; border: 0; background: transparent; display: inline-grid; place-items: center; border-radius: 7px; color: var(--text); }
.icon-button:hover { background: var(--surface); }
.icon-button svg { width: 21px; height: 21px; }
.search-box { height: 44px; max-width: 680px; flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid transparent; border-radius: 8px; padding: 0 14px; }
.search-box:focus-within { border-color: #d8d8d8; background: #fff; }
.search-box svg { width: 19px; color: #555; }
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.profile-button { height: 44px; border: 0; background: transparent; display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 0 6px; }
.profile-button svg { width: 20px; flex: 0 0 auto; }
.profile-button span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-button svg:last-child { width: 14px; }
.profile-menu { position: relative; }
.profile-dropdown { position: absolute; z-index: 50; right: 0; top: calc(100% + 8px); width: 238px; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 10px 28px rgba(23,23,23,.12); padding: 7px; opacity: 0; visibility: hidden; transform: translateY(-5px); transition: opacity .16s ease, transform .16s ease, visibility .16s ease; }
.profile-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-dropdown-item { width: 100%; min-height: 48px; border: 0; border-radius: 7px; background: transparent; color: var(--text); display: flex; align-items: center; gap: 11px; padding: 8px 10px; text-align: left; }
.profile-dropdown-item:hover { background: var(--surface); }
.profile-dropdown-item > svg { width: 19px; height: 19px; flex: 0 0 auto; color: #666; }
.profile-dropdown-item span { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.profile-dropdown-item small { color: var(--muted); font-size: 11px; }
.profile-dropdown-item strong { font-size: 13px; }
.profile-dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.profile-dropdown-logout { color: #b42332; }
.profile-dropdown-logout > svg { color: #b42332; }
.logout-modal { width: min(420px, calc(100% - 32px)); text-align: center; }
.logout-modal-content { padding: 28px 24px 22px; }
.logout-modal-icon { width: 52px; height: 52px; border-radius: 50%; background: #fff1f1; color: #b42332; display: grid; place-items: center; margin: 0 auto 14px; }
.logout-modal-icon svg { width: 23px; }
.logout-modal h2 { margin: 0 0 8px; font-size: 20px; }
.logout-modal p { margin: 0 0 20px; color: var(--muted); }
.logout-modal .modal-actions { justify-content: center; }
.logout-confirm-button { min-height: 42px; border: 0; border-radius: 7px; background: #b42332; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; font-weight: 700; }
.logout-confirm-button svg { width: 17px; }
.content { padding: 18px 34px 34px; }
.page { display: none; }
.page.active { display: block; }
.hero { position: relative; isolation: isolate; overflow: hidden; height: clamp(196px, 16vw, 420px); border-radius: 10px; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; padding: 34px 38px; }
/* The banner has the school name printed on it, so the photo starts far enough right to keep that name clear of the hero text. */
.hero { --photo-left: max(0px, 848px - 73%); }
.hero::before { content: ""; position: absolute; z-index: -2; inset: 0 0 0 var(--photo-left); background: url("../assets/images/lasal-tech-banner.jpg") center 4% / cover no-repeat; }
/* White fade over the photo only; the text stays at full opacity. */
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #fff 0, #fff var(--photo-left), rgba(255,255,255,.88) 310px, rgba(255,255,255,.6) 490px, rgba(255,255,255,0) 760px); }
.hero-content { max-width: 430px; }
.hero h1 { margin: 0 0 10px; font-size: 38px; letter-spacing: -1.5px; position: relative; }
.hero h1::before { content: ""; position: absolute; left: -38px; top: 3px; width: 8px; height: 48px; background: var(--accent); border-radius: 8px; }
.hero p { margin: 0; font-size: 17px; line-height: 1.38; color: #4d4d4d; }
.info-card { min-height: 84px; margin: 14px 0 22px; border: 1px solid var(--border); background: #fff; border-radius: 9px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.info-card h2 { font-size: 17px; margin: 0 0 5px; }
.info-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.info-icon { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center; }
.info-icon svg { width: 25px; }
.overview-card { box-shadow: 0 4px 14px rgba(23,23,23,.05); }
.info-icon.yellow { background: #fff5c9; color: #99751a; }
.info-icon.red { background: #f8e7e9; color: var(--red); }
.section-block { margin-bottom: 22px; }
.section-title { font-size: 21px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title > span { width: 7px; height: 23px; background: var(--accent); border-radius: 5px; }
.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.subject-card { min-height: 92px; border: 1px solid var(--border); background: #fff; border-radius: 9px; display: flex; align-items: center; padding: 14px 18px; text-align: left; color: var(--text); }
.subject-card:hover { border-color: #d1d1d1; box-shadow: 0 5px 18px rgba(0,0,0,.04); }
.subject-icon { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; margin-right: 14px; }
.subject-icon svg { width: 32px; height: 32px; }
.subject-icon.math { color: #e9a516; } .subject-icon.science { color: #747c8e; } .subject-icon.english { color: #5d72a4; }
.subject-copy { display: grid; gap: 5px; min-width: 0; }
.subject-copy small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.subject-grid .empty-state { grid-column: 1 / -1; min-height: 120px; background: #fff; border: 1px solid var(--border); border-radius: 9px; }
.subject-copy strong { font-size: 16px; }
.subject-copy small { color: var(--muted); }
.subject-arrow { margin-left: auto; width: 20px; flex: 0 0 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.text-button { flex: 0 0 auto; white-space: nowrap; border: 0; background: transparent; display: flex; align-items: center; gap: 6px; color: #262626; font-weight: 600; }
.text-button svg { width: 17px; }
.presentation-table { background: #fff; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.table-row { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .8fr) 250px; align-items: center; column-gap: 18px; padding: 8px 18px; border-bottom: 1px solid #efefef; }
.table-row:last-child { border-bottom: 0; }
.table-header { min-height: 42px; background: #fafafa; color: #555; font-size: 12px; font-weight: 700; }
.presentation-name { display: flex; align-items: center; gap: 12px; min-width: 0; font-weight: 700; }
.presentation-copy, .row-file-cell { display: grid; gap: 3px; min-width: 0; }
.presentation-title, .row-description, .row-file { overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.row-description, .row-file, .row-size { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.4; }
.row-file-cell .row-file { color: var(--text); font-size: 13px; }
.row-size { display: block; }
.row-date { font-size: 13px; line-height: 1.45; }
.ppt-badge { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 7px; background: #d54a47; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.ppt-badge.documents { background: #3f65b0; } .ppt-badge.pdf { background: #b42332; } .ppt-badge.spreadsheets { background: #2f7d52; } .ppt-badge.images { background: #6b7280; }
.subject-pill { overflow-wrap: anywhere; width: fit-content; max-width: 100%; border-radius: 20px; padding: 7px 12px; background: #f0f0f0; font-size: 12px; font-weight: 700; }
.subject-pill.mathematics { background: #fff1c6; } .subject-pill.science { background: #e5f2eb; } .subject-pill.english { background: #e1eafd; }
.row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-button { height: 38px; border: 0; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; font-weight: 700; white-space: nowrap; }
.row-button svg { width: 16px; }
.preview-button { background: #f1f1f1; } .download-button { background: var(--accent); } .remove-button { background: #fff1f1; color: #b42332; }
.preview-button:hover, .secondary-button:hover { background: #e6e6e6; } .download-button:hover, .primary-button:hover { background: #f5bc10; } .remove-button:hover { background: #fde3e3; }
.row-button:disabled { opacity: .45; cursor: not-allowed; }
.empty-state { min-height: 170px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.empty-state svg { width: 34px; height: 34px; margin-bottom: 8px; }
.page-header, .subject-page-header { min-height: 116px; display: flex; align-items: center; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.page-header { display: block; padding: 20px 0; }
.page-header h1, .subject-page-header h1 { margin: 5px 0 6px; font-size: 34px; letter-spacing: -1px; }
.subject-page-header { justify-content: space-between; }
.subject-page-header p { color: var(--muted); margin: 0; }
.eyebrow { color: #9b7620; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.primary-button, .secondary-button { min-height: 42px; border: 0; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; font-weight: 700; }
.primary-button { background: var(--accent); color: var(--text); }
.secondary-button { background: #efefef; color: var(--text); }
.primary-button svg, .secondary-button svg { width: 17px; }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: not-allowed; }
.article-card { background: #fff; border: 1px solid var(--border); border-radius: 9px; display: grid; grid-template-columns: 1fr 1fr; }
.article-card article { min-height: 150px; padding: 24px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.article-card article:nth-child(even) { border-right: 0; }
.article-card article:nth-last-child(-n+2) { border-bottom: 0; }
.article-card h2 { font-size: 18px; margin: 0 0 10px; }
.article-card p { color: var(--muted); line-height: 1.65; margin: 0; }
.subject-toolbar { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.table-search { width: 280px; height: 42px; border: 1px solid var(--border); background: #fff; border-radius: 7px; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.table-search svg { width: 17px; }
.table-search input { width: 100%; border: 0; outline: 0; }
.item-count { color: var(--muted); font-size: 13px; }
.modal { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 0; border-radius: 10px; padding: 0; color: var(--text); box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.modal::backdrop { background: rgba(23,23,23,.48); }
.modal form { padding: 0 22px 22px; }
.modal form > .modal-header { position: sticky; z-index: 1; top: 0; margin: 0 -22px; background: #fff; }
.modal-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 4px 0 0; font-size: 21px; }
.preview-modal { width: min(980px, calc(100% - 32px)); }
.preview-heading { min-width: 0; }
.preview-heading h2, .preview-heading small { overflow-wrap: anywhere; }
.preview-heading small { color: var(--muted); }
.preview-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: 12px; }
.form-grid { display: grid; gap: 14px; padding: 20px 0 8px; }
.form-grid label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width: 0; height: 44px; border: 1px solid var(--border); border-radius: 7px; padding: 0 12px; background: #fff; font-weight: 400; }
.form-grid textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form-grid input[type="file"] { height: auto; padding: 8px; }
.form-grid .check-label { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 400; overflow-wrap: anywhere; }
.form-grid .check-label input { width: 16px; height: 16px; flex: 0 0 16px; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 0; }
.field-error { color: #b42332; font-size: 12px; line-height: 1.45; margin: 6px 0 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #b42332 !important; background: #fff8f8 !important; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-message { min-height: 20px; color: #b42332; margin: 4px 0; font-size: 13px; }
.form-message.success { color: #2f7d52; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.preview-content { min-height: min(420px, 60dvh); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; }
.preview-content iframe { width: 100%; height: min(70dvh, 720px); border: 1px solid var(--border); }
.preview-content img { max-width: 100%; max-height: 70dvh; object-fit: contain; }
.preview-sheet { width: 100%; max-height: 70dvh; overflow: auto; align-self: start; }
.preview-sheet table { border-collapse: collapse; font-size: 13px; }
.preview-sheet th, .preview-sheet td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.preview-sheet th { background: #fafafa; }
.preview-unavailable { max-width: 430px; text-align: center; color: var(--muted); line-height: 1.6; }
.preview-unavailable svg { width: 44px; height: 44px; color: #d54a47; }
.confirm-modal { width: min(440px, calc(100% - 32px)); text-align: center; }
.confirm-modal .confirm-modal-content { padding: 28px 24px 22px; }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; background: #fff5c9; color: #171717; display: grid; place-items: center; margin: 0 auto 14px; }
.confirm-icon.danger { background: #fff1f1; color: #b42332; }
.confirm-icon.success { background: #e5f2eb; color: #2f7d52; }
.confirm-icon svg { width: 23px; }
.confirm-modal h2 { margin: 0 0 8px; font-size: 20px; overflow-wrap: anywhere; }
.confirm-modal p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.confirm-modal .modal-actions { justify-content: center; }
.upload-summary { margin: 0 0 20px; border: 1px solid var(--border); border-radius: 7px; text-align: left; font-size: 13px; }
.upload-summary > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 9px 12px; border-bottom: 1px solid #efefef; }
.upload-summary > div:last-child { border-bottom: 0; }
.upload-summary dt { color: var(--muted); }
.upload-summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 60; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 32px)); background: #171717; color: #fff; border-left: 4px solid var(--accent); border-radius: 7px; padding: 13px 16px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; opacity: 0; visibility: hidden; transition: opacity .16s ease, visibility .16s ease; }
.toast.visible { opacity: 1; visibility: visible; }
.toast.error { border-left-color: #cf2e3d; }
.sidebar-overlay { display: none; }
@media (max-width: 1080px) {
  :root { --sidebar-width: 220px; }
  .content, .topbar { padding-left: 22px; padding-right: 22px; }
  .subject-card { padding-left: 12px; }
  .table-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, .8fr) 126px; column-gap: 12px; }
  .row-actions { grid-template-columns: 1fr; }
  .subject-copy small { display: none; }
}
/* Too narrow for the printed name: show only the statue and building, which fill the left square of the banner. */
@media (max-width: 1120px) {
  .hero { --photo-left: calc(100% - 196px); }
  .hero::before { background-position: left center; }
  .hero::after { background: linear-gradient(90deg, #fff var(--photo-left), rgba(255,255,255,0) 100%); }
}
@media (max-width: 900px) { .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .subject-copy { overflow-wrap: anywhere; } }
@media (max-width: 900px) {
  .hero h1 { font-size: 31px; }
  .hero p { font-size: 15px; max-width: 290px; }
}
@media (max-width: 760px) {
  :root { --sidebar-width: 248px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; position: fixed; z-index: 25; inset: 0; background: rgba(0,0,0,.35); }
  .shell { margin-left: 0; }
  .topbar { height: 64px; padding: 0 14px; gap: 8px; }
  .menu-button { flex: 0 0 40px; }
  .profile-button span, .profile-button svg:last-child { display: none; }
  .profile-button { width: 40px; justify-content: center; }
  .search-box { min-width: 0; }
  .top-actions { gap: 0; }
  .profile-dropdown { position: fixed; right: 14px; top: 58px; width: min(238px, calc(100vw - 28px)); }
  .content { padding: 12px 14px 24px; }
  .hero { --photo-left: calc(100% - 220px); height: 220px; padding: 25px 24px; }
  .hero h1::before { left: -24px; }
  .info-card { align-items: flex-start; margin-top: 10px; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 82px; }
  .subject-copy small { display: -webkit-box; }
  .table-header { display: none; }
  .table-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 12px; }
  .row-actions { grid-template-columns: 1fr 1fr; }
  .preview-tools .row-button { width: 40px; padding: 0; font-size: 0; gap: 0; }
  .toast { right: 16px; left: 16px; bottom: 16px; }
  .upload-summary > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .subject-page-header { align-items: flex-end; gap: 12px; }
  .subject-page-header h1 { font-size: 28px; }
  .subject-page-header .primary-button { width: 42px; padding: 0; }
  .subject-page-header .primary-button span { display: none; }
  .subject-toolbar { height: 56px; }
  .table-search { width: min(240px, 75%); }
  .article-card { grid-template-columns: 1fr; }
  .article-card article, .article-card article:nth-child(even), .article-card article:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--border); }
  .article-card article:last-child { border-bottom: 0; }
}
@media (max-width: 480px) {
  .hero::after { background: linear-gradient(90deg, #fff var(--photo-left), rgba(255,255,255,.88) 68%, rgba(255,255,255,.3) 100%); }
  .hero p { max-width: 250px; }
}
