:root {
  --ink: #162e32;
  --muted: #708387;
  --primary: #0a7272;
  --primary-dark: #07595b;
  --primary-soft: #e5f5f3;
  --cyan: #27c9bc;
  --coral: #ef735f;
  --violet: #7667d8;
  --blue: #3e8bdb;
  --amber: #e9a834;
  --surface: #ffffff;
  --canvas: #f4f8f7;
  --line: #e5edeb;
  --shadow: 0 14px 40px rgba(21, 69, 70, .08);
  --radius: 18px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, [data-page], [data-toast] { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
}
.eyebrow.light { color: #6ee7db; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-button {
  border: 0;
  background: transparent;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
}
.icon-button:hover { background: var(--primary-soft); color: var(--primary); }
.text-button {
  color: var(--primary);
  border: 0;
  background: transparent;
  font-weight: 700;
  padding: 4px;
}
.primary-button, .secondary-button, .quick-action, .biometric-button {
  min-height: 43px;
  border-radius: 11px;
  padding: 0 17px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
}
.primary-button {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 18px rgba(10,114,114,.18);
}
.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.secondary-button { background: var(--surface); border-color: var(--line); }
.secondary-button:hover { border-color: #b7ceca; background: #fbfdfc; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(480px, 1.08fr) minmax(440px, .92fr);
  background: #f7faf9;
}
.login-brand {
  min-height: 640px;
  color: white;
  position: relative;
  overflow: hidden;
  padding: 42px 7vw;
  background:
    radial-gradient(circle at 83% 9%, rgba(55,218,202,.22), transparent 29%),
    linear-gradient(142deg, #043f44, #075f60 59%, #08797a);
}
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
.login-brand::after {
  content: "";
  width: 500px;
  height: 500px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  position: absolute;
  right: -190px;
  bottom: -190px;
  box-shadow: 0 0 0 75px rgba(255,255,255,.025), 0 0 0 150px rgba(255,255,255,.02);
}
.brand-lockup, .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}
.brand-logo { width: 42px; }
.brand-lockup strong { font: 800 21px "Manrope", sans-serif; display: block; }
.brand-lockup strong span, .sidebar-brand strong span { color: #4de1d4; }
.brand-lockup small { display: block; opacity: .72; font-size: 12px; letter-spacing: .05em; }
.login-copy { position: relative; z-index: 2; margin-top: 68px; }
.login-copy h1 { font: 800 clamp(32px, 3.45vw, 48px)/1.08 "Manrope", sans-serif; letter-spacing: -.045em; margin: 15px 0; max-width: 560px; }
.login-copy p { color: rgba(255,255,255,.7); font-size: 14px; line-height: 1.55; max-width: 470px; }
.mascot-wrap { position: absolute; z-index: 2; width: min(31vw, 350px); right: -8px; bottom: 48px; }
.mascot-wrap img { width: 70%; margin-left: auto; filter: drop-shadow(0 20px 20px rgba(0,0,0,.15)); }
.speech-bubble {
  position: absolute;
  right: 53%;
  top: 32%;
  background: white;
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 14px 14px 4px 14px;
  font-size: 12px;
  line-height: 1.38;
  width: 170px;
  box-shadow: var(--shadow);
}
.speech-bubble strong { color: var(--primary); }
.login-stats {
  position: absolute;
  z-index: 3;
  left: 7vw;
  right: 5vw;
  bottom: 34px;
  display: flex;
  gap: 34px;
}
.login-stats div { display: grid; }
.login-stats strong { font: 800 18px "Manrope", sans-serif; }
.login-stats span { color: rgba(255,255,255,.58); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.login-panel { padding: 48px 7vw 25px; display: flex; flex-direction: column; justify-content: center; }
.mobile-brand { display: none; }
.login-card { width: min(100%, 440px); margin: auto; }
.login-card h2 { font: 800 32px "Manrope", sans-serif; letter-spacing: -.03em; margin: 12px 0 8px; }
.login-card > p { margin-top: 0; }
.role-switch {
  background: #eaf1ef;
  border-radius: 12px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 28px 0 24px;
}
.role-switch button { border: 0; background: transparent; height: 40px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.role-switch button.active { background: white; color: var(--primary); box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.login-card form > label { display: block; font-size: 14px; font-weight: 700; margin: 16px 0; }
.input-shell {
  height: 49px;
  border: 1px solid #dce7e4;
  background: white;
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  margin-top: 7px;
  transition: .2s;
}
.input-shell:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,114,114,.09); }
.input-shell > .icon { color: #8ca09d; }
.input-shell input { width: 100%; border: 0; outline: 0; background: transparent; }
.password-toggle { flex: 0 0 34px; }
.login-options { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin: 2px 0 21px; }
.check { display: flex !important; align-items: center; gap: 7px; margin: 0 !important; font-weight: 500 !important; }
.check input { accent-color: var(--primary); }
.login-button { width: 100%; height: 50px; }
.biometric-button { width: 100%; margin-top: 10px; border-color: #dce7e4; background: white; color: var(--primary); }
.safe-note { display: flex; align-items: center; justify-content: center; gap: 7px; color: #91a19e; font-size: 13px; margin-top: 23px; }
.safe-note .icon { width: 15px; }
.login-footer { text-align: center; color: #9aa8a6; font-size: 13px; margin: 30px 0 0; }
.login-footer button { border: 0; background: transparent; color: inherit; }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #075b5c;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 23px 16px 16px;
  overflow-y: auto;
  z-index: 50;
}
.sidebar-brand { padding: 0 8px 22px; }
.sidebar-brand img { width: 38px; }
.sidebar-brand strong { font: 800 19px "Manrope", sans-serif; display: block; }
.sidebar-brand small { display: block; font-size: 13px; color: rgba(255,255,255,.56); }
.school-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.school-avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: white; color: var(--primary); font-weight: 800; font-size: 13px; overflow: hidden; flex: 0 0 auto; }
.school-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center; padding: 0; display: block; }
.school-pill div { min-width: 0; flex: 1; }
.school-pill strong, .school-pill small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-pill strong { font-size: 13px; }
.school-pill small { color: rgba(255,255,255,.55); font-size: 13px; margin-top: 2px; }
.school-pill .icon-button { width: 26px; height: 26px; color: rgba(255,255,255,.5); }
.sidebar nav { flex: 1; }
.nav-label { display: block; color: rgba(255,255,255,.36); font-size: 14px; font-weight: 800; letter-spacing: .14em; padding: 13px 11px 5px; }
.nav-item {
  border: 0;
  color: rgba(255,255,255,.65);
  background: transparent;
  width: 100%;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  margin: 2px 0;
}
.nav-item .icon { width: 17px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item.active { color: white; background: rgba(64,218,204,.17); }
.nav-item.active::before { content: ""; position: absolute; left: -16px; width: 3px; height: 24px; background: #54dfd3; border-radius: 0 3px 3px 0; }
.dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #ff826d; }
.sidebar-help {
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.055));
  border: 1px solid rgba(255,255,255,.09);
  margin: 12px 0;
  padding: 10px;
  border-radius: 13px;
  min-height: 96px;
  position: relative;
  overflow: hidden;
}
.sidebar-help img { position: absolute; right: -2px; bottom: 2px; width: 70px; }
.sidebar-help div { width: 122px; display: grid; }
.sidebar-help strong { font-size: 12px; line-height: 1.1; }
.sidebar-help small { font-size: 12px; line-height: 1.25; color: rgba(255,255,255,.52); margin-top: 2px; }
.sidebar-help button { border: 0; background: #54dfd3; color: #075b5c; font-size: 11px; font-weight: 800; border-radius: 7px; padding: 5px 8px; margin-top: 7px; }
.sidebar-profile { border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 9px; padding: 14px 5px 0; }
.avatar, .top-avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; background: #d0a170; color: white; font-size: 14px; font-weight: 800; }
.sidebar-profile div { flex: 1; display: grid; }
.sidebar-profile strong { font-size: 14px; }
.sidebar-profile small { color: rgba(255,255,255,.5); font-size: 14px; }
.sidebar-profile .icon-button { color: rgba(255,255,255,.6); width: 30px; height: 30px; }
.main-area { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  height: 67px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 clamp(18px, 3vw, 38px);
  justify-content: space-between;
}
.global-search { width: min(400px, 43vw); display: flex; align-items: center; gap: 9px; color: #91a29f; }
.global-search .icon { width: 18px; }
.global-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; color: var(--ink); }
kbd { border: 1px solid var(--line); background: #f7f9f8; border-radius: 5px; padding: 3px 6px; font-size: 14px; color: #91a29f; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.quick-action { height: 37px; min-height: 37px; font-size: 13px; background: var(--primary); color: white; margin-right: 7px; }
.notification-button { position: relative; }
.notification-button b { position: absolute; right: 4px; top: 2px; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: white; font-size: 7px; border: 2px solid white; }
.top-avatar { margin-left: 7px; }
.mobile-menu { display: none; }
.content { padding: 29px clamp(18px, 3vw, 38px) 55px; max-width: 1640px; margin: auto; }
.page { display: none; animation: pageIn .25s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.date-line { color: var(--primary); font-size: 14px !important; font-weight: 800; letter-spacing: .12em; margin: 0 0 7px !important; }
.page-heading h1 { font: 800 25px "Manrope", sans-serif; letter-spacing: -.03em; margin: 0; }
.page-heading > div > p { color: var(--muted); font-size: 14px; margin: 5px 0 0; }
.heading-actions { display: flex; gap: 9px; }
.heading-actions button { font-size: 14px; min-height: 38px; }
.alert-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border: 1px solid #f1dfaf;
  background: linear-gradient(90deg, #fff9e8, #fffdf7);
  border-radius: 13px;
  margin-bottom: 18px;
}
.alert-icon { width: 35px; height: 35px; display: grid; place-items: center; color: #b67e18; background: #ffedb6; border-radius: 10px; }
.alert-icon .icon { width: 18px; }
.alert-banner > div:nth-child(2) { flex: 1; }
.alert-banner strong { font-size: 13px; }
.alert-banner p { color: #8a7752; font-size: 13px; margin: 2px 0 0; }
.alert-banner > button:not(.icon-button) { border: 0; background: transparent; color: #9a6811; font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 5px; }
.alert-banner > button .icon { width: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 16px; min-width: 0; box-shadow: 0 4px 12px rgba(19,66,66,.025); }
.metric-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.metric-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; }
.metric-icon .icon { width: 18px; }
.metric-icon.teal { color: var(--primary); background: var(--primary-soft); }
.metric-icon.blue { color: var(--blue); background: #eaf3fc; }
.metric-icon.coral { color: var(--coral); background: #fff0ed; }
.metric-icon.violet { color: var(--violet); background: #f0edff; }
.trend { font-size: 14px; font-weight: 800; padding: 4px 6px; border-radius: 7px; background: #edf8f2; color: #3a9a68; }
.trend.down { background: #fff2ef; color: var(--coral); }
.metric-label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-card > strong { display: block; font: 800 24px "Manrope", sans-serif; margin: 3px 0; }
.metric-card > small { color: #98a8a5; font-size: 14px; }
.metric-card .coral-text { color: var(--coral); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .85fr); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-header h3 { font: 800 13px "Manrope", sans-serif; margin: 0; }
.panel-header p { color: var(--muted); font-size: 14px; margin: 3px 0 0; }
.panel-header select, .filter-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 7px 9px;
  outline: 0;
  font-size: 14px;
}
.chart-legend { display: flex; gap: 16px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 4px; }
.legend-dot.loans { background: var(--primary); }
.legend-dot.returns { background: #8de1da; }
.bar-chart {
  height: 187px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 18px;
  padding: 12px 13px 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 45px, #edf2f1 46px);
}
.bar-group { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; position: relative; }
.bar { width: min(18px, 36%); border-radius: 5px 5px 0 0; transition: height .5s ease; position: relative; }
.bar.loan { background: linear-gradient(#18a39e, #087172); }
.bar.return { background: #9de5df; }
.bar-group label { position: absolute; bottom: -19px; font-size: 14px; color: #8a9b98; }
.due-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eff3f2; }
.due-item:last-child { border: 0; }
.book-cover { width: 30px; height: 40px; border-radius: 5px; display: grid; place-items: center; color: white; font: 800 14px "Manrope", sans-serif; box-shadow: 2px 3px 7px rgba(0,0,0,.12); flex: 0 0 auto; overflow: hidden; background: var(--primary); }
.book-cover.has-cover { background: #eef4f2; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.due-copy { min-width: 0; flex: 1; }
.due-copy strong, .due-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-copy strong { font-size: 13px; }
.due-copy small { color: var(--muted); font-size: 14px; margin-top: 2px; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 7px; font-weight: 800; padding: 4px 6px; border-radius: 7px; white-space: nowrap; }
.status.warning { color: #9a6811; background: #fff2ca; }
.status.danger { color: #c34f3d; background: #ffebe7; }
.status.success { color: #247c56; background: #e7f6ee; }
.status.info { color: #356f9f; background: #e9f3fc; }
.book-rank { display: grid; grid-template-columns: 17px 31px 1fr auto; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid #eff3f2; }
.book-rank:last-child { border: 0; }
.rank-number { font: 800 14px "Manrope", sans-serif; color: #9aa9a6; }
.rank-info { min-width: 0; }
.rank-info strong, .rank-info small { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.rank-info strong { font-size: 13px; }
.rank-info small { color: var(--muted); font-size: 7px; margin-top: 2px; }
.rank-count { text-align: right; }
.rank-count strong, .rank-count small { display: block; }
.rank-count strong { font-size: 14px; }
.rank-count small { font-size: 7px; color: var(--muted); }
.activity { display: grid; grid-template-columns: 31px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eff3f2; align-items: center; }
.activity:last-child { border: 0; }
.activity-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.activity-icon .icon { width: 14px; }
.activity-icon.loan { color: var(--primary); background: var(--primary-soft); }
.activity-icon.return { color: var(--violet); background: #f0edff; }
.activity-icon.student { color: var(--blue); background: #eaf3fc; }
.activity div:nth-child(2) { font-size: 14px; color: var(--muted); line-height: 1.4; }
.activity div:nth-child(2) strong { color: var(--ink); }
.activity > small { color: #a0aeac; font-size: 7px; }

/* Generic pages */
.page-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; min-width: 260px; height: 41px; }
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; color: var(--ink); }
.search-box .icon { width: 16px; color: var(--muted); }
.toolbar-group { display: flex; gap: 8px; align-items: center; }
.data-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; color: #80918e; font-size: 14px; letter-spacing: .04em; padding: 12px 14px; background: #f8faf9; border-bottom: 1px solid var(--line); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #edf2f1; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfc; }
.table-person { display: flex; align-items: center; gap: 9px; }
.mini-avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 14px; font-weight: 800; flex: 0 0 auto; }
.table-person strong, .table-person small { display: block; }
.table-person small { color: var(--muted); font-size: 14px; margin-top: 2px; }
.table-actions { display: flex; gap: 2px; }
.table-actions .icon-button { width: 28px; height: 28px; }
.table-actions .icon { width: 14px; }
.card-actions { margin-top: 14px; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.danger-button { color: #b43b3b; }
.danger-button:hover { background: #fff0f0; }
.danger-note { border-color: #efb4b4; background: #fff4f4; color: #7f2727; }
.detail-list { display: grid; gap: 10px; }
.detail-list p { margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
#import-file { max-width: 100%; margin: 14px auto; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.pagination div { display: flex; gap: 4px; }
.pagination button { border: 1px solid var(--line); background: white; min-width: 28px; height: 28px; border-radius: 7px; font-size: 14px; }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.book-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 13px; position: relative; transition: .2s; }
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.book-card .cover-large { height: 145px; border-radius: 10px; display: grid; place-items: center; color: white; font: 800 20px/1.1 "Manrope", sans-serif; text-align: center; padding: 15px; position: relative; overflow: hidden; }
.book-card .cover-large.has-cover { padding: 0; background: #eef4f2; }
.book-card .cover-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-large::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.24), transparent 42%); }
.book-card h3 { font: 800 13px "Manrope", sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 11px 0 3px; }
.book-card > p { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.book-meta { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 9px; }
.book-meta span { font-size: 14px; color: var(--muted); }
.view-toggle { background: white; border: 1px solid var(--line); border-radius: 9px; display: flex; padding: 3px; }
.view-toggle button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; }
.view-toggle button.active { background: var(--primary-soft); color: var(--primary); }
.view-toggle .icon { width: 15px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.summary-chip { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; display: flex; align-items: center; gap: 11px; }
.summary-chip .metric-icon { flex: 0 0 auto; }
.summary-chip strong, .summary-chip small { display: block; }
.summary-chip strong { font: 800 17px "Manrope", sans-serif; }
.summary-chip small { color: var(--muted); font-size: 14px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); background: #fbfdfc; }
.empty-state { text-align: center; padding: 55px 20px; }
.empty-state img { width: 110px; margin: 0 auto 15px; }
.empty-state h3 { font: 800 16px "Manrope", sans-serif; margin: 0; }
.empty-state p { color: var(--muted); font-size: 14px; }

/* Reports, settings, alerts, help */
.report-layout, .settings-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; }
.report-filters, .settings-menu { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; align-self: start; }
.report-filters h3 { font: 800 14px "Manrope", sans-serif; margin: 0 0 13px; }
.form-field { display: grid; gap: 5px; margin-bottom: 12px; font-size: 14px; font-weight: 700; color: #586c6d; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  min-height: 38px;
  padding: 8px 10px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.form-field textarea { resize: vertical; min-height: 80px; }
.student-picker { display: grid; gap: 8px; }
.student-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; min-height: 38px; padding: 0 10px; background: var(--surface); }
.student-search input { border: 0; outline: 0; min-height: 36px; padding: 0; background: transparent; }
.student-search .icon { width: 15px; color: var(--muted); flex: 0 0 auto; }
.student-selected { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #f7fbfa; color: var(--muted); font-size: 13px; font-weight: 700; }
.student-results { display: grid; gap: 6px; max-height: 250px; overflow-y: auto; }
.student-result { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px; display: grid; grid-template-columns: 28px 1fr auto; gap: 9px; align-items: center; text-align: left; color: var(--ink); }
.student-result:hover, .student-result.selected { border-color: var(--primary); background: var(--primary-soft); }
.student-result:disabled { opacity: .58; cursor: not-allowed; }
.student-result strong, .student-result small { display: block; }
.student-result strong { font-size: 13px; }
.student-result small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.student-result b { color: #c34f3d; font-size: 11px; }
.student-result-empty { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.message-filter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.message-filter-grid label { display: grid; gap: 4px; color: #586c6d; font-size: 12px; font-weight: 800; }
.message-filter-grid input { min-height: 38px; }
.student-list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.student-list-toolbar div { display: flex; gap: 8px; }
.student-list-toolbar .text-button { padding: 0; }
.checkbox-results { max-height: 300px; }
.checkbox-result { grid-template-columns: 18px 28px 1fr; cursor: pointer; }
.checkbox-result input { width: 16px; height: 16px; accent-color: var(--primary); }
.report-filters .primary-button { width: 100%; min-height: 39px; font-size: 13px; }
.mini-chart { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: end; height: 150px; padding-top: 25px; }
.mini-chart-column { background: var(--primary-soft); border-radius: 8px 8px 3px 3px; min-height: 15px; position: relative; }
.mini-chart-column span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 14px; }
.alert-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 13px; margin-bottom: 9px; }
.alert-card.unread { border-left: 3px solid var(--coral); }
.alert-card h3 { font-size: 13px; margin: 0 0 3px; }
.alert-card p { color: var(--muted); font-size: 13px; margin: 0; }
.alert-card time { color: #95a5a2; font-size: 14px; }
.alert-actions { display: flex; align-items: center; gap: 8px; }
.alert-actions .icon-button { width: 32px; height: 32px; }
.settings-menu button { width: 100%; height: 38px; border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 14px; display: flex; align-items: center; gap: 9px; padding: 0 10px; color: var(--muted); }
.settings-menu button.active { background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.settings-menu .icon { width: 15px; }
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.settings-card h2 { font: 800 15px "Manrope", sans-serif; margin: 0; }
.settings-card > p { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.settings-form .wide { grid-column: 1 / -1; }
.logo-upload { grid-column: 1/-1; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.logo-upload img { width: 62px; border-radius: 16px; }
.logo-upload p { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.setting-toggle {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 12px;
}
.setting-toggle span { display: grid; gap: 3px; }
.setting-toggle strong { font-size: 14px; }
.setting-toggle small { color: var(--muted); font-size: 14px; font-weight: 400; }
.setting-toggle input {
  appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 20px;
  background: #cdd8d6;
  position: relative;
  flex: 0 0 auto;
  transition: .2s;
  cursor: pointer;
}
.setting-toggle input::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  left: 3px;
  top: 3px;
  transition: .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.setting-toggle input:checked { background: var(--primary); }
.setting-toggle input:checked::after { transform: translateX(16px); }
.integration-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.integration-note .icon { width: 16px; flex: 0 0 auto; }
.settings-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.settings-actions > .muted { margin-right: auto; font-size: 14px; }
.security-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 4px 0 15px;
}
.security-summary > span {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 13px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-align: center;
}
.security-summary .icon { width: 18px; color: var(--primary); }
.security-summary strong { font-size: 13px; }
.security-summary small { color: var(--muted); font-size: 7px; }
.settings-loading {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}
.settings-loading span {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.profile-selector {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.profile-selector .form-field { margin: 0; }
.profile-description { display: flex; align-items: center; gap: 9px; }
.profile-description p { margin: 0; color: var(--muted); font-size: 14px; }
.permission-table-wrap { overflow-x: auto; margin-bottom: 15px; }
.permission-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.permission-table th { color: var(--muted); font-size: 7px; padding: 9px 7px; background: #f8faf9; border-bottom: 1px solid var(--line); text-align: center; }
.permission-table th:first-child { text-align: left; }
.permission-table td { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: center; }
.permission-table td:first-child { text-align: left; text-transform: capitalize; }
.permission-table input { accent-color: var(--primary); width: 15px; height: 15px; }
body.dark .permission-table th { background: #172b2d; }
.help-hero { border-radius: 20px; background: linear-gradient(135deg, #075b5c, #0b8582); color: white; padding: 28px 31px; display: grid; grid-template-columns: 1fr 190px; align-items: center; overflow: hidden; }
.help-hero > div { min-width: 0; }
.help-hero h2 { font: 800 23px "Manrope", sans-serif; margin: 8px 0; }
.help-hero p { color: rgba(255,255,255,.7); font-size: 13px; max-width: 550px; line-height: 1.6; }
.help-hero img { height: 165px; margin: -20px auto -45px; }
.student-current-cover { justify-self: center; align-self: center; width: 128px; }
.student-current-cover .cover-large { width: 128px; aspect-ratio: 2 / 3; border-radius: 10px; display: grid; place-items: center; color: white; font: 800 17px/1.1 "Manrope", sans-serif; text-align: center; padding: 13px; position: relative; overflow: hidden; box-shadow: 0 18px 34px rgba(0,0,0,.28); }
.student-current-cover .cover-large.has-cover { padding: 0; background: #eef4f2; }
.student-current-cover .cover-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.help-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 17px; }
.help-card h3 { font: 800 14px "Manrope", sans-serif; margin: 12px 0 5px; }
.help-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.help-card button { border: 0; background: transparent; color: var(--primary); font-size: 13px; font-weight: 800; padding: 0; }

/* Modal + toast */
.modal-backdrop { position: fixed; z-index: 100; inset: 0; background: rgba(4,30,31,.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(580px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 19px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font: 800 16px "Manrope", sans-serif; margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-footer button { font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .wide { grid-column: 1/-1; }
.stepper { display: flex; margin-bottom: 19px; }
.stepper span { flex: 1; color: var(--muted); font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stepper span::before { content: attr(data-step); width: 21px; height: 21px; border-radius: 50%; background: #edf2f1; display: grid; place-items: center; }
.stepper span.active { color: var(--primary); }
.stepper span.active::before { background: var(--primary); color: white; }
.availability { background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.toast-region { position: fixed; z-index: 200; right: 20px; top: 20px; display: grid; gap: 8px; }
.toast { min-width: 270px; max-width: 370px; background: #15383a; color: white; padding: 12px 14px; border-radius: 11px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 9px; font-size: 14px; animation: toastIn .3s ease; }
.toast .icon { color: #58ded1; width: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
.mobile-bottom-nav { display: none; }

/* Dark theme */
body.dark {
  --ink: #e8f3f1;
  --muted: #92a9a6;
  --surface: #132628;
  --canvas: #0d1d1f;
  --line: #263a3c;
  --primary-soft: #183b3b;
  --shadow: 0 14px 40px rgba(0,0,0,.25);
}
body.dark .topbar { background: rgba(19,38,40,.94); }
body.dark .data-table th, body.dark .filter-bar, body.dark kbd { background: #172b2d; }
body.dark .data-table tbody tr:hover, body.dark .secondary-button:hover { background: #183033; }
body.dark .login-screen, body.dark .login-panel { background: #0d1d1f; }
body.dark .input-shell, body.dark .role-switch button.active, body.dark .biometric-button { background: #132628; }
body.dark .role-switch { background: #1a3032; }
body.dark .login-brand { color: white; }
body.dark .alert-banner { background: #302b1c; border-color: #554827; }
body.dark .alert-banner p { color: #baa879; }
body.dark .notification-button b { border-color: var(--surface); }

body.student-view .sidebar .nav-label,
body.student-view .sidebar [data-page="students"],
body.student-view .sidebar [data-page="classes"],
body.student-view .sidebar [data-page="reports"],
body.student-view .sidebar [data-page="settings"],
body.student-view .quick-action { display: none; }
.student-hero { min-height: 230px; }

@media (max-width: 1180px) {
  .login-brand { padding-left: 5vw; }
  .login-stats { left: 5vw; gap: 22px; }
  .speech-bubble { display: none; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 30px 8vw; }
  .mobile-brand { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 32px; }
  .mobile-brand img { width: 40px; }
  .mobile-brand strong { font: 800 19px "Manrope", sans-serif; }
  .sidebar { transform: translateX(-100%); transition: .25s; box-shadow: 20px 0 50px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .global-search { margin-left: 8px; }
  .quick-action span { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .report-layout, .settings-layout { grid-template-columns: 1fr; }
  .report-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 10px; }
  .report-filters h3 { grid-column: 1/-1; }
  .data-panel { overflow-x: auto; }
  .data-table { min-width: 760px; }
}
@media (max-width: 620px) {
  .topbar { height: 58px; padding: 0 13px; }
  .global-search { flex: 1; width: auto; }
  .global-search kbd, .theme-toggle, .top-avatar { display: none; }
  .quick-action { display: none; }
  .content { padding: 20px 13px 90px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 20px; }
  .heading-actions .secondary-button { display: none; }
  .heading-actions .primary-button { padding: 0 12px; }
  .dashboard-heading .heading-actions { display: none; }
  body.student-view #page-dashboard .page-heading .heading-actions { display: none; }
  .alert-banner { align-items: flex-start; }
  .alert-banner > button:not(.icon-button) { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { padding: 13px; }
  .metric-card > strong { font-size: 20px; }
  .dashboard-grid { gap: 10px; }
  .panel { padding: 14px; border-radius: 14px; }
  .chart-panel { overflow: hidden; }
  .bar-chart { gap: 5px; padding-inline: 0; }
  .summary-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card-grid { gap: 9px; }
  .book-card { padding: 9px; }
  .book-card .cover-large { height: 125px; }
  .page-toolbar { display: grid; grid-template-columns: 1fr; }
  .search-box { min-width: 0; width: 100%; }
  .toolbar-group { justify-content: flex-end; }
  .report-filters { grid-template-columns: 1fr 1fr; }
  .settings-form, .form-grid { grid-template-columns: 1fr; }
  .settings-form .wide, .form-grid .wide { grid-column: auto; }
  .message-filter-grid { grid-template-columns: 1fr; }
  .student-list-toolbar { align-items: flex-start; flex-direction: column; }
  .profile-selector { grid-template-columns: 1fr; }
  .security-summary { grid-template-columns: 1fr; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .settings-actions > .muted { margin: 0; text-align: center; }
  .help-hero { grid-template-columns: 1fr; padding: 23px; }
  .help-hero p { max-width: 100%; overflow-wrap: anywhere; }
  .help-hero img { display: none; }
  .help-grid { grid-template-columns: 1fr; }
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    z-index: 40;
    bottom: 0;
    left: 0;
    right: 0;
    height: 67px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 5px max(6px, env(safe-area-inset-bottom));
  }
  .mobile-bottom-nav button { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 14px; }
  .mobile-bottom-nav button.active { color: var(--primary); }
  .mobile-bottom-nav .icon { width: 18px; }
  .mobile-bottom-nav .mobile-scan { width: 45px; height: 45px; border-radius: 50%; background: var(--primary); color: white; place-self: center; transform: translateY(-15px); box-shadow: 0 7px 20px rgba(10,114,114,.3); }
  .mobile-bottom-nav .mobile-scan .icon { width: 22px; }
  .toast-region { right: 10px; left: 10px; top: 10px; }
  .toast { min-width: 0; width: 100%; }
}

