:root {
  --orange: #f7931e;
  --orange-strong: #eb8205;
  --orange-soft: #fff0dc;
  --green: #009b4f;
  --green-strong: #007f40;
  --green-soft: #e4f8ed;
  --black: #000000;
  --ink: #111111;
  --muted: #656565;
  --line: #e8dfd3;
  --paper: #fffdf8;
  --surface: #ffffff;
  --surface-2: #fbf6ee;
  --danger: #b3261e;
  --radius: 8px;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.12);
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #ffffff;
  --muted: #c9c9c9;
  --line: #292929;
  --paper: #000000;
  --surface: #090909;
  --surface-2: #111111;
  --orange-soft: rgba(247, 147, 30, 0.17);
  --green-soft: rgba(0, 155, 79, 0.2);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 650;
  line-height: 1.5;
}

body.search-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

svg,
iframe {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
a,
button,
span,
small {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--black);
  font-size: clamp(3.1rem, 8vw, 7rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.95;
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] .brand,
:root[data-theme="dark"] .note-card strong,
:root[data-theme="dark"] .book-card strong,
:root[data-theme="dark"] .subject-tile strong,
:root[data-theme="dark"] .site-footer strong {
  color: #ffffff;
}

h2 {
  margin-bottom: 0;
  color: var(--black);
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.1;
}

h3 {
  margin: 26px 0 10px;
  color: var(--black);
  font-size: 1rem;
  font-weight: 900;
}

.site-header,
.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 52px);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--black);
  font-size: clamp(1.02rem, 2.2vw, 1.45rem);
  font-weight: 900;
  line-height: 1.05;
}

.brand > span:last-child {
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 2px solid var(--black);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange) 0 50%, var(--green) 50% 100%);
  color: var(--black);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 900;
}

:root[data-theme="dark"] .brand-mark {
  border-color: #ffffff;
  color: #ffffff;
}

.brand-mark.large {
  width: 72px;
  height: 72px;
  font-size: 1.2rem;
}

.nav-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.top-nav,
.admin-header nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.top-nav a,
.admin-header nav a,
.admin-sidebar a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a[aria-current="page"],
.admin-header nav a:hover,
.admin-sidebar a:hover {
  background: var(--green-soft);
  color: var(--green);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.icon-btn svg,
.primary-btn svg,
.text-link svg,
.subject-icon svg,
.free-line svg,
.subject-pill svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.theme-toggle .moon-icon,
:root[data-theme="dark"] .theme-toggle .sun-icon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .moon-icon {
  display: inline-grid;
}

.menu-toggle {
  display: none;
}

main {
  width: 100%;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.86fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: center;
  min-height: calc(100vh - 124px);
  padding: clamp(26px, 5vw, 70px) clamp(16px, 4vw, 52px) 28px;
}

.hero-copy,
.hero-panel {
  min-width: 0;
}

.free-line,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-subline {
  width: min(700px, 100%);
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.inline-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(760px, 100%);
  min-height: 62px;
  margin-top: 28px;
  padding: 0 16px;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 8px 8px 0 var(--orange);
}

:root[data-theme="dark"] .inline-search {
  border-color: #ffffff;
}

.inline-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 750;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.subject-tile {
  display: grid;
  align-content: space-between;
  min-height: 250px;
  padding: 18px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--tile-color, var(--green)) 24%, transparent), transparent 36%),
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 76%, transparent), color-mix(in srgb, var(--surface) 52%, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 16px 42px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(20px) saturate(160%);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.subject-tile:hover,
.note-card:hover,
.book-card:hover,
.subject-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.subject-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tile-color, var(--subject-color, var(--green))) 14%, var(--surface));
  color: var(--tile-color, var(--subject-color, var(--green)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.subject-tile strong {
  display: block;
  margin-top: 44px;
  color: var(--black);
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
  font-weight: 900;
}

.subject-tile small,
.note-card small,
.book-card small,
.subject-row small,
.muted {
  color: var(--muted);
}

.content-band,
.page-hero,
.reader-head {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px) 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head.compact {
  align-items: start;
}

.text-link,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 900;
}

.text-link {
  color: var(--green);
}

.primary-btn {
  border: 1px solid var(--black);
  background: var(--black);
  color: #ffffff;
}

.primary-btn:hover {
  background: #000000;
}

.subject-list,
.note-grid,
.book-grid {
  display: grid;
  gap: 12px;
}

.subject-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subject-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.subject-row strong,
.subject-row small {
  display: block;
}

.marker {
  width: 12px;
  height: 44px;
  border-radius: 99px;
  background: var(--marker);
}

.note-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.latest-grid,
.notes-page-grid,
.book-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.note-card,
.book-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 156px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.note-card span,
.book-card span {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.note-card strong,
.book-card strong {
  color: var(--black);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.25;
}

.page-hero.slim {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 520px);
  align-items: end;
  gap: 24px;
  padding-top: 42px;
}

.page-hero.slim h1 {
  font-size: clamp(2.15rem, 5vw, 4.7rem);
}

.page-search {
  width: 100%;
  max-width: none;
  margin: 0;
  box-shadow: 6px 6px 0 var(--orange);
}

.notes-subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.notes-subject-card {
  --subject-color: var(--green);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 112px;
  padding: 16px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--subject-color) 22%, transparent), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 78%, transparent), color-mix(in srgb, var(--surface) 54%, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 14px 34px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px) saturate(160%);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.notes-subject-card:hover,
