/* =====================================================================
   ARCHIVE — design tokens
   Palette: ink navy (#16233F) · brass gold (#A9792E) · library sage (#5C7A6B)
   parchment paper (#EFEBE1) · charcoal text (#242220)
   Type: 'Fraunces' (display, used sparingly for titles) +
         'Source Sans 3' (body/UI) + 'IBM Plex Mono' (metadata, ids, timestamps)
   Signature: the "accession stamp" — a rotated ledger-style seal used on
   material cards and the document viewer header, evoking a library's
   physical accession stamp on archived works.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Source+Sans+3:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #16233F;
  --ink-soft: #2A3A5C;
  --gold: #A9792E;
  --gold-soft: #C99A4E;
  --sage: #5C7A6B;
  --paper: #EFEBE1;
  --paper-raised: #F7F4EC;
  --charcoal: #242220;
  --line: #D8D2C2;
}

/* Phone-friendly refinements for the student and author workspace. */
@media (max-width: 767px) {
  body { overflow-x: hidden; }
  main { padding-top: 1.25rem !important; padding-bottom: 1.5rem !important; }
  .card { border-radius: .65rem; }
  .input-field { min-height: 44px; font-size: 16px; }
  .btn-primary, .btn-gold, .btn-outline { min-height: 44px; }
  .status-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .4rem; }
  .status-tab { flex: 0 0 auto; }
  .submission-actions { display: grid; gap: .75rem; }
  .submission-actions .input-field { min-width: 0 !important; width: 100%; }
  .submission-actions button { width: 100%; }
  table { min-width: 560px; }
  .overflow-x-auto { -webkit-overflow-scrolling: touch; }
  #doc-viewer { min-height: 420px; }
  .wf-timeline { overflow-x: auto; }
  .wf-step-label { font-size: .56rem; }
  .action-menu-list { min-width: 150px; }
  .pagination-link, .pagination-current { min-width: 1.8rem; height: 1.8rem; }
  table.ledger-table { min-width: 640px; }
  details.relative > div.absolute, details.action-menu .action-menu-list { right: 0 !important; left: auto !important; width: min(90vw, 300px) !important; max-width: 90vw !important; }
}

* { box-sizing: border-box; }

body {
  background: var(--paper);
  color: var(--charcoal);
  font-family: 'Source Sans 3', system-ui, sans-serif;
  overflow-x: hidden;
}

.font-display { font-family: 'Fraunces', Georgia, serif; }
.font-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

/* =====================================================================
   Library catalog cards — cover art grid used on the public browse page
   and the "related research" style listings.
   ===================================================================== */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}
.lib-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: .6rem;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.lib-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -14px rgba(22,35,63,0.35);
  border-color: var(--gold-soft);
}
.lib-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--ink);
  overflow: hidden;
  flex-shrink: 0;
}
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: .9rem;
  color: #fff;
  background: linear-gradient(155deg, var(--spine-a, var(--ink)) 0%, var(--spine-b, var(--ink-soft)) 100%);
}
.lib-cover-icon { opacity: .8; }
.lib-cover-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .6rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .8;
  border: 1px solid rgba(255,255,255,.4);
  padding: .2rem .5rem;
  border-radius: 999px;
  width: fit-content;
}
.lib-cover-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.28;
}
.lib-cover-badge {
  position: absolute;
  top: .55rem;
  left: .55rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .58rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  padding: .2rem .5rem;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.lib-body { padding: .85rem .95rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.lib-year { font-family: 'IBM Plex Mono', monospace; font-size: .7rem; color: var(--charcoal); opacity: .5; }
.lib-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--ink);
}
.lib-author { font-size: .78rem; color: var(--charcoal); opacity: .65; }
.lib-stats {
  margin-top: auto;
  padding-top: .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  color: var(--charcoal);
  opacity: .55;
}
.lib-stats svg { display: inline-block; vertical-align: -2px; }

/* Accession stamp — signature element */
.accession-stamp {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 3px;
  padding: .15rem .5rem;
  transform: rotate(-2deg);
  background: rgba(169,121,46,0.06);
}

