:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #6b7485;
  --line: #e3e7ef;
  --primary: #e97817;
  --primary-dark: #cf5f08;
  --button-primary: #ef7777;
  --button-primary-hover: #e97817;
  --accent: #13a383;
  --danger: #c73e4b;
  --warning: #a46205;
  --shadow: 0 18px 48px rgba(32, 49, 82, .1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .6rem; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; }
h2 { margin-bottom: .4rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.eyebrow { display: block; margin-bottom: .6rem; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.button { border: 0; border-radius: .75rem; padding: .8rem 1.05rem; cursor: pointer; font: inherit; font-weight: 750; transition: .2s ease; }
.button:disabled { cursor: wait; opacity: .65; }
.button.primary { color: #fff; background: var(--button-primary); }
.button.primary:hover { background: var(--button-primary-hover); }
.button.secondary { color: var(--ink); background: #edf1f7; }
.button.ghost { color: var(--muted); background: transparent; }
.button.danger { color: var(--danger); background: #fff0f1; }
.button.small { padding: .55rem .75rem; font-size: .82rem; }
.button.full { width: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem 1.25rem;
  min-height: 4.5rem;
  padding-inline: max(1rem, calc((100vw - 1480px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: none; }
.main-nav {
  display: flex;
  flex: 1;
  align-self: stretch;
  justify-content: flex-start;
  gap: .8rem 1.4rem;
  min-width: 0;
  flex-wrap: wrap;
}
.main-nav a {
  display: grid;
  place-items: center;
  padding: .15rem 0 .35rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
}
.main-nav a.active, .main-nav a:hover { border-color: var(--primary); color: var(--primary); }
.logout-button { margin-left: auto; }
.top-auth { margin-left: auto; }
.top-auth-grid { display: grid; gap: .35rem; }
.auth-links {
  display: flex;
  justify-content: flex-end;
  gap: .85rem;
  flex-wrap: wrap;
}
.top-login-form, .top-authenticated { display: flex; align-items: center; gap: .45rem; }
.top-authenticated { position: relative; flex-wrap: wrap; justify-content: flex-end; }
.top-login-form input { width: 150px; padding: .55rem .65rem; font-size: .78rem; }
.top-auth-grid .message { max-width: 410px; padding: .4rem .55rem; font-size: .72rem; }
.top-authenticated strong { max-width: 190px; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.notification-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--primary);
  background: #fff8f0;
  cursor: pointer;
  transition: .2s ease;
}
.notification-button:hover {
  border-color: rgba(233, 120, 23, .35);
  background: #fff0e0;
}
.notification-button svg {
  width: 1.12rem;
  height: 1.12rem;
  fill: currentColor;
}
.notification-badge {
  position: absolute;
  top: -.2rem;
  right: -.2rem;
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: .68rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(199, 62, 75, .28);
}
.notifications-panel {
  position: absolute;
  top: calc(100% + .65rem);
  right: 0;
  z-index: 30;
  width: min(28rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  box-shadow: var(--shadow);
}
.notifications-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.notifications-panel-header strong {
  color: var(--ink);
  font-size: .9rem;
}
.notifications-panel-body {
  display: grid;
  gap: .45rem;
  max-height: 22rem;
  overflow: auto;
  padding: .75rem;
}
.notifications-empty {
  padding: 1rem;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}
.notification-item {
  display: grid;
  gap: .15rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  padding: .75rem .85rem;
  color: var(--ink);
  background: #fff;
}
.notification-item.unread {
  border-color: rgba(233, 120, 23, .24);
  background: #fff8f0;
}
.notification-item strong {
  font-size: .84rem;
}
.notification-item span {
  color: var(--muted);
  font-size: .79rem;
  line-height: 1.45;
}
.notification-item small {
  color: var(--primary-dark);
  font-size: .68rem;
  font-weight: 800;
}
.page-shell { width: min(1160px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) 0; }
.compact-page-shell { padding-top: 1rem; }
.scrollable-page {
  max-height: calc(100dvh - 4.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-width: thin;
}
.scrollable-page::-webkit-scrollbar { width: 10px; }
.scrollable-page::-webkit-scrollbar-track { background: #edf1f7; }
.scrollable-page::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
.page-heading, .hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.heading-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.compact-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-bottom: 1rem; }
.compact-actions:has(.hidden) { display: none; }
.admin-search { max-width: 420px; }

.login-page { display: grid; place-items: center; background: url("../assets/campus-background.png") center / cover no-repeat fixed; }
.login-shell { position: fixed; top: 50%; left: 50%; display: grid; grid-template-columns: 1.1fr .9fr; width: min(960px, calc(100% - 2rem)); overflow: hidden; border-radius: 1.5rem; background: var(--surface); box-shadow: none; transform: translate(-50%, -50%); }
.login-brand { display: grid; place-items: center; padding: clamp(2rem, 6vw, 5rem); background: #fff; }
.login-logo { display: block; width: min(100%, 430px); height: auto; }
.login-card { display: flex; flex-direction: column; justify-content: center; gap: 1.2rem; padding: clamp(2rem, 6vw, 4rem); background: #fff; }
.form-stack { display: grid; gap: 1rem; }
label span { display: block; margin-bottom: .42rem; color: #465167; font-size: .82rem; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid #d7dde7; border-radius: .7rem; padding: .82rem .9rem; color: var(--ink); background: #fff; font: inherit; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); outline: 3px solid rgba(233, 120, 23, .14); }
.checkbox { display: flex; align-items: center; gap: .55rem; }
.checkbox input { width: auto; }
.checkbox span { margin: 0; }
.message { margin: 0; border-radius: .7rem; padding: .8rem 1rem; color: #8c2530; background: #fff0f1; font-size: .88rem; }
.message.success { color: #08745f; background: #e8faf5; }

.user-card { display: flex; align-items: center; gap: .8rem; min-width: 250px; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; background: var(--surface); box-shadow: var(--shadow); }
.user-card span, .user-card small { display: block; margin-top: .2rem; color: var(--muted); font-size: .78rem; }
.avatar, .card-icon { display: grid; flex: 0 0 auto; place-items: center; width: 3rem; height: 3rem; border-radius: .85rem; color: #fff; background: var(--primary); font-weight: 900; }
.card-grid, .room-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.room-grid {
  max-height: calc(100vh - 16rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: .25rem;
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.room-grid::-webkit-scrollbar { width: 10px; }
.room-grid::-webkit-scrollbar-track { background: #edf1f7; }
.room-grid::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
.nav-card, .room-card, .booking-card { border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; background: var(--surface); box-shadow: 0 8px 28px rgba(32, 49, 82, .05); }
.nav-card { display: grid; gap: 1.5rem; transition: transform .2s ease, box-shadow .2s ease; }
.nav-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.nav-card.accent .card-icon { background: var(--accent); }
.nav-card p { margin-bottom: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.card-link { color: var(--primary); font-size: .86rem; font-weight: 800; }

.room-card header, .booking-card, .booking-meta, .card-actions { display: flex; gap: .8rem; }
.room-card header, .booking-card { align-items: flex-start; justify-content: space-between; }
.room-card p { min-height: 2.6rem; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.pill { display: inline-flex; border-radius: 99px; padding: .28rem .55rem; color: #08745f; background: #e8faf5; font-size: .7rem; font-weight: 800; }
.pill.inactive, .pill.cancelled { color: var(--warning); background: #fff6df; }
.room-facts { display: flex; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.room-authorized-list {
  display: grid;
  gap: .2rem;
  margin: .2rem 0 0;
  padding: .75rem 0 0;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}
.room-authorized-list strong {
  color: var(--ink);
  font-size: .78rem;
}
.room-hint {
  display: block;
  margin-top: .35rem;
  font-size: .74rem;
  line-height: 1.35;
}
.card-actions { flex-wrap: wrap; margin-top: .8rem; }
.booking-list { display: grid; gap: .8rem; }
.booking-card { align-items: center; }
.booking-card h2 { font-size: 1.05rem; }
.booking-meta { flex-wrap: wrap; color: var(--muted); font-size: .82rem; }
.empty-state { grid-column: 1 / -1; border: 1px dashed #cbd3df; border-radius: 1rem; padding: 2.5rem 1rem; color: var(--muted); text-align: center; }

.schedule-page { width: min(1480px, calc(100% - 2rem)); }
.tabs-bar { display: flex; gap: .45rem; margin-bottom: .85rem; }
.tab-button {
  border: 1px solid var(--line);
  border-bottom-color: var(--line);
  border-radius: .85rem .85rem 0 0;
  padding: .72rem 1rem;
  color: var(--muted);
  background: #fff;
  font: inherit;
  font-size: .86rem;
  font-weight: 800;
  cursor: pointer;
}
.tab-button.active {
  border-color: rgba(233, 120, 23, .28);
  border-bottom-color: #fff;
  color: var(--primary);
  background: #fff;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.schedule-toolbar { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; background: var(--surface); }
.schedule-toolbar { align-items: end; }
.schedule-toolbar label { width: min(220px, 100%); }
.schedule-toolbar .heading-actions { margin-left: auto; }
.week-navigation { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.week-navigation strong { min-width: 145px; color: var(--primary-dark); font-size: .86rem; text-align: center; text-transform: capitalize; }
.week-picker { width: 145px; }
.week-picker span { margin-bottom: .2rem; font-size: .68rem; }
.week-picker input { padding: .48rem .55rem; font-size: .78rem; }
.schedule-period { display: grid; place-items: center; margin-bottom: .6rem; border: 1px solid var(--line); border-radius: .8rem; padding: .7rem 1rem; color: var(--primary-dark); background: #fff8f0; text-align: center; text-transform: capitalize; }
.schedule-scroll-hint { display: none; margin: 0 0 .45rem; color: var(--muted); font-size: .72rem; text-align: right; }
.schedule-wrap {
  max-width: 100%;
  max-height: calc(100vh - 21rem);
  overflow-x: auto;
  overflow-y: scroll;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(32, 49, 82, .05);
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.schedule-wrap::-webkit-scrollbar { height: 10px; }
.schedule-wrap::-webkit-scrollbar-track { background: #edf1f7; }
.schedule-wrap::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
.schedule-grid { display: grid; grid-template-columns: 104px repeat(6, minmax(145px, 1fr)); min-width: 1040px; }
.schedule-corner, .schedule-day, .schedule-time { display: grid; align-content: center; min-height: 3.4rem; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: .55rem; }
.schedule-corner,
.schedule-day {
  position: sticky;
  top: 0;
  z-index: 4;
}
.schedule-corner {
  left: 0;
  z-index: 6;
}
.schedule-corner { color: var(--muted); background: #f8fafc; font-size: .76rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.schedule-day { justify-items: center; color: var(--primary-dark); background: #fff8f0; font-size: .9rem; }
.schedule-day span { margin-top: .16rem; color: var(--muted); font-size: .73rem; }
.schedule-shift { grid-column: 1 / -1; padding: .45rem .75rem; color: #fff; background: var(--primary); font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.schedule-time {
  position: sticky;
  left: 0;
  z-index: 3;
  justify-items: center;
  color: var(--ink);
  background: #fbfcfe;
  font-size: .78rem;
  font-weight: 800;
}
.schedule-time span { margin-top: .12rem; color: var(--muted); font-size: .7rem; }
.schedule-slot { min-height: 3.4rem; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .42rem; cursor: pointer; font: inherit; text-align: left; transition: .18s ease; }
.schedule-slot.free { color: #798396; background: #fff; font-size: .72rem; text-align: center; }
.schedule-slot.free:hover { color: var(--primary-dark); background: #fff4e9; }
.schedule-slot.occupied { color: #08745f; background: #e8faf5; }
.schedule-slot.occupied:hover { background: #d2f5eb; }
.schedule-slot.recurring { color: #164a94; background: #e9f2ff; }
.schedule-slot.recurring:hover { background: #d8e9ff; }
.schedule-slot.exam { color: #fff; background: #c85f00; }
.schedule-slot.exam:hover { background: #b95600; }
.schedule-slot.exam strong,
.schedule-slot.exam small { color: inherit; }
.schedule-slot.exam.pending { color: #fff; background: #c85f00; }
.schedule-slot.exam.pending:hover { background: #b95600; }
.schedule-slot.pending { color: #7b5700; background: #fff6df; }
.schedule-slot.pending:hover { background: #ffedbd; }
.schedule-slot .slot-status { font-weight: 800; text-transform: uppercase; }
.schedule-slot.occupied strong, .schedule-slot.occupied small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-slot.occupied strong { font-size: .72rem; }
.schedule-slot.occupied small { margin-top: .18rem; font-size: .66rem; }
.schedule-slot.manageable { box-shadow: inset 3px 0 0 var(--button-primary); }

.advanced-toolbar { align-items: end; }
.advanced-toolbar label { width: min(170px, 100%); }
.advanced-summary { margin-bottom: .6rem; }
.advanced-scrollbar-top {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  height: 18px;
  margin-bottom: .45rem;
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.advanced-scrollbar-top::-webkit-scrollbar { height: 14px; }
.advanced-scrollbar-top::-webkit-scrollbar-track { background: #edf1f7; }
.advanced-scrollbar-top::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
.advanced-scrollbar-spacer { height: 1px; }
.advanced-wrap {
  max-height: calc(100vh - 21rem);
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-gutter: stable both-edges;
  overscroll-behavior: contain;
}
.advanced-grid { display: grid; grid-template-columns: 104px repeat(var(--advanced-room-count), minmax(132px, 1fr)); min-width: 1040px; }
.advanced-corner, .advanced-room-header, .advanced-time-label, .advanced-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.advanced-corner, .advanced-room-header, .advanced-time-label {
  display: grid;
  align-content: center;
  min-height: 3.4rem;
  padding: .55rem;
}
.advanced-corner,
.advanced-room-header {
  position: sticky;
  top: 0;
  z-index: 4;
}
.advanced-corner {
  left: 0;
  z-index: 6;
}
.advanced-corner {
  color: var(--muted);
  background: #f8fafc;
  font-size: .76rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}
.advanced-room-header {
  justify-items: center;
  color: var(--primary-dark);
  background: #fff8f0;
  font-size: .9rem;
}
.advanced-room-header span {
  margin-top: .16rem;
  color: var(--muted);
  font-size: .73rem;
}
.advanced-time-label {
  gap: .18rem;
  color: var(--ink);
  background: #fbfcfe;
  font-size: .84rem;
  font-weight: 850;
  position: sticky;
  left: 0;
  z-index: 3;
}
.advanced-time-label small {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
}
.advanced-room-header,
.advanced-time-label,
.advanced-corner {
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.advanced-cell {
  min-height: 4.1rem;
  padding: .42rem;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.advanced-cell.free {
  color: #798396;
  background: #fff;
  font-size: .72rem;
  text-align: center;
}
.advanced-cell.free:hover { color: var(--primary-dark); background: #fff4e9; }
.advanced-cell.occupied {
  display: grid;
  gap: .1rem;
  color: #08745f;
  background: #e8faf5;
}
.advanced-cell.occupied.recurring { color: #164a94; background: #e9f2ff; }
.advanced-cell.occupied.exam { color: #fff; background: #c85f00; }
.advanced-cell.occupied.pending { color: #7b5700; background: #fff6df; }
.advanced-cell.occupied strong,
.advanced-cell.occupied small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.advanced-cell.occupied strong { font-size: .72rem; }
.advanced-cell.occupied small { margin-top: .14rem; font-size: .66rem; }
.advanced-cell.manageable { box-shadow: inset 3px 0 0 var(--button-primary); }

.class-search-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(220px, 1fr) minmax(180px, .8fr) auto;
  align-items: end;
  gap: .7rem .85rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background: var(--surface);
}
.class-search-card label { min-width: 0; }
.class-search-card select,
.class-search-card input { width: 100%; }
.class-list { display: grid; gap: .8rem; }
.class-card { border: 1px solid var(--line); border-left: 4px solid var(--button-primary); border-radius: 1rem; padding: 1rem 1.1rem; background: var(--surface); box-shadow: 0 8px 28px rgba(32, 49, 82, .05); }
.class-card.recurring { border-left-color: #3978ce; }
.class-card header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.class-card h2 { margin-bottom: .75rem; font-size: 1.1rem; }
.class-date { color: var(--primary-dark); font-size: .82rem; text-transform: capitalize; }
.class-details { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: .7rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.class-details span { color: var(--muted); font-size: .8rem; }
.class-details strong { display: block; margin-bottom: .22rem; color: var(--ink); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.class-more-details,
.class-courses {
  margin-top: .55rem;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}
.class-more-details {
  color: var(--ink);
}
.class-courses strong {
  margin-right: .3rem;
  color: var(--ink);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.class-recurrence { display: inline-flex; margin-top: .8rem; border-radius: 99px; padding: .28rem .55rem; color: #164a94; background: #e9f2ff; font-size: .72rem; font-weight: 800; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.pagination span { margin-left: .35rem; color: var(--muted); font-size: .78rem; }

.home-page { width: min(1480px, calc(100% - 2rem)); }
.home-tabs { display: flex; overflow-x: auto; gap: .45rem; margin-bottom: .65rem; padding-bottom: .15rem; }
.weekday-tabs { margin: .65rem 0 0; }
.home-tab { border: 1px solid var(--line); border-radius: 99px; padding: .58rem .9rem; cursor: pointer; color: var(--muted); background: #fff; font: inherit; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.home-tab.active, .home-tab:hover { border-color: var(--primary); color: #fff; background: var(--primary); }
.home-schedule-wrap {
  max-width: 100%;
  max-height: calc(100vh - 21rem);
  overflow-x: auto;
  overflow-y: scroll;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.home-schedule-grid { display: grid; grid-template-columns: 94px repeat(var(--home-room-count), 170px); min-width: max-content; }
.home-schedule-grid.home-schedule-empty {
  grid-template-columns: 1fr;
  min-width: 100%;
}
.home-grid-time, .home-grid-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .5rem; }
.home-grid-time {
  position: sticky;
  left: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 3.5rem;
  color: var(--ink);
  background: #fbfcfe;
  font-size: .76rem;
  font-weight: 850;
}
.home-grid-time span { color: var(--muted); font-size: .68rem; }
.home-grid-shift-label, .home-grid-shift-room {
  display: grid;
  align-items: center;
  min-height: 2.2rem;
  border-right: 1px solid rgba(255, 255, 255, .24);
  border-bottom: 1px solid #d96806;
  padding: .48rem .62rem;
  color: #fff;
  background: var(--primary);
  font-size: .76rem;
  font-weight: 900;
}
.home-grid-shift-label {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 6;
  justify-items: start;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.home-grid-shift-room {
  position: sticky;
  top: 0;
  z-index: 4;
  justify-items: center;
  color: #fff;
  text-align: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
.home-grid-cell { display: grid; align-content: start; gap: .3rem; min-width: 0; min-height: 3.5rem; }
.home-booking { display: grid; gap: .18rem; min-width: 0; border-radius: .5rem; padding: .38rem .45rem; color: #08745f; background: #e8faf5; overflow-wrap: anywhere; word-break: break-word; }
.home-booking.sporadic { color: #08745f; background: #e8faf5; }
.home-booking.recurring { color: #164a94; background: #e9f2ff; }
.home-booking.alteration { color: #6a2ca0; background: #f2e8ff; }
.home-booking.exam {
  color: #7b5700;
  background: #fff6df;
}
.home-booking.exam small,
.home-booking.alteration small,
.home-booking.recurring small,
.home-booking.sporadic small { color: inherit; }
.home-booking summary {
  overflow: visible;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 800;
  list-style: none;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.2;
}
.home-booking summary::-webkit-details-marker { display: none; }
.home-booking small {
  display: block;
  overflow: visible;
  font-size: .64rem;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.2;
}
.home-free { align-self: center; color: var(--muted); font-size: .7rem; text-align: center; }

.admin-tabs { display: flex; overflow-x: auto; gap: .45rem; margin-bottom: 1rem; }
.admin-panel { display: grid; gap: .8rem; }
.admin-note { margin-bottom: .2rem; font-size: .82rem; }
.admin-list { display: grid; gap: .65rem; }
.admin-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .8rem; border: 1px solid var(--line); border-radius: .85rem; padding: .85rem 1rem; background: #fff; }
.admin-card div { min-width: 0; }
.admin-card strong, .admin-card span { display: block; }
.admin-card span { margin-top: .18rem; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-card-pill { justify-self: center; margin-top: 0; }
.admin-card .button { justify-self: end; }
.admin-card-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.series-actions { align-items: center; white-space: nowrap; }
.series-card { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.series-card.selected { border-color: rgba(233, 120, 23, .45); box-shadow: inset 0 0 0 1px rgba(233, 120, 23, .08); }
.series-select { align-items: center; gap: .4rem; margin: 0; white-space: nowrap; }
.series-select span { margin: 0; font-size: .75rem; }
.series-select input { margin: 0; }
.pending-list { display: grid; gap: .8rem; }
.pending-card { display: grid; gap: .75rem; border: 1px solid var(--line); border-left: 4px solid #e7ad32; border-radius: 1rem; padding: 1rem; background: #fff; }
.pending-card header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.pending-card h2 { margin: 0; font-size: 1.05rem; }
.pending-details { display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; color: var(--muted); font-size: .8rem; }
.filter-card { display: grid; grid-template-columns: minmax(240px, 420px) 1fr; align-items: end; gap: .8rem 1rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; background: #fff; }
.filter-card label { display: grid; gap: .35rem; color: var(--ink); font-size: .82rem; font-weight: 800; }
.filter-card .muted { margin: 0; align-self: center; font-size: .78rem; }
.home-filter-card {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: .65rem .9rem;
  width: 100%;
  margin-bottom: 1rem;
}
.home-filter-card label {
  width: 100%;
  max-width: none;
}
.home-filter-card select {
  width: 100%;
  min-width: 0;
  padding: .68rem .82rem;
}
.home-filter-card .wide { grid-column: 1 / -1; }
.home-export-bar { display: flex; justify-content: flex-end; margin: -.25rem 0 1rem; }
.ensalamento-filters { grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; }
.ensalamento-toolbar {
  display: flex;
  align-items: end;
  gap: .8rem;
  flex-wrap: wrap;
}
.ensalamento-toolbar label {
  flex: 1 1 280px;
  max-width: 420px;
}
.ensalamento-toolbar button {
  align-self: end;
}
.my-bookings-list { display: grid; gap: .8rem; }
.labs-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; align-items: end; margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: #fff; box-shadow: 0 8px 28px rgba(32, 49, 82, .05); }
.lab-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
details.lab-card { border: 1px solid var(--line); border-radius: 1rem; background: #fff; box-shadow: 0 8px 28px rgba(32, 49, 82, .05); overflow: hidden; }
details.lab-card[open] { border-color: var(--primary); }
details.lab-card summary { list-style: none; display: grid; gap: .35rem; padding: 1rem; cursor: pointer; }
details.lab-card summary::-webkit-details-marker { display: none; }
details.lab-card summary::after { content: "Mostrar detalhes"; font-size: .78rem; font-weight: 700; color: var(--primary); }
details.lab-card[open] summary::after { content: "Ocultar detalhes"; }
.lab-card-title { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.lab-card-meta { color: var(--muted); font-size: .8rem; }
.lab-card-body { display: grid; gap: .85rem; padding: 0 1rem 1rem; }
.lab-description { margin: 0; color: var(--text); line-height: 1.45; }
.lab-responsibles { display: grid; gap: .55rem; border-top: 1px solid var(--line); padding-top: .85rem; }
.lab-responsibles h3 { margin: 0; font-size: .9rem; }
.lab-responsible { display: grid; gap: .14rem; }
.lab-responsible span { color: var(--muted); font-size: .78rem; }
.my-booking-card { display: grid; gap: .75rem; border: 1px solid var(--line); border-left: 4px solid #e7ad32; border-radius: 1rem; padding: 1rem; background: #fff; box-shadow: 0 8px 28px rgba(32, 49, 82, .05); }
.my-booking-card.pending { border-left-color: #e7ad32; }
.my-booking-card.confirmed { border-left-color: #13a383; }
.my-booking-card.cancelled { border-left-color: #d44b4b; }
.my-booking-card header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.my-booking-card h2 { margin: 0; font-size: 1.05rem; }
.pill.pending { color: #7b5700; background: #fff6df; }
.pill.confirmed { color: #08745f; background: #e8faf5; }
.status-line { margin: 0; font-size: .86rem; font-weight: 800; }
.status-line.pending { color: #e28c00; }
.status-line.confirmed { color: #0a8a63; }
.status-line.cancelled { color: #c53f3f; }
.pill.series { color: #164a94; background: #e9f2ff; }
.booking-history { border-top: 1px solid var(--line); padding-top: .65rem; }
.booking-history summary {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .38rem .7rem;
  color: var(--primary-dark);
  background: #f4f7fb;
  font-size: .8rem;
  font-weight: 800;
  list-style: none;
}
.booking-history summary::-webkit-details-marker { display: none; }
.booking-history ul { display: grid; gap: .45rem; margin: .65rem 0 0; padding-left: 1rem; }
.booking-history li { color: var(--muted); font-size: .78rem; }
.booking-history li strong, .booking-history li span, .booking-history li small { display: block; }
.booking-history li small { margin-top: .12rem; color: var(--ink); }
.activity-checklist { border: 1px solid var(--line); border-radius: .75rem; padding: .8rem; }
.activity-checklist legend { padding: 0 .3rem; color: var(--muted); font-size: .78rem; font-weight: 800; }
.activity-checklist div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: .25rem;
}
.field-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .65rem;
}
.activity-checklist .field-actions {
  display: flex;
  grid-template-columns: none;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.key-authorized-list {
  display: grid;
  gap: .6rem;
}
.activity-checklist .key-authorized-list {
  grid-template-columns: 1fr;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.key-authorized-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
  align-items: center;
}
.key-authorized-row .button.small {
  white-space: nowrap;
}
#system-user-activities-search-field { display: grid; gap: .35rem; }
#system-user-activities-search-field input { padding: .68rem .78rem; font-size: .9rem; }
.visible-actions { display: flex !important; }

.modal { width: min(560px, calc(100% - 1.5rem)); border: 0; border-radius: 1rem; padding: 1.05rem; box-shadow: var(--shadow); }
.compact-modal { width: min(500px, calc(100% - 1.5rem)); }
.section-kicker {
  margin-bottom: .25rem;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.export-modal { width: min(620px, calc(100% - 1.5rem)); }
.export-modal-help { margin: .45rem 0 .85rem; color: var(--muted); font-size: .86rem; }
.home-quick-consult-bar {
  display: flex;
  justify-content: flex-start;
  margin: .75rem 0 .15rem;
}
.quick-consult-modal {
  width: min(1100px, calc(100% - 1.5rem));
}
.quick-consult-tabs {
  margin-top: .85rem;
  margin-bottom: .25rem;
}
.quick-consult-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .75rem;
  margin: .9rem 0;
}
.quick-consult-filters label {
  display: grid;
  gap: .35rem;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
}
.quick-consult-table-wrap {
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fff;
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-width: thin;
}
.quick-consult-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.quick-consult-table-wrap::-webkit-scrollbar-track { background: #edf1f7; }
.quick-consult-table-wrap::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
.quick-consult-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}
.quick-consult-table th,
.quick-consult-table td {
  padding: .72rem .78rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: .84rem;
}
.quick-consult-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff7ef;
  color: var(--primary-dark);
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.quick-consult-table tbody tr:nth-child(even) td {
  background: #fcfdff;
}
.quick-consult-empty {
  padding: 1.4rem .8rem;
  color: var(--muted);
  text-align: center;
}
.quick-consult-actions {
  margin-top: 1rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 650px) {
  .quick-consult-modal {
    width: min(100% - 1rem, 760px);
    padding: .85rem;
  }
  .quick-consult-tabs {
    overflow-x: auto;
    padding-bottom: .1rem;
    scrollbar-color: var(--primary) #edf1f7;
    scrollbar-width: thin;
  }
  .quick-consult-tabs::-webkit-scrollbar { height: 8px; }
  .quick-consult-tabs::-webkit-scrollbar-track { background: #edf1f7; }
  .quick-consult-tabs::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
  .quick-consult-tabs .tab-button {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: .62rem .85rem;
    font-size: .8rem;
  }
  .quick-consult-filters {
    grid-template-columns: 1fr;
    gap: .6rem;
    margin: .75rem 0 .85rem;
  }
  .quick-consult-filters label {
    font-size: .78rem;
  }
  .quick-consult-table-wrap {
    max-height: 50vh;
    border-radius: .75rem;
  }
  .quick-consult-table {
    min-width: 720px;
  }
  .quick-consult-table th,
  .quick-consult-table td {
    padding: .58rem .6rem;
    font-size: .76rem;
  }
}

@media (max-width: 420px) {
  .quick-consult-table {
    min-width: 660px;
  }
  .quick-consult-table th,
  .quick-consult-table td {
    padding: .52rem .54rem;
    font-size: .74rem;
  }
}
.export-type-list {
  display: grid;
  gap: .55rem;
  max-height: min(46vh, 280px);
  overflow: auto;
  padding: .3rem .15rem .5rem;
  scrollbar-color: var(--primary) #edf1f7;
  scrollbar-width: thin;
}
.export-type-list::-webkit-scrollbar { width: 8px; }
.export-type-list::-webkit-scrollbar-track { background: #edf1f7; }
.export-type-list::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
.form-stack { position: relative; }
.modal-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  border-radius: 1rem;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(2px);
}
.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(9, 18, 36, .58);
}
.loading-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  place-items: center;
  background: rgba(9, 18, 36, .5);
}
.loading-overlay[open] { display: grid; }
.loading-overlay:not(dialog):not(.hidden) { display: grid; }
.loading-overlay::backdrop { background: rgba(9, 18, 36, .5); }
.loading-card { display: grid; justify-items: center; gap: .4rem; min-width: 190px; border-radius: .9rem; padding: 1.1rem 1.4rem; color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.loading-card strong { font-size: .95rem; }
.loading-card span:last-child { color: var(--muted); font-size: .74rem; }
.loading-spinner { width: 2.1rem; height: 2.1rem; border: 4px solid #f3d4d4; border-top-color: var(--button-primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal::backdrop { background: rgba(9, 18, 36, .55); }
.modal-header, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.modal-header h2 { margin-bottom: .35rem; font-size: 1.15rem; }
.modal label span { margin-bottom: .32rem; font-size: .76rem; }
.modal input, .modal textarea, .modal select { padding: .68rem .78rem; font-size: .9rem; }
.icon-button { border: 0; cursor: pointer; color: var(--muted); background: transparent; font-size: 1.55rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.wide { grid-column: 1 / -1; }
.modal-actions { justify-content: flex-end; margin-top: .25rem; }

.manage-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px)) auto;
  gap: .8rem;
  align-items: end;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background: #fff;
}
.manage-toolbar label { display: grid; gap: .35rem; color: var(--ink); font-size: .82rem; font-weight: 800; }
.manage-toolbar .button { align-self: end; }
.manage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.manage-actions .message { flex: 1; }
.manage-list { display: grid; gap: .9rem; }
.manage-series-card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 8px 28px rgba(32, 49, 82, .05);
}
.manage-series-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.manage-series-card h3 { margin-bottom: .3rem; font-size: 1rem; }
.manage-series-card small { color: var(--muted); }
.manage-series-grid { display: grid; grid-template-columns: 1.2fr repeat(4, minmax(120px, 1fr)); gap: .8rem; }
.manage-series-grid label { display: grid; gap: .35rem; }
.manage-series-grid select, .manage-series-grid input { width: 100%; }
.manage-series-meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.manage-series-meta .pill { background: #eef3ff; color: var(--primary-dark); }
.manage-conflicts {
  margin-top: .8rem;
  border-top: 1px solid var(--line);
  padding-top: .8rem;
}
.manage-conflicts ul { margin: .5rem 0 0; padding-left: 1.15rem; color: var(--danger); font-size: .82rem; }

@media (max-width: 650px) {
  .login-page { background: url("../assets/campus-background.png") center / cover no-repeat; }
  .login-shell { position: static; display: block; transform: none; }
  .login-brand { padding: 2rem; }
  .login-logo { width: min(100%, 360px); }
  .topbar { flex-wrap: wrap; align-items: flex-start; gap: .7rem .9rem; padding: .8rem 1rem .25rem; }
  .top-auth { order: 2; width: 100%; margin-left: 0; }
  .top-auth-grid { width: 100%; justify-items: stretch; }
  .top-login-form { display: grid; grid-template-columns: 1fr 1fr auto; }
  .top-login-form input { width: 100%; }
  .top-authenticated { width: 100%; justify-content: space-between; }
  .auth-links { justify-content: flex-end; }
  .main-nav {
    order: 3;
    width: 100%;
    flex: 1 0 100%;
    height: auto;
    min-height: 0;
    justify-content: flex-start;
    align-content: flex-start;
    flex-wrap: wrap;
    gap: .35rem .85rem;
    overflow-x: auto;
    padding-bottom: .2rem;
    scrollbar-color: var(--primary) #edf1f7;
    scrollbar-width: thin;
  }
  .main-nav::-webkit-scrollbar { height: 8px; }
  .main-nav::-webkit-scrollbar-track { background: #edf1f7; }
  .main-nav::-webkit-scrollbar-thumb { border-radius: 99px; background: var(--primary); }
  .main-nav a { flex: 0 0 auto; font-size: .82rem; }
  .page-heading, .hero { display: grid; gap: 1rem; }
  .class-search-card, .class-card header { display: grid; }
  .class-details { grid-template-columns: 1fr 1fr; }
  .filter-card { grid-template-columns: 1fr; }
  .ensalamento-filters { grid-template-columns: 1fr; }
  .home-schedule-grid { grid-template-columns: 82px repeat(var(--home-room-count), 150px); }
  .home-grid-time, .home-grid-shift-label { position: sticky; z-index: 2; left: 0; }
  .home-grid-shift-label { z-index: 3; }
  .admin-card { grid-template-columns: 1fr; align-items: stretch; }
  .scrollable-page { max-height: none; overflow: visible; }
  .admin-card-pill, .admin-card .button { justify-self: start; }
  .admin-card-actions { justify-content: flex-start; flex-wrap: wrap; }
  .activity-checklist div { grid-template-columns: 1fr; }
  .key-authorized-row { grid-template-columns: 1fr; }
  .key-authorized-row .button.small { width: 100%; }
  .schedule-toolbar, .week-navigation { display: grid; }
  .schedule-scroll-hint { display: block; }
  .schedule-grid { grid-template-columns: 86px repeat(6, 148px); min-width: 974px; }
  .schedule-shift { position: sticky; z-index: 3; left: 0; }
  .week-navigation { grid-template-columns: 1fr 1fr; }
  .week-picker { grid-column: 1 / -1; width: 100%; }
  .user-card { min-width: 0; }
  .form-grid { display: grid; grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .booking-card { display: grid; }
  .modal { width: min(100% - 1rem, 560px); padding: .95rem; }
  .compact-modal { width: min(100% - 1rem, 500px); }
  .manage-toolbar { grid-template-columns: 1fr; }
  .manage-actions { display: grid; }
  .manage-series-grid { grid-template-columns: 1fr; }
  .series-card { grid-template-columns: 1fr; }
}

.forgot-password-link {
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  text-align: right;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.signup-link {
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
}

.signup-link:hover {
  text-decoration: underline;
}

.auth-simple-page {
  min-height: auto;
  background: #fff;
}

.auth-simple-shell {
  width: min(420px, calc(100% - 2rem));
  margin: 0 auto;
  padding-top: 3rem;
}

.auth-simple-card {
  display: grid;
  gap: 1rem;
  justify-items: center;
}

.auth-simple-card h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

.auth-simple-card .muted {
  max-width: 360px;
  margin-bottom: .4rem;
  line-height: 1.45;
}

.auth-simple-card .form-stack {
  width: 100%;
  max-width: 360px;
}

.auth-simple-card .button.full {
  max-width: 360px;
}

.auth-simple-card .forgot-password-link {
  display: block;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.auth-simple-card .signup-link {
  display: block;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.auth-simple-card .message {
    width: 100%;
    max-width: 360px;
  }

  .signup-form.signup-code-step {
    gap: .72rem;
  }

  .signup-form.signup-code-step > label:not(#signup-code-field) {
    display: none;
  }

  .signup-form.signup-code-step #signup-code-field {
    margin-top: .1rem;
  }

  .signup-form.signup-code-step .button.full {
    margin-top: .1rem;
  }
/* Avisos */
.notice-page { background: #f6f7fb; }
.notice-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 1.5rem;
}
.notice-card {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.notice-header-wrap {
  background: #fff;
  margin-top: 0;
  clear: none;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.notice-header-bar {
  background: #e9e9e9;
  border-top: 6px solid #d67c14;
  padding: 18px;
  color: #d67c14;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  box-sizing: border-box;
}
.notice-list {
  display: grid;
  gap: .45rem;
  padding: .9rem 1rem 1rem;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.notice-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.notice-link-item {
  display: block;
  width: 100%;
  border: 0;
  padding: .55rem .6rem;
  border-radius: .6rem;
  background: transparent;
  text-align: left;
  color: var(--primary-dark);
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.notice-link-item:hover {
  background: #fff6ef;
  color: var(--primary);
}
.notice-detail-card { padding-bottom: .8rem; }
.notice-detail-body {
  display: grid;
  gap: 1rem;
  padding: 1rem 1rem 1.2rem;
}
.notice-back-link {
  color: var(--primary);
  font-size: .84rem;
  font-weight: 800;
}
.notice-detail-article {
  display: grid;
  gap: .85rem;
}
.notice-detail-article h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}
.notice-detail-meta {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}
.notice-detail-content,
.notice-detail-text {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.7;
}
.notice-detail-content {
  display: grid;
  gap: .9rem;
}
.notice-detail-image {
  display: flex;
  justify-content: center;
  margin-top: .25rem;
}
.notice-detail-image img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: .85rem;
  box-shadow: 0 10px 30px rgba(32, 49, 82, .12);
}
.notice-detail-text a,
.notice-detail-content a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}
.embedded-aviso .notice-shell {
  width: min(100% - 1rem, 1120px);
  padding-top: .75rem;
}
.embedded-aviso .notice-back-link {
  display: none;
}
.notice-editor-shell {
  display: grid;
  gap: .75rem;
}
.notice-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: end;
}
.notice-toolbar-field {
  display: grid;
  gap: .22rem;
  min-width: 175px;
}
.notice-toolbar-field span {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.notice-toolbar-field input {
  height: 34px;
  padding: 0 .75rem;
  border: 1px solid #d7dde7;
  border-radius: .6rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.notice-toolbar-field input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(233, 120, 23, .14);
}
.field-help {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
}
.rich-editor {
  min-height: 180px;
  border: 1px solid #d7dde7;
  border-radius: .8rem;
  padding: .9rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.65;
  direction: ltr !important;
  unicode-bidi: plaintext;
  text-align: left;
  writing-mode: horizontal-tb;
  outline: none;
}
.rich-editor * {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
}
.rich-editor:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(233, 120, 23, .14);
}
.rich-editor p { margin: 0 0 .7rem; }
.notice-editor-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: var(--muted);
}
.notice-editor-meta small { font-size: .74rem; }
.notice-modal { width: min(760px, calc(100% - 1.5rem)); }
.notice-admin-card .button.secondary { white-space: nowrap; }
.course-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: start;
}
.selected-chip-list {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .45rem .55rem;
  border: 1px solid #d7dde7;
  border-radius: .7rem;
  background: #fff;
}
.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .32rem .55rem;
  border-radius: 99px;
  background: #fff6ef;
  color: var(--primary-dark);
  font-size: .82rem;
  font-weight: 700;
}
.course-modal { width: min(740px, calc(100% - 1.5rem)); }
.course-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .6rem;
  align-items: end;
}
.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: end;
}
.course-list {
  display: grid;
  gap: .45rem;
  max-height: min(42vh, 340px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: .35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 124, 20, .45) transparent;
}
.course-list::-webkit-scrollbar {
  width: 3px;
}
.course-list::-webkit-scrollbar-track {
  background: transparent;
}
.course-list::-webkit-scrollbar-thumb {
  background: rgba(214, 124, 20, .45);
  border-radius: 999px;
}
.course-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: .6rem .7rem;
  border: 1px solid #e3e8f2;
  border-radius: .65rem;
  background: #fff;
}
.course-list-check {
  min-width: 0;
  align-items: center;
  gap: .6rem;
}
.course-list-check span {
  font-weight: 650;
  line-height: 1.25;
  word-break: break-word;
}
.course-item-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.course-item-actions .button {
  min-width: 0;
}
.button.ghost.small.danger {
  color: var(--danger);
  background: #fff0f1;
}
.button.ghost.small.danger:hover {
  background: #ffe6e8;
}

@media (max-width: 650px) {
  .notice-shell { width: min(100% - 1rem, 1120px); padding-top: .75rem; }
  .notice-list, .notice-detail-body { padding-inline: .85rem; }
  .notice-detail-article h1 { font-size: 1.25rem; }
  .notice-editor-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notice-editor-meta { display: grid; }
  .notice-modal { width: min(100% - 1rem, 760px); }
  .course-picker, .course-add-row, .input-action-row { grid-template-columns: 1fr; }
  .course-list-item { grid-template-columns: 1fr; }
  .course-item-actions { justify-content: flex-start; }
  .key-authorized-row { grid-template-columns: 1fr; }
  .key-authorized-row .button.small { width: 100%; }
}