.notes-subject-card.is-active {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 18px 42px color-mix(in srgb, var(--subject-color) 22%, rgba(0, 0, 0, 0.12));
}

.notes-subject-card.is-active {
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--subject-color) 34%, transparent), transparent 46%),
    linear-gradient(145deg, color-mix(in srgb, var(--subject-color) 10%, var(--surface)), var(--surface));
}

.notes-subject-card .subject-icon {
  --tile-color: var(--subject-color);
  width: 50px;
  height: 50px;
}

:root[data-theme="dark"] .notes-subject-card .subject-icon .icon-layout-grid {
  color: #ffffff;
}

.notes-subject-card strong,
.notes-subject-card small {
  display: block;
}

.notes-subject-card strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.notes-subject-card small {
  color: var(--muted);
  font-size: 0.84rem;
}

.chapter-heading {
  margin-top: 8px;
}

.chapter-card-list {
  display: grid;
  gap: 12px;
}

.chapter-card {
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 82%, transparent), color-mix(in srgb, var(--surface-2) 78%, transparent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    0 12px 30px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px) saturate(145%);
}

.chapter-card[hidden] {
  display: none;
}

.chapter-card-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 88px;
  padding: 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.chapter-card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
}

.chapter-card-copy {
  min-width: 0;
}

.chapter-card-copy strong,
.chapter-card-copy small {
  display: block;
}

.chapter-card-copy strong {
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 900;
}

.chapter-card-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chapter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
}

.chapter-chevron {
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 160ms ease;
}

.chapter-card.is-open .chapter-chevron {
  transform: rotate(180deg);
}

.chapter-panel {
  padding: 0 16px 16px;
}

.chapter-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chapter-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

.live-empty {
  margin-top: 14px;
}

.filter-row,
.chapter-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.filter-row a,
.chapter-strip a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.filter-row a.is-active,
.filter-row a:hover,
.chapter-strip a:hover {
  border-color: var(--green);
  color: var(--green);
}

.chapter-strip small {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 99px;
  background: var(--orange-soft);
  color: var(--ink);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 156px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty-state.wide {
  grid-column: 1 / -1;
}

.empty-state svg {
  width: 36px;
  height: 36px;
  color: var(--orange);
}

.reader-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
}

.reader-head .text-link {
  grid-column: 1 / -1;
  justify-self: start;
  padding-left: 0;
}

.reader-head h1 {
  font-size: clamp(2rem, 5vw, 4.3rem);
}

.reader-frame {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto 40px;
  min-height: 74vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.reader-frame iframe {
  display: block;
  width: 100%;
  min-height: 74vh;
  border: 0;
  background: #ffffff;
}

.book-card svg {
  width: 34px;
  height: 34px;
  color: var(--orange);
}

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  padding: clamp(72px, 9vh, 120px) 16px 16px;
  background: rgba(0, 0, 0, 0.72);
}

.spotlight[aria-hidden="false"] {
  display: block;
}

.spotlight-panel {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 104px));
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.46), 8px 8px 0 var(--green);
}

:root[data-theme="dark"] .spotlight-panel {
  border-color: #ffffff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.9), 8px 8px 0 var(--orange);
}

.spotlight-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 12px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.spotlight-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  font-weight: 750;
}