.status-pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
  display: inline-block;
}
.status-draft { background:#e8e4d8; color:#6b6355; }
.status-submitted, .status-under_review { background:#e4e9f2; color:var(--ink); }
.status-revision_required { background:#f4e2c9; color:#8a5a12; }
.status-approved { background:#dbe7de; color:#2f4d3d; }
.status-published { background:#dcecdf; color:var(--sage); border:1px solid var(--sage); }
.status-rejected { background:#f2dbdb; color:#8a2c2c; }
.status-archived { background:#e6e2d6; color:#5c554a; }

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(22,35,63,0.04), 0 8px 24px -16px rgba(22,35,63,0.18);
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  border-radius: 5px;
  padding: .65rem 1.2rem;
  box-shadow: 0 1px 2px rgba(22,35,63,0.08), 0 4px 10px -4px rgba(22,35,63,0.35);
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn-primary:hover { background: var(--ink-soft); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(22,35,63,0.1), 0 8px 16px -6px rgba(22,35,63,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-gold {
  background: var(--gold);
  color: #fff;
  font-weight: 600;
  border-radius: 5px;
  padding: .65rem 1.2rem;
  box-shadow: 0 1px 2px rgba(169,121,46,0.1), 0 4px 10px -4px rgba(169,121,46,0.45);
  transition: background .15s ease, transform .1s ease;
}
.btn-gold:hover { background: #8f6423; transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }

.btn-outline {
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 5px;
  padding: .6rem 1.15rem;
  font-weight: 600;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.btn-outline:hover { background: rgba(22,35,63,0.04); border-color: var(--ink); }

/* .btn-outline defaults to a white background for use on light backgrounds.
   On the dark navy topbar (e.g. the Log out button) that produces invisible
   white-on-white text — override both background and border here with a
   selector specific enough to always win. */
.topbar .btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}
.topbar .btn-outline:hover { background: rgba(255,255,255,0.1); }

.input-field {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: .6rem .8rem;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169,121,46,0.15); }
.input-field:disabled { background: var(--paper); color: rgba(36,34,32,0.55); cursor: not-allowed; }

/* Authentication transitions — visible feedback while sessions open/close. */
.auth-submit-button { min-height: 2.85rem; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.auth-button-idle, .auth-button-loading { align-items: center; justify-content: center; gap: .5rem; }
.auth-button-idle { display: inline-flex; }
.auth-button-loading { display: none; }
.auth-button-idle svg { width: 1rem; height: 1rem; }
.auth-submit-button.is-loading { cursor: wait; opacity: .92; transform: none; }
.auth-submit-button.is-loading .auth-button-idle { display: none; }
.auth-submit-button.is-loading .auth-button-loading { display: inline-flex; }
.auth-submit-button:disabled { cursor: not-allowed; opacity: .62; box-shadow: none; transform: none; }
.login-alert { display: grid; grid-template-columns: 1.65rem minmax(0,1fr); gap: .7rem; align-items: start; margin-bottom: 1rem; padding: .75rem .85rem; color: #8a2c2c; background: #f2dbdb; border: 1px solid rgba(138,44,44,.12); border-radius: .35rem; font-size: .8rem; line-height: 1.45; }
.login-alert-icon { width: 1.65rem; height: 1.65rem; display: grid; place-items: center; color: #8a2c2c; background: rgba(255,255,255,.45); border: 1px solid rgba(138,44,44,.18); border-radius: 50%; font-family: 'IBM Plex Mono', monospace; font-size: .7rem; font-weight: 700; }
.login-alert strong { display: block; font-weight: 600; }
.login-alert p { margin-top: .15rem; color: rgba(138,44,44,.78); }
.login-alert [data-lockout-countdown] { display: inline-block; min-width: 3.1rem; color: #6f1f1f; font-family: 'IBM Plex Mono', monospace; font-weight: 700; letter-spacing: .04em; }
.auth-spinner { width: 1rem; height: 1rem; flex-shrink: 0; border: 2px solid rgba(255,255,255,.32); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-transition-overlay { position: fixed; z-index: 9999; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1.25rem; visibility: hidden; opacity: 0; background: rgba(10,20,39,.72); backdrop-filter: blur(4px); transition: opacity .18s ease, visibility .18s ease; }
.auth-transition-overlay.is-visible { visibility: visible; opacity: 1; }
.auth-transition-card { min-width: min(20rem, 90vw); padding: 1.5rem; color: #fff; text-align: center; background: var(--ink); border: 1px solid rgba(201,154,78,.48); border-radius: .6rem; box-shadow: 0 24px 70px -28px rgba(0,0,0,.9); }
.auth-transition-mark { width: 2.7rem; height: 2.7rem; display: inline-flex; align-items: center; justify-content: center; margin-bottom: .9rem; color: var(--gold-soft); border: 1px solid rgba(201,154,78,.5); border-radius: 50%; }
.auth-transition-mark .auth-spinner { width: 1.15rem; height: 1.15rem; border-color: rgba(201,154,78,.25); border-top-color: var(--gold-soft); }
.auth-transition-card strong { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.auth-transition-card p { margin-top: .35rem; color: rgba(255,255,255,.52); font-family: 'IBM Plex Mono', monospace; font-size: .6rem; letter-spacing: .055em; text-transform: uppercase; }
.login-forgot-link { color: var(--gold); font-family: 'IBM Plex Mono', monospace; font-size: .62rem; letter-spacing: .025em; }
.login-forgot-link:hover { color: #8f6423; text-decoration: underline; text-underline-offset: 2px; }

/* Password recovery — secure, responsive two-panel account flow. */
.auth-recovery-shell { display: grid; grid-template-columns: minmax(18rem, .82fr) minmax(20rem, 1.18fr); max-width: 60rem; min-height: 33rem; margin: 1.5rem auto 3rem; overflow: hidden; background: var(--paper-raised); border: 1px solid var(--line); border-radius: .75rem; box-shadow: 0 20px 55px -38px rgba(22,35,63,.65); }
.auth-recovery-aside { position: relative; isolation: isolate; overflow: hidden; padding: 3rem 2.5rem; color: #fff; background: var(--ink); }
.auth-recovery-aside::before { content: ''; position: absolute; z-index: -1; inset: 0; opacity: .08; background-image: linear-gradient(#fff 1px,transparent 1px),linear-gradient(90deg,#fff 1px,transparent 1px); background-size: 32px 32px; }
.auth-recovery-aside::after { content: ''; position: absolute; z-index: -1; right: -8rem; bottom: -9rem; width: 19rem; height: 19rem; border: 1px solid rgba(201,154,78,.3); border-radius: 50%; box-shadow: 0 0 0 3rem rgba(201,154,78,.035),0 0 0 6rem rgba(201,154,78,.025); }
.auth-recovery-icon { width: 3.25rem; height: 3.25rem; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 2.25rem; color: var(--gold-soft); border: 1px solid rgba(201,154,78,.55); border-radius: .45rem; background: rgba(201,154,78,.08); transform: rotate(-1.5deg); }
.auth-recovery-icon svg { width: 1.65rem; height: 1.65rem; }
.auth-recovery-aside h1 { max-width: 12em; font-family: 'Fraunces', Georgia, serif; font-size: clamp(2rem,4vw,2.65rem); font-weight: 600; line-height: 1.06; }
.auth-recovery-aside > p { max-width: 29rem; margin-top: 1rem; color: rgba(255,255,255,.64); font-size: .9rem; line-height: 1.65; }
.auth-recovery-aside ul { display: grid; gap: .65rem; margin-top: 2rem; }
.auth-recovery-aside li { position: relative; padding-left: 1.2rem; color: rgba(255,255,255,.72); font-family: 'IBM Plex Mono', monospace; font-size: .62rem; line-height: 1.45; }
.auth-recovery-aside li::before { content: ''; position: absolute; left: 0; top: .4rem; width: .38rem; height: .38rem; background: var(--gold-soft); border-radius: 50%; }
.auth-recovery-form-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem,5vw,4rem); }
.auth-recovery-heading { margin-bottom: 1.8rem; }
.auth-recovery-heading h2, .auth-recovery-success h2 { color: var(--ink); font-family: 'Fraunces', Georgia, serif; font-size: clamp(1.75rem,3vw,2.2rem); font-weight: 600; line-height: 1.12; }
.auth-recovery-heading > p { margin-top: .55rem; color: rgba(36,34,32,.58); font-size: .88rem; }
.auth-recovery-form { display: grid; gap: 1rem; }
.auth-recovery-input { position: relative; }
.auth-recovery-input > svg { position: absolute; z-index: 1; left: .85rem; top: 50%; width: 1.05rem; height: 1.05rem; color: rgba(36,34,32,.38); transform: translateY(-50%); pointer-events: none; }
.auth-recovery-input .input-field { min-height: 3rem; padding-left: 2.55rem; }
.auth-recovery-submit { position: relative; min-height: 3rem; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; margin-top: .25rem; overflow: hidden; }
.auth-recovery-submit-idle, .auth-recovery-submit-loading { align-items: center; justify-content: center; gap: .55rem; }
.auth-recovery-submit-idle { display: inline-flex; }
.auth-recovery-submit-loading { display: none; color: #fff; }
.auth-recovery-submit-idle > span { color: var(--gold-soft); transition: transform .15s ease; }
.auth-recovery-submit:hover .auth-recovery-submit-idle > span { transform: translateX(3px); }
.auth-recovery-submit.is-loading { cursor: wait; opacity: .96; transform: none; }
.auth-recovery-submit.is-loading .auth-recovery-submit-idle { display: none; }
.auth-recovery-submit.is-loading .auth-recovery-submit-loading { display: inline-flex; }
.auth-recovery-submit.is-loading::after { content: ''; position: absolute; left: 0; bottom: 0; width: 38%; height: 2px; background: var(--gold-soft); animation: recovery-progress 1.05s ease-in-out infinite; }
.auth-back-link { display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start; margin-top: 1.35rem; color: rgba(36,34,32,.55); font-family: 'IBM Plex Mono', monospace; font-size: .62rem; letter-spacing: .025em; }
.auth-back-link:hover { color: var(--gold); }
.auth-recovery-success { text-align: center; animation: recovery-content-in .48s cubic-bezier(.2,.8,.2,1) both; }
.auth-recovery-success > span { width: 4rem; height: 4rem; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1.25rem; color: var(--sage); background: rgba(92,122,107,.1); border: 1px solid rgba(92,122,107,.35); border-radius: 50%; }
.auth-recovery-success > span svg { width: 1.75rem; height: 1.75rem; }
.auth-recovery-success-mark { animation: recovery-mark-in .62s cubic-bezier(.2,1.4,.4,1) .12s both; }
.auth-recovery-success-mark circle, .auth-recovery-success-mark .auth-recovery-check { stroke-dasharray: 60; stroke-dashoffset: 60; animation: recovery-stroke .72s ease .25s forwards; }
.auth-recovery-success-mark .auth-recovery-check { stroke-dasharray: 14; stroke-dashoffset: 14; animation-delay: .72s; }
.auth-recovery-success > p { max-width: 30rem; margin: .8rem auto 1.5rem; color: rgba(36,34,32,.6); font-size: .88rem; line-height: 1.6; }
.auth-recovery-success .btn-primary { display: flex; justify-content: center; max-width: 18rem; margin: 0 auto; }
.auth-recovery-secondary { display: inline-block; margin-top: 1rem; color: var(--gold); font-size: .76rem; }
.auth-recovery-success.is-error > span { color: #8a2c2c; background: rgba(138,44,44,.08); border-color: rgba(138,44,44,.28); }
.auth-recovery-errors { margin-bottom: 1rem; padding: .8rem 1rem; color: #8a2c2c; background: #f2dbdb; border-left: 3px solid #8a2c2c; border-radius: .3rem; font-size: .78rem; }
.auth-recovery-errors ul { display: grid; gap: .25rem; list-style: disc; padding-left: 1rem; }
.password-requirements { display: grid; grid-template-columns: repeat(2,1fr); gap: .45rem .75rem; padding: .75rem; background: rgba(22,35,63,.035); border: 1px solid var(--line); border-radius: .35rem; }
.password-requirements span { position: relative; padding-left: 1rem; color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .56rem; line-height: 1.35; }
.password-requirements span::before { content: '○'; position: absolute; left: 0; color: rgba(36,34,32,.3); }
.password-requirements span.is-valid { color: var(--sage); }
.password-requirements span.is-valid::before { content: '●'; color: var(--sage); }

@keyframes recovery-progress { 0% { transform: translateX(-110%); } 55%,100% { transform: translateX(265%); } }
@keyframes recovery-content-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes recovery-mark-in { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }
@keyframes recovery-stroke { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .auth-recovery-success, .auth-recovery-success-mark, .auth-recovery-success-mark circle, .auth-recovery-success-mark .auth-recovery-check { animation: none; }
  .auth-recovery-success-mark circle, .auth-recovery-success-mark .auth-recovery-check { stroke-dashoffset: 0; }
  .auth-recovery-submit.is-loading::after { animation-duration: 2s; }
}

@media (max-width: 767px) {
  .auth-recovery-shell { grid-template-columns: 1fr; min-height: 0; margin: 0 auto 2rem; }
  .auth-recovery-aside { padding: 2rem 1.5rem; }
  .auth-recovery-icon { width: 2.7rem; height: 2.7rem; margin-bottom: 1.25rem; }
  .auth-recovery-aside h1 { font-size: 2rem; }
  .auth-recovery-aside ul { display: none; }
  .auth-recovery-form-panel { padding: 2rem 1.25rem; }
}

@media (max-width: 380px) {
  .password-requirements { grid-template-columns: 1fr; }
}

.field-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(36,34,32,0.55);
  margin-bottom: .4rem;
}
.filter-scope { display: inline-block; margin-left: .3rem; padding: .08rem .28rem; color: #77571f; background: rgba(201,154,78,.12); border: 1px solid rgba(201,154,78,.25); border-radius: 999px; font-size: .48rem; letter-spacing: .04em; vertical-align: .08rem; }
#program-filter-group { transition: opacity .15s ease; }
#program-filter-group.is-disabled { opacity: .48; }
#program-filter-group.is-disabled select { cursor: not-allowed; background-color: rgba(255,255,255,.55); }

/* Section header inside a card/panel — small gold rule + Fraunces title,
   used to break a page like "My Profile" into distinct registers rather
   than stacked identical white boxes. */
.form-section-head {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin-bottom: 1.35rem;
}
.form-section-head::before {
  content: '';
  width: 3px;
  align-self: stretch;
  background: var(--gold);
  border-radius: 2px;
}
.form-section-head h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.form-section-sub { font-size: .82rem; color: rgba(36,34,32,0.55); margin-top: .1rem; }

/* Large identity avatar for profile-style pages — echoes the small
   sidebar avatar but sized as a page anchor, initials on a sage tile. */
.avatar-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--sage) 0%, #3f5a4e 100%);
  color: #fff;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -4px rgba(92,122,107,0.5);
}

.topbar { position: relative; z-index: 50; background: var(--ink); border-bottom: 1px solid rgba(201,154,78,.28); box-shadow: 0 8px 24px -20px rgba(4,10,22,.9); }
.public-nav-shell { min-height: 4.75rem; gap: 1.5rem; }
.public-brand { display: inline-flex; align-items: center; gap: .7rem; flex-shrink: 0; color: #fff; }
.public-brand-mark { width: 2.3rem; height: 2.3rem; display: inline-flex; align-items: center; justify-content: center; color: var(--gold-soft); border: 1px solid rgba(201,154,78,.52); border-radius: .35rem; background: rgba(201,154,78,.07); transform: rotate(-1.5deg); }
.public-brand-mark svg { width: 1.2rem; height: 1.2rem; }
.public-brand-name { display: flex; flex-direction: column; font-family: 'Fraunces', Georgia, serif; font-size: 1.2rem; font-weight: 600; line-height: 1; letter-spacing: -.01em; }
.public-brand-name strong { color: #fff; font: inherit; line-height: inherit; white-space: nowrap; }
.public-brand-name strong span { color: var(--gold-soft); }
.public-brand-name small { margin-top: .28rem; color: rgba(255,255,255,.48); font-family: 'IBM Plex Mono', monospace; font-size: .5rem; font-weight: 400; letter-spacing: .11em; text-transform: uppercase; }
.desktop-nav { min-width: 0; flex: 1; align-items: stretch; justify-content: flex-end; gap: 1.35rem; align-self: stretch; }
.desktop-nav-links { display: flex; align-items: stretch; justify-content: flex-end; }
.desktop-nav-link { position: relative; display: inline-flex; align-items: center; padding: 0 .72rem; color: rgba(255,255,255,.68); font-size: .82rem; font-weight: 600; white-space: nowrap; transition: color .15s ease, background .15s ease; }
.desktop-nav-link::after { content: ''; position: absolute; left: .72rem; right: .72rem; bottom: 0; height: 2px; background: var(--gold-soft); transform: scaleX(0); transition: transform .15s ease; }
.desktop-nav-link:hover { color: #fff; background: rgba(255,255,255,.025); }
.desktop-nav-link:hover::after, .desktop-nav-link.is-active::after { transform: scaleX(1); }
.desktop-nav-link.is-active { color: #fff; }
.desktop-nav-account { display: flex; align-items: center; gap: .55rem; padding-left: 1.15rem; border-left: 1px solid rgba(255,255,255,.12); }
.desktop-notification { position: relative; width: 2.4rem; height: 2.4rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: rgba(255,255,255,.68); border: 1px solid transparent; border-radius: .35rem; transition: color .15s ease, background .15s ease, border-color .15s ease; }
.desktop-notification:hover, .desktop-notification.is-active { color: var(--gold-soft); border-color: rgba(201,154,78,.3); background: rgba(201,154,78,.07); }
.desktop-notification svg { width: 1.15rem; height: 1.15rem; }
.desktop-notification > span { position: absolute; right: .15rem; top: .1rem; min-width: 1rem; height: 1rem; display: inline-flex; align-items: center; justify-content: center; padding: 0 .2rem; color: #fff; background: var(--gold); border: 2px solid var(--ink); border-radius: 999px; font-family: 'IBM Plex Mono', monospace; font-size: .48rem; font-weight: 600; }

/* Admin notification center */
.admin-notifications { max-width: 920px; margin: 0 auto; }
.notification-toolbar { min-height: 3.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.25rem; border-bottom: 1px solid rgba(35,33,29,.12); background: rgba(255,255,255,.38); }
.notification-tabs { align-self: stretch; display: flex; gap: 1.5rem; }
.notification-tab { position: relative; display: inline-flex; align-items: center; gap: .45rem; color: rgba(35,33,29,.58); font-family: 'IBM Plex Mono', monospace; font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.notification-tab::after { content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: transparent; }
.notification-tab:hover, .notification-tab.is-active { color: var(--ink); }
.notification-tab.is-active::after { background: var(--gold); }
.notification-tab span { min-width: 1.35rem; padding: .1rem .3rem; border: 1px solid rgba(35,33,29,.14); border-radius: 999px; text-align: center; font-size: .58rem; }
.notification-list { margin: 0; padding: 0; list-style: none; }
.notification-item { position: relative; display: grid; grid-template-columns: 2.75rem minmax(0,1fr) auto; gap: 1rem; padding: 1.25rem; border-bottom: 1px solid rgba(35,33,29,.1); transition: background .15s ease; }
.notification-item:last-child { border-bottom: 0; }
.notification-item:hover { background: rgba(201,154,78,.035); }
.notification-item.is-unread { background: rgba(201,154,78,.075); }
.notification-item.is-unread::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--gold); }
.notification-type-icon { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; color: var(--charcoal); border: 1px solid rgba(35,33,29,.14); border-radius: 50%; background: rgba(255,255,255,.6); }
.notification-type-icon svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.notification-type-check { color: #356347; background: #edf5ef; border-color: #c9ddce; }
.notification-type-alert { color: #8a492c; background: #fbf0e9; border-color: #ead2c4; }
.notification-type-spark { color: #77571f; background: #faf4e5; border-color: #eadcb8; }
.notification-copy { min-width: 0; }
.notification-category { color: rgba(35,33,29,.52); font-family: 'IBM Plex Mono', monospace; font-size: .62rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.notification-new { padding: .12rem .42rem; color: #77571f; background: rgba(201,154,78,.14); border: 1px solid rgba(201,154,78,.3); border-radius: 999px; font-family: 'IBM Plex Mono', monospace; font-size: .55rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.notification-copy h2 { color: var(--ink); font-family: 'Cormorant Garamond', serif; font-size: 1.18rem; font-weight: 650; line-height: 1.25; }
.notification-copy > p { max-width: 650px; margin-top: .25rem; color: rgba(35,33,29,.68); font-size: .86rem; line-height: 1.55; }
.notification-actions { display: flex; align-items: center; gap: 1rem; margin-top: .65rem; }
.notification-link { color: #8b6428; font-size: .74rem; font-weight: 600; }
.notification-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.notification-time { padding-top: .15rem; color: rgba(35,33,29,.45); font-family: 'IBM Plex Mono', monospace; font-size: .65rem; white-space: nowrap; }
.notification-empty { display: flex; min-height: 340px; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem; text-align: center; }
.notification-empty-icon { width: 4rem; height: 4rem; display: grid; place-items: center; margin-bottom: 1.25rem; color: rgba(35,33,29,.42); border: 1px solid rgba(35,33,29,.13); border-radius: 50%; background: rgba(255,255,255,.55); }
.notification-empty-icon svg { width: 1.65rem; height: 1.65rem; }
.notification-empty h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.45rem; font-weight: 650; }
.notification-empty p { max-width: 360px; margin-top: .35rem; color: rgba(35,33,29,.55); font-size: .85rem; }
@media (max-width: 640px) {
  .notification-toolbar { padding: 0 1rem; }
  .notification-item { grid-template-columns: 2.4rem minmax(0,1fr); gap: .8rem; padding: 1rem; }
  .notification-type-icon { width: 2.4rem; height: 2.4rem; }
  .notification-time { grid-column: 2; padding: 0; }
  .notification-copy h2 { font-size: 1.08rem; }
}
.desktop-user { display: grid; grid-template-columns: 2rem auto; align-items: center; gap: .55rem; min-width: 0; padding: .35rem .5rem; color: #fff; border: 1px solid transparent; border-radius: .4rem; transition: border-color .15s ease, background .15s ease; }
.desktop-user:hover, .desktop-user.is-active { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.045); }
.desktop-user-avatar { width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: var(--gold-soft); border-radius: .3rem; font-family: 'Fraunces', Georgia, serif; font-size: .85rem; font-weight: 700; }
.desktop-user > span:last-child { min-width: 0; }
.desktop-user strong { display: block; max-width: 8.5rem; overflow: hidden; color: #fff; font-size: .78rem; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.desktop-user small { display: block; margin-top: .17rem; color: rgba(255,255,255,.4); font-family: 'IBM Plex Mono', monospace; font-size: .5rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.desktop-logout { min-height: 2.4rem; display: inline-flex; align-items: center; gap: .4rem; padding: 0 .72rem; color: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.25); border-radius: .35rem; font-family: 'IBM Plex Mono', monospace; font-size: .62rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.desktop-logout svg { width: .95rem; height: .95rem; }
.desktop-logout:hover { color: #fff; border-color: var(--gold-soft); background: rgba(201,154,78,.08); }
.desktop-guest-actions .desktop-login { color: rgba(255,255,255,.75); font-weight: 600; font-size: .82rem; padding: .65rem; }
.desktop-guest-actions .desktop-login:hover { color: var(--gold-soft); }
.desktop-guest-actions .btn-gold { padding: .6rem 1rem; font-size: .8rem; white-space: nowrap; }

@media (max-width: 1150px) {
  .public-brand .accession-stamp { display: none !important; }
  .desktop-nav { gap: .8rem; }
  .desktop-nav-account { padding-left: .8rem; }
  .desktop-nav-link { padding-left: .55rem; padding-right: .55rem; }
  .desktop-nav-link::after { left: .55rem; right: .55rem; }
  .desktop-user small { display: none; }
  .desktop-user strong { max-width: 6rem; }
  .desktop-logout span { display: none; }
}

@media (max-width: 640px) {
  .public-nav-shell { min-height: 4.35rem; }
  .public-brand-mark { display: none; }
}

/* Mobile public navigation — compact archive directory panel. */
.mobile-nav { position: relative; }
.mobile-nav > summary {
  list-style: none;
  min-width: 5.25rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  cursor: pointer;
  color: #fff;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: .4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.mobile-nav > summary::-webkit-details-marker { display: none; }
.mobile-nav > summary:hover, .mobile-nav[open] > summary { color: var(--gold-soft); border-color: var(--gold-soft); background: rgba(255,255,255,.05); }
.mobile-nav > summary svg { width: 1.05rem; height: 1.05rem; }
.mobile-nav-close-icon { display: none; }
.mobile-nav[open] .mobile-nav-menu-icon { display: none; }
.mobile-nav[open] .mobile-nav-close-icon { display: block; }
.mobile-nav-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + .8rem);
  right: 0;
  width: min(22rem, calc(100vw - 2rem));
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #fff;
  background: #111d35;
  border: 1px solid rgba(255,255,255,.12);
  border-top: 2px solid var(--gold);
  border-radius: .55rem;
  box-shadow: 0 24px 60px -22px rgba(5,12,26,.85);
  animation: mobile-nav-in .16s ease-out;
}
@keyframes mobile-nav-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.mobile-nav-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; padding: 1.15rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.025); }
.mobile-nav-panel-head strong { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 1.05rem; font-weight: 600; line-height: 1.2; }
.mobile-nav-kicker, .mobile-nav-group-label { display: block; font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-soft); }
.mobile-nav-kicker { margin-bottom: .35rem; }
.mobile-nav-panel-head .accession-stamp { flex-shrink: 0; font-size: .5rem; color: var(--gold-soft); border-color: var(--gold-soft); background: rgba(201,154,78,.08); }
.mobile-nav-group { padding: .85rem .65rem .45rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.mobile-nav-group-label { padding: 0 .55rem .45rem; color: rgba(255,255,255,.38); }
.mobile-nav-link { position: relative; display: grid; grid-template-columns: 1.35rem 1fr auto; align-items: center; gap: .7rem; min-height: 3.45rem; padding: .55rem .65rem; color: rgba(255,255,255,.82); border-radius: .35rem; transition: color .12s ease, background .12s ease; }
.mobile-nav-link > svg { width: 1.15rem; height: 1.15rem; color: rgba(255,255,255,.48); }
.mobile-nav-link > span { min-width: 0; font-weight: 600; font-size: .88rem; line-height: 1.2; }
.mobile-nav-link small { display: block; margin-top: .2rem; color: rgba(255,255,255,.4); font-family: 'IBM Plex Mono', monospace; font-size: .57rem; font-weight: 400; letter-spacing: .015em; }
.mobile-nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.mobile-nav-link:hover > svg { color: var(--gold-soft); }
.mobile-nav-link.is-active { color: #fff; background: rgba(169,121,46,.13); }
.mobile-nav-link.is-active::before { content: ''; position: absolute; left: 0; top: .7rem; bottom: .7rem; width: 2px; background: var(--gold-soft); border-radius: 2px; }
.mobile-nav-link.is-active > svg { color: var(--gold-soft); }
.mobile-nav-count { min-width: 1.35rem; height: 1.35rem; display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem; color: #fff; background: var(--gold); border-radius: 999px; font-family: 'IBM Plex Mono', monospace; font-size: .58rem; }
.mobile-nav-footer { padding: .8rem 1.2rem 1rem; }
.mobile-nav-footer a { display: inline-flex; align-items: center; gap: .5rem; color: var(--gold-soft); font-family: 'IBM Plex Mono', monospace; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }
.mobile-nav-footer svg { width: 1rem; height: 1rem; }
.mobile-nav-footer a:hover { color: #fff; }
.mobile-nav-auth { display: grid; grid-template-columns: 1fr 1.35fr; gap: .65rem; padding: 1rem; }
.mobile-nav-auth a { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; text-align: center; }

@media (max-width: 420px) {
  .mobile-nav-panel { position: fixed; top: 4.35rem; right: .65rem; left: .65rem; width: auto; max-height: calc(100vh - 5rem); }
  .mobile-nav-panel-head { padding: 1rem; }
}

/* =====================================================================
   PUBLIC REPOSITORY — institutional home and searchable catalog
   ===================================================================== */
.archive-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  background: var(--ink);
  border-radius: 0 0 1.25rem 1.25rem;
  margin: -2rem calc(50% - 50vw) 0;
  padding: clamp(3.5rem, 8vw, 6.5rem) max(1rem, calc((100vw - 80rem) / 2 + 1.5rem)) 3.5rem;
}
.archive-hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 42px 42px;
  mask-image: linear-gradient(to right, transparent, #000 45%, #000);
}
.archive-hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  width: 30rem;
  height: 30rem;
  right: -9rem;
  top: -13rem;
  border: 1px solid rgba(201,154,78,.22);
  border-radius: 50%;
  box-shadow: 0 0 0 5rem rgba(201,154,78,.035), 0 0 0 10rem rgba(201,154,78,.025);
}
.archive-hero-copy { max-width: 54rem; }
.archive-eyebrow {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .13em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: .8rem;
}
.archive-hero h1 {
  max-width: 13em;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: .99;
}
.archive-hero h1 em { color: var(--gold-soft); font-weight: 400; }
.archive-hero-copy > p { max-width: 42rem; color: rgba(255,255,255,.7); font-size: 1.05rem; line-height: 1.65; margin-top: 1.35rem; }
.archive-search { max-width: 62rem; margin-top: 2.25rem; }
.archive-search-label { display: block; font-weight: 600; font-size: .8rem; margin-bottom: .55rem; }
.archive-search-row { display: flex; gap: .65rem; }
.archive-search-input-wrap { position: relative; flex: 1; min-width: 0; }
.archive-search-input-wrap svg { position: absolute; left: 1rem; top: 50%; width: 1.2rem; height: 1.2rem; color: var(--ink); opacity: .5; transform: translateY(-50%); pointer-events: none; }
.archive-search-input-wrap input { width: 100%; min-height: 3.35rem; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: .75rem 1rem .75rem 3rem; color: var(--charcoal); background: #fff; font-size: 1rem; }
.archive-search-input-wrap input:focus { outline: 3px solid rgba(201,154,78,.35); border-color: var(--gold-soft); }
.archive-search-button { min-width: 10rem; }
.archive-search-links { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem 1rem; margin-top: .8rem; font-size: .78rem; color: rgba(255,255,255,.55); }
.archive-search-links a { color: rgba(255,255,255,.85); text-decoration: underline; text-decoration-color: rgba(201,154,78,.55); text-underline-offset: 3px; }
.archive-search-links a:hover { color: var(--gold-soft); }

.archive-tally { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 68rem; margin: -1.2rem auto 4.5rem; position: relative; z-index: 2; background: var(--paper-raised); border: 1px solid var(--line); border-radius: .65rem; box-shadow: 0 16px 36px -25px rgba(22,35,63,.55); }
.archive-tally > div { padding: 1.15rem 1.4rem; border-right: 1px solid var(--line); }
.archive-tally > div:last-child { border-right: 0; }
.archive-tally strong { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 1.65rem; line-height: 1; color: var(--ink); }
.archive-tally span { display: block; margin-top: .4rem; font-family: 'IBM Plex Mono', monospace; font-size: .62rem; letter-spacing: .05em; text-transform: uppercase; color: rgba(36,34,32,.55); }
.archive-section { scroll-margin-top: 1rem; margin-bottom: 4.5rem; }
.archive-section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.archive-section-head h2 { font-family: 'Fraunces', Georgia, serif; font-size: clamp(1.8rem, 4vw, 2.55rem); font-weight: 600; color: var(--ink); line-height: 1.1; }
.archive-section-head p { color: rgba(36,34,32,.62); margin-top: .35rem; }
.archive-text-link { flex-shrink: 0; color: var(--ink); font-weight: 600; font-size: .85rem; }
.archive-text-link:hover { color: var(--gold); }
.archive-category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.archive-category-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .35rem .85rem; min-height: 8.5rem; padding: 1.15rem; overflow: hidden; background: var(--paper-raised); border: 1px solid var(--line); border-radius: .55rem; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.archive-category-card:hover { transform: translateY(-2px); border-color: var(--gold-soft); box-shadow: 0 12px 24px -18px rgba(22,35,63,.5); }
.archive-category-number { grid-row: span 2; font-family: 'IBM Plex Mono', monospace; font-size: .65rem; color: var(--gold); padding-top: .2rem; }
.archive-category-name { align-self: end; font-family: 'Fraunces', Georgia, serif; font-size: 1.2rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.archive-category-count { font-family: 'IBM Plex Mono', monospace; font-size: .65rem; color: rgba(36,34,32,.5); }
.archive-category-arrow { position: absolute; right: 1rem; top: .8rem; color: var(--gold); }
.archive-catalog { scroll-margin-top: 5rem; background: rgba(247,244,236,.65); border: 1px solid var(--line); border-radius: .8rem; padding: clamp(1rem, 3vw, 2rem); }
.archive-filter-panel { padding: 1.25rem; margin-bottom: 2rem; box-shadow: none; }
.site-footer { margin-top: auto; color: rgba(255,255,255,.68); background: #101a30; border-top: 3px solid var(--gold); }
.site-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; }
.site-footer-brand { display: inline-block; font-family: 'Fraunces', Georgia, serif; font-size: 1.55rem; font-weight: 600; color: #fff; margin-bottom: .7rem; }
.site-footer-brand span { color: var(--gold-soft); }
.site-footer-grid > div p { max-width: 28rem; line-height: 1.6; font-size: .88rem; }
.site-footer nav { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; font-size: .84rem; }
.site-footer nav strong { color: #fff; font-family: 'IBM Plex Mono', monospace; font-size: .65rem; letter-spacing: .09em; text-transform: uppercase; margin-bottom: .3rem; }
.site-footer nav a:hover { color: var(--gold-soft); }
.site-footer-bottom { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(255,255,255,.12); font-family: 'IBM Plex Mono', monospace; font-size: .65rem; }
.site-footer--workspace { border-top-width: 2px; }
.site-footer-workspace-inner { min-height: 5.25rem; max-width: 80rem; display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 2.5rem; margin: 0 auto; padding: 1rem 1.5rem; }
.site-footer-workspace-brand { min-width: 0; display: flex; align-items: baseline; gap: 1rem; }
.site-footer-workspace-brand a { color: #fff; font-family: 'Fraunces', Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.site-footer-workspace-brand a span { color: var(--gold-soft); }
.site-footer-workspace-brand p { overflow: hidden; color: rgba(255,255,255,.46); font-family: 'IBM Plex Mono', monospace; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.site-footer--workspace nav { display: flex; flex-direction: row; align-items: center; gap: 1.35rem; }
.site-footer--workspace nav a { color: rgba(255,255,255,.68); font-size: .74rem; white-space: nowrap; }
.site-footer--workspace nav a:hover { color: var(--gold-soft); }
.site-footer-security { display: inline-flex; align-items: center; gap: .45rem; color: rgba(255,255,255,.48); font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.site-footer-security i { width: .42rem; height: .42rem; background: var(--sage); border-radius: 50%; box-shadow: 0 0 0 3px rgba(95,130,113,.15); }

@media (max-width: 900px) {
  .archive-category-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .archive-hero { margin-top: -1.25rem; padding-top: 3.25rem; padding-bottom: 2.8rem; border-radius: 0 0 .8rem .8rem; }
  .archive-hero-copy > p { font-size: .95rem; }
  .archive-search-row { flex-direction: column; }
  .archive-search-button { width: 100%; min-height: 3rem; }
  .archive-tally { grid-template-columns: repeat(2, 1fr); margin: -1rem 0 3.25rem; }
  .archive-tally > div { padding: 1rem; }
  .archive-tally > div:nth-child(2) { border-right: 0; }
  .archive-tally > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .archive-tally strong { font-size: 1.4rem; }
  .archive-section { margin-bottom: 3.25rem; }
  .archive-section-head { align-items: flex-start; flex-direction: column; }
  .archive-category-grid { grid-template-columns: 1fr; }
  .archive-category-card { min-height: 7.25rem; }
  .archive-catalog { margin-left: -.5rem; margin-right: -.5rem; padding: 1rem .65rem; }
  .archive-filter-panel { padding: 1rem; }
  .archive-catalog-heading .accession-stamp { align-self: flex-start; }
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .lib-cover-title { font-size: .78rem; }
  .lib-body { padding: .7rem; }
  .lib-title { font-size: .9rem; }
  .lib-stats { align-items: flex-start; flex-direction: column; }
  .site-footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem 1rem; }
  .site-footer-grid > div { grid-column: 1 / -1; }
  .site-footer-bottom { flex-direction: column; }
  .site-footer-workspace-inner { grid-template-columns: 1fr auto; gap: .75rem 1rem; padding: 1rem; }
  .site-footer-workspace-brand { display: block; }
  .site-footer-workspace-brand p { margin-top: .2rem; }
  .site-footer--workspace nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: 1rem; padding-top: .7rem; border-top: 1px solid rgba(255,255,255,.1); }
  .site-footer-security { grid-column: 2; grid-row: 1; }
}
@media (max-width: 480px) {
  .site-footer-security { display: none; }
  .site-footer-workspace-inner { grid-template-columns: 1fr; }
  .site-footer--workspace nav { grid-column: 1; }
}
@media (max-width: 360px) {
  .lib-grid { grid-template-columns: 1fr; }
  .archive-tally { grid-template-columns: 1fr; }
  .archive-tally > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .archive-tally > div:last-child { border-bottom: 0; }
}

.pdf-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 10;
}
.pdf-watermark span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  color: rgba(22,35,63,0.14);
  transform: rotate(-28deg);
  white-space: nowrap;
}

/* =====================================================================
   PROTECTED PDF VIEWER — canvas-rendered pages (PDF.js), no native
   browser PDF plugin involved, so there is no built-in download/print
   toolbar. See student/view.php + public/assets/js/pdf-viewer.js.
   ===================================================================== */
.pdf-viewer-shell { position: relative; background: #E9E4D8; user-select: none; -webkit-user-select: none; }
.pdf-viewer-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0; }
.pdf-page-canvas { box-shadow: 0 2px 10px rgba(22,35,63,0.18); max-width: 96%; background: #fff; }
.pdf-viewer-toolbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: rgba(251,249,244,0.96); backdrop-filter: blur(2px); border-bottom: 1px solid var(--line); font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; }
.pdf-viewer-toolbar button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
.pdf-viewer-toolbar button:disabled { opacity: 0.35; cursor: not-allowed; }
.pdf-viewer-toolbar button:not(:disabled):hover { background: var(--paper); }
.pdf-viewer-status { padding: 40px 16px; text-align: center; font-size: 0.85rem; color: var(--charcoal); opacity: 0.65; }
@media print {
  body * { visibility: hidden !important; }
  body::after {
    content: "Printing is disabled for protected repository documents.";
    visibility: visible; position: fixed; inset: 0; display: flex; align-items: center;
    justify-content: center; padding: 40px; font-family: 'IBM Plex Mono', monospace; text-align: center;
  }
}

/* =====================================================================
   ADMIN SHELL — sidebar layout for /admin/*
   Same design tokens as the public site; the sidebar reuses --ink as
   a dark "reading room" panel, with a gold rail marking the active
   section — a quieter echo of the accession stamp motif.
   ===================================================================== */

.admin-body { background: var(--paper); color: var(--charcoal); font-family: 'Source Sans 3', system-ui, sans-serif; }

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  background: linear-gradient(180deg, var(--ink) 0%, #101b32 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.admin-sidebar.is-open { transform: translateX(0); }

.admin-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  padding: 1.35rem 1.25rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar-close { color: rgba(255,255,255,0.6); margin-top: .2rem; }
.admin-sidebar-close:hover { color: #fff; }

/* The sidebar reuses the site's own accession-stamp motif (see the public
   topbar) as its badge, rather than a generic logo tile — same rotated
   ledger-seal, tuned for the dark panel. */
.admin-brand .accession-stamp {
  color: var(--gold-soft);
  border-color: var(--gold-soft);
  background: rgba(201,154,78,0.1);
}

.admin-user-role {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

/* Nav reads as an index list — hairline dividers and mono uppercase
   labels, like tab captions on a card-catalog drawer, not rounded
   SaaS pills. Active row gets a brass tab flagged on the right edge. */
.admin-nav {
  flex: 1;
  overflow-y: auto;
  padding-top: .4rem;
}
.admin-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1.35rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.58);
  border-top: 1px solid rgba(255,255,255,0.08);
  transition: background .12s ease, color .12s ease;
}
.admin-nav .admin-nav-link:first-child { border-top: none; }
.admin-nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: .75; }
.admin-nav-link:hover { background: rgba(255,255,255,0.04); color: #fff; }
.admin-nav-link:hover .admin-nav-icon { opacity: 1; }
.admin-nav-link.is-active {
  background: rgba(169,121,46,0.1);
  color: var(--gold-soft);
}
.admin-nav-link.is-active .admin-nav-icon { opacity: 1; color: var(--gold-soft); }
.admin-nav-link.is-active::after {
  content: '';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 62%;
  background: var(--gold-soft);
  border-radius: 2px 0 0 2px;
}
.admin-nav-link--muted { color: rgba(255,255,255,0.42); border-top: none; padding: .55rem 1.35rem; }
.admin-nav-code {
  font-size: .62rem;
  letter-spacing: .06em;
  color: rgba(255,255,255,0.25);
}
.admin-nav-link.is-active .admin-nav-code { color: rgba(201,154,78,0.55); }

.admin-nav-badge {
  background: var(--gold);
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  font-weight: 600;
  border-radius: 999px;
  padding: .05rem .45rem;
  line-height: 1.5;
}

.admin-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: .6rem .75rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.admin-user-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .7rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  margin-top: .3rem;
}
.admin-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 4px;
  background: var(--sage);
  color: #fff;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  flex-shrink: 0;
}
.admin-logout-btn {
  color: rgba(255,255,255,0.5);
  padding: .3rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.admin-logout-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,27,50,0.5);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.admin-overlay.is-visible { opacity: 1; pointer-events: auto; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .9rem;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
  padding: .9rem 1.25rem;
}
.admin-menu-btn { color: var(--ink); flex-shrink: 0; }
.admin-page-title { font-family: 'Fraunces', Georgia, serif; font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.admin-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.admin-pending-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #8a5a12;
  background: #f4e2c9;
  border-radius: 999px;
  padding: .3rem .7rem;
  white-space: nowrap;
}
.admin-pending-pill:hover { background: #efd6ac; }

.admin-content {
  flex: 1;
  width: 100%;
  padding: 1.75rem 1.25rem 3rem;
}

.admin-page-subtitle { color: rgba(36,34,32,0.65); font-size: .95rem; }

/* Submissions review — status tabs, cards, empty state */
.status-tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
  overflow-x: auto;
}
.status-tab {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(36,34,32,0.5);
  padding: .1rem .05rem .8rem;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.status-tab:hover { color: var(--ink); }
.status-tab.is-active { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }
.status-tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--line)); flex-shrink: 0; }
.status-tab-count {
  background: rgba(36,34,32,0.08);
  color: var(--charcoal);
  font-size: .64rem;
  border-radius: 999px;
  padding: .05rem .42rem;
  line-height: 1.5;
}
.status-tab.is-active .status-tab-count { background: var(--ink); color: #fff; }

.submission-card {
  position: relative;
  border-left: 3px solid var(--accent, var(--line));
}
.submission-cover {
  width: 36px; height: 48px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.submission-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: .85rem;
  flex-shrink: 0;
}
.submission-type-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .64rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(22,35,63,0.06);
  border-radius: 4px;
  padding: .18rem .5rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.submission-waiting {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  color: rgba(36,34,32,0.45);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.submission-actions {
  border-top: 1px dashed var(--line);
  margin-top: 1.1rem;
  padding-top: 1.1rem;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 4rem 1.5rem;
  text-align: center;
  color: rgba(36,34,32,0.45);
}
.empty-state svg { margin: 0 auto .9rem; opacity: .55; }
.empty-state p { font-size: .9rem; font-family: 'IBM Plex Mono', monospace; letter-spacing: .02em; }

/* Dashboard ledger components — the tally strip, review table, and
   activity log all read as ruled pages of a register rather than a
   grid of identical stat cards. */
.ledger-tally {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.ledger-tally-item {
  padding: 1rem 1.3rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ledger-tally-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .64rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(36,34,32,0.5);
  margin-bottom: .35rem;
}
.ledger-tally-value { font-family: 'Fraunces', Georgia, serif; font-size: 1.85rem; font-weight: 600; line-height: 1; }
.ledger-tally-item.is-flagged { background: rgba(169,121,46,0.08); }
.ledger-tally-item.is-flagged .ledger-tally-value { color: var(--gold); }
.ledger-tally-item.is-flagged .ledger-tally-label { color: #8a5a12; }
a.ledger-tally-item { display: block; text-decoration: none; color: inherit; transition: background .15s ease; cursor: pointer; }
a.ledger-tally-item:hover { background: rgba(22,35,63,0.045); }
a.ledger-tally-item.is-flagged:hover { background: rgba(169,121,46,0.14); }

.ledger-panel { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ledger-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.ledger-panel-head h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.05rem; font-weight: 600; }
.ledger-panel-link { font-family: 'IBM Plex Mono', monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); white-space: nowrap; }
.ledger-panel-link:hover { color: #8f6423; }
.ledger-empty { padding: 1.5rem 1.1rem; font-size: .875rem; color: rgba(36,34,32,0.55); }

.ledger-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ledger-table thead th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(36,34,32,0.5);
  font-weight: 500;
  padding: .55rem 1.1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ledger-table tbody td { padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ledger-table tbody tr:last-child td { border-bottom: none; }
.ledger-table tbody tr:hover { background: rgba(169,121,46,0.045); }
.ledger-table .ledger-waiting { font-family: 'IBM Plex Mono', monospace; font-size: .78rem; color: rgba(36,34,32,0.6); white-space: nowrap; }
.ledger-table .ledger-waiting.is-overdue { color: #8a2c2c; }

/* Filter chips + pagination — shared across admin management tables and
   the public repository search so browsing feels like one consistent
   catalog experience rather than page-specific widgets. */
.filter-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: 'IBM Plex Mono', monospace; font-size: .7rem; letter-spacing: .02em;
  background: rgba(22,35,63,0.06); color: var(--ink);
  border: 1px solid rgba(22,35,63,0.15); border-radius: 999px;
  padding: .28rem .5rem .28rem .7rem;
}
.filter-chip a { color: rgba(22,35,63,0.5); line-height: 1; }
.filter-chip a:hover { color: #8a2c2c; }
.pagination { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.pagination-link, .pagination-current, .pagination-ellipsis {
  min-width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-size: .78rem; border-radius: 4px; padding: 0 .4rem;
}
.pagination-link { border: 1px solid var(--line); color: var(--charcoal); text-decoration: none; }
.pagination-link:hover { background: rgba(22,35,63,0.06); border-color: var(--ink); }
.pagination-current { background: var(--ink); color: #fff; }
.pagination-ellipsis { color: rgba(36,34,32,0.4); }
.action-menu { position: relative; }
.action-menu > summary { list-style: none; cursor: pointer; width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; border: 1px solid var(--line); }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu > summary:hover { background: rgba(22,35,63,0.06); }
.action-menu[open] > summary { border-color: var(--ink); }
.action-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px -8px rgba(22,35,63,0.25); padding: .35rem; }
.action-menu-list a, .action-menu-list button { display: block; width: 100%; text-align: left; padding: .45rem .6rem; font-size: .82rem; border-radius: 4px; color: var(--charcoal); }
.action-menu-list a:hover, .action-menu-list button:hover { background: rgba(22,35,63,0.06); }
.action-menu-list .is-danger { color: #8a2c2c; }
.action-menu-list .is-danger:hover { background: rgba(138,44,44,0.08); }

/* Admin repository materials workspace. Sidebar styles remain independent. */
.materials-page-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2rem; margin-bottom: 2.25rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.materials-page-copy .archive-eyebrow { margin-bottom: .45rem; }
.materials-page-copy h1 { color: var(--ink); font-family: 'Fraunces', Georgia, serif; font-size: clamp(2rem, 3vw, 2.65rem); font-weight: 600; line-height: 1.05; }
.materials-page-copy p { max-width: 45rem; margin-top: .55rem; color: rgba(36,34,32,.6); font-size: .92rem; }
.materials-summary { display: grid; grid-template-columns: repeat(4, minmax(6.5rem, 1fr)); overflow: hidden; background: var(--paper-raised); border: 1px solid var(--line); border-radius: .55rem; }
.materials-summary > div { min-width: 0; padding: .85rem 1rem; border-right: 1px solid var(--line); }
.materials-summary > div:last-child { border-right: 0; }
.materials-summary strong { display: block; color: var(--ink); font-family: 'Fraunces', Georgia, serif; font-size: 1.45rem; line-height: 1; }
.materials-summary span { display: block; margin-top: .35rem; color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .55rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.materials-layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; align-items: start; gap: 1.5rem; }
.materials-primary { min-width: 0; scroll-margin-top: 5.5rem; }
.materials-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.materials-section-head h2, .materials-category-card h2 { color: var(--ink); font-family: 'Fraunces', Georgia, serif; font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.materials-section-kicker { display: block; margin-bottom: .3rem; color: var(--gold); font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .09em; text-transform: uppercase; }
.materials-result-count { color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .65rem; text-transform: uppercase; }
.materials-result-count strong { color: var(--ink); font-size: .8rem; }
.materials-filter-bar { position: relative; z-index: 5; margin-bottom: 1rem; padding: 1rem; box-shadow: none; }
.materials-filter-main { display: grid; grid-template-columns: minmax(13rem, 1.6fr) repeat(3, minmax(8rem, 1fr)); align-items: end; gap: .75rem; }
.materials-search-field > label, .materials-filter-main .field-label { display: block; margin-bottom: .35rem; color: rgba(36,34,32,.52); font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; }
.materials-search-field > div { position: relative; }
.materials-search-field svg { position: absolute; left: .75rem; top: 50%; width: 1rem; height: 1rem; color: rgba(36,34,32,.4); transform: translateY(-50%); pointer-events: none; }
.materials-search-field input { padding-left: 2.25rem; }
.materials-more-filters { position: relative; }
.materials-filter-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: .65rem; padding-top: .1rem; }
.materials-more-filters > summary { min-height: 2.7rem; display: inline-flex; align-items: center; gap: .45rem; list-style: none; cursor: pointer; white-space: nowrap; }
.materials-more-filters > summary::-webkit-details-marker { display: none; }
.materials-more-filters[open] > summary { border-color: var(--gold); }
.materials-more-filters > summary span { color: var(--gold); }
.materials-filter-popover { position: absolute; z-index: 30; right: 0; top: calc(100% + .55rem); width: 19rem; display: grid; gap: .75rem; padding: 1rem; box-shadow: 0 18px 35px -20px rgba(22,35,63,.55); }
.materials-apply { min-height: 2.7rem; white-space: nowrap; }
.materials-table-wrap { position: relative; z-index: 1; overflow: visible; box-shadow: none; }
.materials-table { table-layout: fixed; }
.materials-table th:first-child { width: 31%; }
.materials-table th:nth-child(2) { width: 10%; }
.materials-table th:nth-child(3) { width: 20%; }
.materials-table th:nth-child(4) { width: 14%; }
.materials-table th:nth-child(5) { width: 13%; }
.materials-table th:last-child { width: 4.25rem; }
.materials-table tbody td { padding-top: .9rem; padding-bottom: .9rem; }
.materials-record { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.materials-record-cover { width: 2.65rem; height: 3.55rem; flex-shrink: 0; object-fit: cover; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: .25rem; box-shadow: 0 3px 8px -5px rgba(22,35,63,.45); }
.materials-record-placeholder { display: inline-flex; align-items: center; justify-content: center; color: rgba(36,34,32,.34); font-family: 'IBM Plex Mono', monospace; font-size: .54rem; letter-spacing: .05em; }
.materials-record-copy { min-width: 0; }
.materials-record-copy a { display: -webkit-box; overflow: hidden; color: var(--ink); font-weight: 600; font-size: .88rem; line-height: 1.3; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.materials-record-copy a:hover { color: var(--gold); }
.materials-record-copy p { margin-top: .25rem; overflow: hidden; color: rgba(36,34,32,.5); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.materials-type { display: block; color: var(--charcoal); font-size: .8rem; }
.materials-table td:nth-child(2) small { display: block; margin-top: .2rem; color: rgba(36,34,32,.45); font-family: 'IBM Plex Mono', monospace; font-size: .62rem; }
.materials-program { display: -webkit-box; overflow: hidden; color: rgba(36,34,32,.65); font-size: .8rem; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.materials-engagement { display: flex; align-items: center; gap: .7rem; }
.materials-engagement span { display: inline-flex; align-items: center; gap: .28rem; color: rgba(36,34,32,.65); font-family: 'IBM Plex Mono', monospace; font-size: .68rem; }
.materials-engagement svg { width: .95rem; height: .95rem; flex-shrink: 0; color: var(--sage); }
.materials-engagement .materials-view-icon { width: 1.05rem; height: 1.05rem; color: var(--ink-soft); }
.materials-engagement b { color: var(--charcoal); font-weight: 500; }
.materials-engagement small { display: none; color: rgba(36,34,32,.42); font-size: .55rem; }
.materials-actions-cell { text-align: right; }
.materials-actions-cell .action-menu { display: inline-block; text-align: left; }
.materials-actions-cell .action-menu > summary { width: 2.15rem; height: 2.15rem; background: #fff; }
.materials-actions-cell .action-menu-list { min-width: 11.5rem; }
.materials-actions-cell .action-menu-list label { display: block; width: 100%; padding: .45rem .6rem; color: var(--charcoal); border-radius: 4px; cursor: pointer; font-size: .82rem; }
.materials-actions-cell .action-menu-list label:hover { background: rgba(22,35,63,.06); }
.materials-empty { padding: 3rem 1rem !important; text-align: center; color: rgba(36,34,32,.5); font-size: .85rem; }
.materials-empty a { color: var(--gold); }
.materials-side { position: sticky; top: 5.5rem; }
.materials-category-card { padding: 1.25rem; box-shadow: none; }
.materials-category-card > p { margin-top: .45rem; color: rgba(36,34,32,.55); font-size: .78rem; line-height: 1.45; }
.materials-category-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; margin-top: 1rem; }
.materials-category-form .btn-primary { padding-left: .85rem; padding-right: .85rem; }
.materials-category-list-head { display: flex; align-items: center; justify-content: space-between; margin: 1.15rem 0 .5rem; padding-top: .85rem; border-top: 1px solid var(--line); color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; }
.materials-category-list-head b { min-width: 1.35rem; height: 1.35rem; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--ink); border-radius: 999px; font-size: .58rem; }
.materials-category-list { display: flex; flex-direction: column; max-height: 18rem; overflow-y: auto; }
.materials-category-list li { position: relative; padding: .55rem .25rem .55rem .9rem; color: rgba(36,34,32,.72); border-bottom: 1px dashed var(--line); font-size: .78rem; overflow-wrap: anywhere; }
.materials-category-list li::before { content: ''; position: absolute; left: .1rem; top: .85rem; width: .32rem; height: .32rem; background: var(--sage); border-radius: 50%; }
.materials-category-list li:last-child { border-bottom: 0; }

@media (max-width: 1250px) {
  .materials-page-intro { grid-template-columns: 1fr; align-items: start; }
  .materials-summary { width: 100%; }
  .materials-layout { grid-template-columns: 1fr; }
  .materials-side { position: static; }
  .materials-category-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 .75rem; max-height: none; }
  .materials-filter-main { grid-template-columns: minmax(13rem, 1.5fr) repeat(3, minmax(8rem, 1fr)); }
}

@media (max-width: 767px) {
  .materials-page-intro { gap: 1.25rem; margin-bottom: 1.5rem; }
  .materials-summary { grid-template-columns: repeat(2, 1fr); }
  .materials-summary > div:nth-child(2) { border-right: 0; }
  .materials-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .materials-section-head { align-items: flex-start; }
  .materials-filter-main { grid-template-columns: 1fr; }
  .materials-filter-actions { grid-column: auto; display: grid; grid-template-columns: 1fr 1fr; }
  .materials-more-filters > summary, .materials-apply { width: 100%; justify-content: center; }
  .materials-filter-popover { position: static; width: 100%; margin-top: .55rem; box-shadow: none; }
  .materials-table-wrap { overflow-x: auto; }
  .materials-table { min-width: 800px !important; }
  .materials-category-list { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .materials-filter-actions { grid-template-columns: 1fr; }
}

/* Admin user management */
.users-table-card { overflow: visible; }
.users-actions-cell { width: 5rem; text-align: right; }
.users-actions-cell .action-menu { display: inline-block; text-align: left; }
.users-actions-cell .action-menu > summary { width: 2.2rem; height: 2.2rem; background: #fff; }
.users-actions-cell .action-menu-list { min-width: 10.5rem; }
.users-actions-cell .action-menu-separator { height: 1px; margin: .3rem .25rem; background: var(--line); }
.users-dialog { position: fixed; inset: 50% auto auto 50%; width: min(calc(100vw - 2rem), 34rem); max-width: none; max-height: calc(100vh - 2rem); margin: 0; padding: 0; overflow-y: auto; color: var(--charcoal); background: transparent; border: 0; text-align: left; transform: translate(-50%, -50%); }
.users-dialog::backdrop { background: rgba(11,22,43,.7); backdrop-filter: blur(4px); }
.users-dialog-panel { overflow: hidden; padding: 1.4rem; background: var(--paper-raised); border: 1px solid rgba(255,255,255,.55); border-radius: .75rem; box-shadow: 0 28px 80px -24px rgba(11,22,43,.85); }
.users-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.users-dialog-head h2, .users-delete-dialog h2 { color: var(--ink); font-family: 'Fraunces', Georgia, serif; font-size: 1.55rem; font-weight: 600; line-height: 1.15; }
.users-dialog-close { width: 2rem; height: 2rem; display: grid; place-items: center; color: rgba(36,34,32,.5); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 1.25rem; line-height: 1; }
.users-dialog-close:hover { color: var(--ink); border-color: var(--ink); }
.users-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem 1rem; }
.users-edit-grid label > span { display: block; margin-bottom: .35rem; color: rgba(36,34,32,.58); font-family: 'IBM Plex Mono', monospace; font-size: .6rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.users-field-wide { grid-column: 1 / -1; }
.users-edit-grid select:disabled { cursor: not-allowed; opacity: .58; }
.users-dialog-note { margin-top: 1rem; padding: .7rem .8rem; color: #77571f; background: rgba(201,154,78,.1); border-left: 3px solid var(--gold); font-size: .75rem; }
.users-dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.users-delete-dialog { width: min(calc(100vw - 2rem), 27rem); text-align: center; }
.users-delete-dialog .users-dialog-panel { padding: 2rem; }
.users-delete-dialog p { margin-top: .65rem; color: rgba(36,34,32,.62); font-size: .85rem; line-height: 1.55; }
.users-danger-icon { width: 3.25rem; height: 3.25rem; display: grid; place-items: center; margin: 0 auto 1rem; color: #8a2c2c; background: rgba(138,44,44,.08); border: 1px solid rgba(138,44,44,.2); border-radius: 50%; font-family: 'Fraunces', Georgia, serif; font-size: 1.4rem; font-weight: 700; }
.users-delete-confirm { min-height: 2.55rem; padding: .55rem 1rem; color: #fff; background: #8a2c2c; border: 1px solid #8a2c2c; border-radius: .3rem; font-size: .8rem; font-weight: 600; cursor: pointer; }
.users-delete-confirm:hover { background: #702222; }
@media (max-width: 900px) {
  .users-table-card { overflow-x: auto; }
  .users-table-card table { min-width: 880px; }
}
@media (max-width: 560px) {
  .users-edit-grid { grid-template-columns: 1fr; }
  .users-field-wide { grid-column: auto; }
  .users-dialog-panel { padding: 1.1rem; }
}

/* Department and program management rows in System Settings. */
.settings-structure-list { margin-top: 1rem; border-top: 1px solid var(--line); }
.settings-structure-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; min-height: 4rem; padding: .7rem .15rem; border-bottom: 1px solid var(--line); }
.settings-structure-list > li:last-child { border-bottom: 0; }
.settings-structure-list > li > div { min-width: 0; }
.settings-structure-list strong { display: block; color: var(--ink); font-size: .88rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.settings-structure-list div > span { display: block; margin-top: .22rem; color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .6rem; letter-spacing: .025em; overflow-wrap: anywhere; }
.settings-delete-btn { min-height: 2.15rem; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .35rem .55rem; color: #8a2c2c; border: 1px solid rgba(138,44,44,.22); border-radius: .3rem; font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .04em; text-transform: uppercase; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.settings-delete-btn svg { width: .9rem; height: .9rem; }
.settings-delete-btn:hover { color: #fff; background: #8a2c2c; border-color: #8a2c2c; }

@media (max-width: 640px) {
  .settings-structure-card > form:first-of-type { display: grid; grid-template-columns: 1fr !important; }
  .settings-structure-card > form:first-of-type .input-field { max-width: none !important; grid-column: auto; }
  .settings-structure-card > form:first-of-type button { width: 100%; grid-column: auto; }
  .settings-delete-btn span { display: none; }
  .settings-delete-btn { width: 2.35rem; padding: .35rem; }
}

/* Author submissions — archive-record cards with a responsive workflow. */
.author-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.author-page-head .archive-eyebrow { margin-bottom: .45rem; }
.author-page-head h1 { font-family: 'Fraunces', Georgia, serif; font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 600; line-height: 1.05; color: var(--ink); }
.author-page-head p { margin-top: .55rem; color: rgba(36,34,32,.6); font-size: .92rem; }
.author-new-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; flex-shrink: 0; }
.author-submission-card { --record-accent: var(--sage); position: relative; overflow: hidden; border-top: 3px solid var(--record-accent); }
.author-submission-card.is-status-draft, .author-submission-card.is-status-archived { --record-accent: #8a8272; }
.author-submission-card.is-status-revision_required { --record-accent: var(--gold); }
.author-submission-card.is-status-rejected { --record-accent: #8a2c2c; }
.author-card-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; padding: 1.35rem 1.45rem; }
.author-card-main { min-width: 0; }
.author-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .7rem; margin-bottom: .75rem; }
.author-card-meta > span:not(.status-pill), .author-card-updated { color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .68rem; letter-spacing: .015em; }
.author-card-title { max-width: 52rem; color: var(--ink); font-family: 'Fraunces', Georgia, serif; font-size: 1.2rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.author-card-updated { margin-top: .35rem; }
.author-card-action { display: flex; align-items: flex-start; }
.author-card-action .btn-outline { min-width: 8.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; font-size: .82rem; white-space: nowrap; }
.author-card-action .btn-outline span { color: var(--gold); transition: transform .15s ease; }
.author-card-action .btn-outline:hover span { transform: translateX(2px); }
.wf-mobile-summary { display: none; }

/* Submission status timeline — a small horizontal stepper reused on the
   author's "My Submissions" cards so the workflow reads as a path rather
   than a single status word. */
.wf-timeline { display: flex; align-items: center; margin: .9rem 0 .4rem; }
.wf-step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; position: relative; }
.wf-step-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--line); border: 2px solid var(--line); z-index: 1; }
.wf-step-label { font-family: 'IBM Plex Mono', monospace; font-size: .6rem; letter-spacing: .03em; text-transform: uppercase; color: rgba(36,34,32,0.4); margin-top: .4rem; text-align: center; }
.wf-step-line { position: absolute; top: .3rem; left: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.wf-step:last-child .wf-step-line { display: none; }
.wf-step.is-done .wf-step-dot { background: var(--sage); border-color: var(--sage); }
.wf-step.is-done .wf-step-line { background: var(--sage); }
.wf-step.is-done .wf-step-label { color: var(--sage); }
.wf-step.is-current .wf-step-dot { background: var(--gold); border-color: var(--gold); width: .8rem; height: .8rem; }
.wf-step.is-current .wf-step-label { color: var(--gold); font-weight: 600; }
.wf-timeline.is-flagged .wf-step.is-current .wf-step-dot { background: #8a5a12; border-color: #8a5a12; }
.wf-timeline.is-flagged .wf-step.is-current .wf-step-label { color: #8a5a12; }

@media (max-width: 767px) {
  .author-page-head { align-items: stretch; flex-direction: column; gap: 1rem; margin-bottom: 1.2rem; padding-bottom: 1.1rem; }
  .author-page-head h1 { font-size: 2rem; }
  .author-page-head p { max-width: 28rem; font-size: .85rem; }
  .author-new-button { width: 100%; min-height: 3rem; }
  .author-submission-card { border-top-width: 3px; border-radius: .55rem; }
  .author-card-layout { display: flex; flex-direction: column; gap: 0; padding: 1.1rem; }
  .author-card-meta { align-items: flex-start; flex-direction: column; gap: .45rem; margin-bottom: .8rem; }
  .author-card-meta > span:not(.status-pill) { font-size: .64rem; }
  .author-card-title { font-size: 1.08rem; line-height: 1.32; }
  .author-card-updated { margin-top: .5rem; font-size: .64rem; }
  .wf-mobile-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-top: 1.15rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
  .wf-mobile-summary span { color: rgba(36,34,32,.48); font-family: 'IBM Plex Mono', monospace; font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; }
  .wf-mobile-summary strong { color: var(--record-accent); font-family: 'IBM Plex Mono', monospace; font-size: .62rem; font-weight: 600; text-align: right; text-transform: uppercase; }
  .author-card-main .wf-timeline { width: 100%; margin: .75rem 0 .35rem; overflow: visible; }
  .author-card-main .wf-step-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .author-card-main .wf-step-dot { width: .55rem; height: .55rem; }
  .author-card-main .wf-step.is-current .wf-step-dot { width: .75rem; height: .75rem; box-shadow: 0 0 0 4px rgba(169,121,46,.12); }
  .author-card-main .wf-step-line { top: .275rem; }
  .author-card-action { margin: 1rem -1.1rem -1.1rem; padding: .85rem 1.1rem; background: rgba(22,35,63,.025); border-top: 1px solid var(--line); }
  .author-card-action .btn-outline { width: 100%; min-height: 2.85rem; background: #fff; }
}

@media (max-width: 360px) {
  .author-card-layout { padding: .95rem; }
  .author-card-action { margin: .9rem -.95rem -.95rem; padding: .8rem .95rem; }
  .wf-mobile-summary { align-items: flex-start; flex-direction: column; gap: .3rem; }
  .wf-mobile-summary strong { text-align: left; }
}

.activity-log { font-size: .82rem; }
.activity-log li { display: flex; gap: .7rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
.activity-log li:last-child { border-bottom: none; }
.activity-time { font-family: 'IBM Plex Mono', monospace; font-size: .68rem; color: rgba(36,34,32,0.45); white-space: nowrap; flex-shrink: 0; padding-top: .15rem; min-width: 4.2em; }
.activity-text strong { font-weight: 600; }

@media (min-width: 768px) {
  .admin-sidebar { transform: translateX(0); }
  .admin-sidebar-close { display: none; }
  .admin-overlay { display: none; }
  .admin-menu-btn { display: none; }
  .admin-main { margin-left: 264px; }
  .admin-content { padding: 2rem 2.5rem 3.5rem; max-width: 1400px; }
  .admin-topbar { padding: 1rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .auth-spinner { border-color: #fff; }
}

/* =====================================================================
   ADMIN DASHBOARD / ANALYTICS — charts + entrance motion
   ===================================================================== */

/* Reveal-on-load: panels/tiles fade + rise in as the page settles,
   staggered via inline transition-delay set by admin-charts.js. */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .45s ease, transform .45s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.chart-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: 0 1px 2px rgba(22,35,63,0.04), 0 8px 24px -16px rgba(22,35,63,0.18);
}
.chart-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1.1rem;
}
.chart-card-head h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.08rem; font-weight: 600; }
.chart-card-note {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(36,34,32,0.45);
  white-space: nowrap;
}
.chart-canvas-wrap { position: relative; width: 100%; height: 220px; }
.chart-canvas-wrap.is-tall { height: 280px; }
.chart-canvas-wrap.is-short { height: 170px; }
.chart-empty { padding: 2.5rem 0; text-align: center; font-size: .875rem; color: rgba(36,34,32,0.5); }

/* =====================================================================
   AI ASSISTANT — "reference desk" chat interface.
   Signature: every assistant reply carries a small rotated "grounding
   stamp" (like the accession-stamp) naming exactly which repository
   source answered the question — search index, FAQ card, document
   text, related index, or the citation guide — making the grounding
   promise in the intro copy visible on every single reply instead of
   just claimed once in a caption. Suggested questions read as pulled
   catalog cards, not chat-app chips.
   ===================================================================== */

.ai-context-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: .65rem .9rem;
  margin-bottom: 1.1rem;
}
.ai-context-banner .accession-stamp { flex-shrink: 0; }
.ai-context-title { font-size: .88rem; flex: 1; min-width: 0; }
.ai-context-clear {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(36,34,32,0.5);
  flex-shrink: 0;
  white-space: nowrap;
}
.ai-context-clear:hover { color: var(--ink); }

.ai-desk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.ai-desk-head-left { display: flex; align-items: center; gap: .6rem; }
.ai-desk-title { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1rem; }
.ai-desk-sub { font-family: 'IBM Plex Mono', monospace; font-size: .64rem; letter-spacing: .05em; text-transform: uppercase; color: rgba(36,34,32,0.45); }
.ai-desk-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .64rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--sage);
}
.ai-desk-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 3px rgba(92,122,107,0.18); }

.ai-chat-log {
  padding: 1.4rem 1.25rem;
  min-height: 340px;
  max-height: 56vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Empty state — the "where should we start" reference desk moment */
.ai-empty { text-align: center; padding: 1.75rem .5rem 1.25rem; }
.ai-empty-badge {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(169,121,46,0.1);
  border: 1px solid rgba(169,121,46,0.35);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .9rem;
}
.ai-empty h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.25rem; font-weight: 600; margin-bottom: .35rem; }
.ai-empty p { font-size: .85rem; color: rgba(36,34,32,0.55); max-width: 34em; margin: 0 auto; }

.ai-catalog {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .7rem;
  margin-top: 1.5rem;
}
@media (max-width: 640px) { .ai-catalog { grid-template-columns: 1fr; } }

.ai-catalog-card {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.ai-catalog-card:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 6px 16px -10px rgba(22,35,63,0.35); }
.ai-catalog-card:disabled { opacity: .5; cursor: not-allowed; }
.ai-catalog-card-no {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  letter-spacing: .06em;
  color: var(--gold);
}
.ai-catalog-card-label { font-size: .84rem; font-weight: 600; color: var(--charcoal); line-height: 1.3; }

/* Quick-ask rail — stays available above the input once chatting */
.ai-quickrail { display: flex; gap: .5rem; overflow-x: auto; padding: .1rem .1rem .15rem; }
.ai-quick-chip {
  flex: 0 0 auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .68rem;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: .32rem .8rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.ai-quick-chip:hover:not(:disabled) { border-color: var(--gold); border-style: solid; color: var(--ink); background: #fff; }
.ai-quick-chip:disabled { opacity: .45; cursor: not-allowed; }

/* Message rows */
.msg-row { display: flex; gap: .6rem; margin-bottom: 1.15rem; }
.msg-row:last-child { margin-bottom: 0; }
.msg-row.is-user { flex-direction: row-reverse; }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: .78rem;
  color: #fff;
}
.msg-row.is-user .msg-avatar { background: var(--ink); }
.msg-row.is-ai .msg-avatar { background: var(--gold); }

.msg-col { display: flex; flex-direction: column; max-width: 78%; min-width: 0; }
.msg-row.is-user .msg-col { align-items: flex-end; }
.msg-row.is-ai .msg-col { align-items: flex-start; }

.msg-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .6rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(169,121,46,0.4);
  border-radius: 3px;
  padding: .1rem .4rem;
  background: rgba(169,121,46,0.06);
  transform: rotate(-1.1deg);
  margin-bottom: .32rem;
}

.msg-bubble {
  border-radius: 10px;
  padding: .65rem .9rem;
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-row.is-user .msg-bubble { background: var(--ink); color: #fff; border-radius: 10px 10px 2px 10px; }
.msg-row.is-ai .msg-bubble {
  background: var(--paper-raised);
  color: var(--charcoal);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sage);
  border-radius: 10px 10px 10px 2px;
}
.msg-bubble.is-error { border-left-color: #8a2c2c; }
.msg-bubble p { margin: 0 0 .5em; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul { margin: .2em 0 .5em 1.1em; padding: 0; list-style: disc; }
.msg-bubble li { margin-bottom: .2em; }
.msg-bubble strong { font-weight: 700; }

.msg-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .62rem;
  color: rgba(36,34,32,0.4);
  margin-top: .3rem;
}

.msg-typing { display: inline-flex; align-items: center; gap: .28rem; padding: .3rem .2rem; }
.msg-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(36,34,32,0.35);
  animation: msg-typing-bounce 1.1s infinite ease-in-out;
}
.msg-typing span:nth-child(2) { animation-delay: .15s; }
.msg-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes msg-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ai-input-bar {
  border-top: 1px solid var(--line);
  padding: .85rem 1.1rem 1rem;
  background: var(--paper-raised);
}
.ai-send-btn { display: inline-flex; align-items: center; gap: .4rem; }
.ai-send-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .msg-typing span { animation: none; opacity: .6; }
}