.spotlight-results {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 12px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--orange) 12%, transparent), transparent 34%),
    var(--surface);
}

.spotlight-empty {
  display: grid;
  gap: 4px;
  min-height: 110px;
  align-content: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.spotlight-empty strong {
  color: var(--ink);
}

.spotlight-item {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--green-soft));
}

.spotlight-item:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.spotlight-item span {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.spotlight-item strong {
  color: var(--ink);
  font-weight: 900;
}

.spotlight-item small {
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer strong {
  color: var(--black);
  font-weight: 900;
}

.site-footer p {
  margin: 4px 0 0;
}

.site-footer a {
  color: var(--green);
  font-weight: 900;
}

.admin-body {
  background: var(--paper);
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
}

.login-card h1 {
  color: var(--black);
  font-size: 2rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  width: min(1380px, calc(100% - 28px));
  margin: 20px auto 46px;
}

.admin-sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.admin-card {
  min-width: 0;
  padding: 18px;
}

.admin-card h1 {
  font-size: 2.4rem;
}

.admin-card h2 {
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.stats-grid,
.admin-grid,
.form-grid,
.file-columns {
  display: grid;
  gap: 12px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid div {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--orange-soft);
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  color: var(--ink);
  font-size: 2rem;
  font-weight: 900;
}

.admin-grid,
.file-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 900;
}

label span {
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.inline-checks {
  display: flex;
  gap: 16px;
  margin: 14px 0;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.alert.error {
  background: #fff0ee;
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.84rem;
}

.action-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-cell form {
  display: inline;
}

.action-cell button,
.file-row button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
}

button.danger,
.danger {
  color: var(--danger);
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.file-row a {
  overflow-wrap: anywhere;
  color: var(--green);
  font-weight: 900;
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-panel {
    align-self: stretch;
  }

  .page-hero.slim {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .page-search {
    margin-top: 0;
  }

  .latest-grid,
  .notes-page-grid,
  .book-grid,
  .notes-subject-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .site-header,
  .admin-header {
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand > span:last-child {
    max-width: 190px;
  }

  .nav-cluster {
    flex: 0 0 auto;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .top-nav {
    position: absolute;
    top: 64px;
    left: 14px;
    right: 14px;
    display: none;
    grid-template-columns: 1fr;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .top-nav.is-open {
    display: grid;
  }

  .top-nav a {
    width: 100%;
  }

  .hero {
    padding-top: 24px;
  }

  .quick-grid,
  .subject-list,
  .note-grid,
  .latest-grid,
  .notes-page-grid,
  .book-grid,
  .notes-subject-grid,
  .chapter-note-grid,
  .stats-grid,
  .admin-grid,
  .form-grid,
  .file-columns {
    grid-template-columns: 1fr;
  }

  .chapter-card-toggle {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    min-height: 96px;
  }

  .chapter-count {
    grid-column: 2 / 3;
    justify-self: start;
  }

  .chapter-chevron {
    grid-column: 3 / 4;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .subject-tile {
    min-height: 148px;
  }

  .subject-tile strong {
    margin-top: 22px;
  }

  .section-head,
  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .page-hero.slim {
    gap: 18px;
  }

  .page-search {
    min-height: 56px;
  }

  .inline-search {
    min-height: 56px;
    box-shadow: 5px 5px 0 var(--orange);
  }

  .reader-head {
    grid-template-columns: 1fr;
  }

  .reader-head .primary-btn,
  .text-link,
  .primary-btn {
    width: 100%;
    white-space: normal;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-header nav {
    justify-content: flex-start;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .admin-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  h1 {
    font-size: clamp(2.65rem, 14vw, 4.8rem);
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 0.76rem;
  }

  .brand > span:last-child {
    max-width: 142px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .content-band,
  .page-hero,
  .reader-head,
  .reader-frame,
  .site-footer {
    width: min(100% - 24px, 1180px);
  }

  .spotlight {
    padding: 78px 10px 10px;
  }

  .spotlight-panel {
    max-height: calc(100vh - 94px);
    box-shadow: 5px 5px 0 var(--green);
  }

  .spotlight-search {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding-left: 12px;
  }

  .spotlight-search .icon-btn {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .inline-search input,
  .spotlight-search input {
    font-size: 1rem;
  }

  .admin-sidebar {
    grid-template-columns: 1fr;
  }
}

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