/* Little Librarian UI: Material 3 components in Datum colours (light theme).
   Colours come from the Datum brand tokens; no other hues. Mulish is self-hosted. */

@font-face { font-family: "Mulish"; font-weight: 300; font-display: swap; src: url("fonts/Mulish-Light.ttf") format("truetype"); }
@font-face { font-family: "Mulish"; font-weight: 400; font-display: swap; src: url("fonts/Mulish-Regular.ttf") format("truetype"); }
@font-face { font-family: "Mulish"; font-weight: 600; font-display: swap; src: url("fonts/Mulish-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Mulish"; font-weight: 700; font-display: swap; src: url("fonts/Mulish-Bold.ttf") format("truetype"); }
@font-face { font-family: "Mulish"; font-weight: 800; font-display: swap; src: url("fonts/Mulish-ExtraBold.ttf") format("truetype"); }

:root {
  /* Datum palette */
  --navy: #0E2841; --orange: #E97132; --orange-alt: #E27939; --heading-blue: #0F4761;
  --light-fill: #EBF3F9; --white: #FFFFFF; --light-grey: #F5F5F5;
  --navy-70: #56697A; --navy-45: #939EAA; --navy-20: #CFD4D9;
  /* Material 3 roles */
  --md-primary: var(--navy); --md-on-primary: var(--white);
  --md-primary-container: var(--light-fill); --md-on-primary-container: var(--navy);
  --md-cta: var(--orange); --md-on-cta: var(--navy);          /* Brand: orange button, navy text. */
  --md-surface: var(--white); --md-surface-low: var(--light-grey); --md-surface-high: var(--light-fill);
  --md-on-surface: var(--navy); --md-on-surface-variant: var(--navy-70);
  --md-outline: var(--navy-45); --md-outline-variant: var(--navy-20);
  --md-heading: var(--heading-blue);
  --radius-s: 8px; --radius-m: 12px; --radius-l: 16px; --radius-full: 999px;
  --elevation-1: 0 1px 2px rgba(14, 40, 65, .12), 0 1px 3px 1px rgba(14, 40, 65, .08);
  --elevation-2: 0 2px 6px 2px rgba(14, 40, 65, .12), 0 1px 2px rgba(14, 40, 65, .16);
  --top-bar: 64px; --drawer: 280px; --rail: 88px;
  font-family: "Mulish", Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 16px; line-height: 1.55; color: var(--md-on-surface); background: var(--md-surface-low);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[x-cloak] { display: none !important; }
a { color: var(--md-heading); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--md-heading); line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .9rem; }
code, pre, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }
.icon-s { width: 18px; height: 18px; }
.muted { color: var(--md-on-surface-variant); }
.small { font-size: .875rem; }

/* App shell ------------------------------------------------------------------------------------ */
.top-bar {
  position: sticky; top: 0; z-index: 30; height: var(--top-bar); display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem; background: var(--md-primary); color: var(--md-on-primary); box-shadow: var(--elevation-1);
}
.top-bar .brand { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; min-width: 0; }
.top-bar .brand img { height: 26px; width: auto; display: block; }          /* 125 px wide: above the 37 px minimum. */
.top-bar .brand span { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bar .brand .divider { width: 1px; height: 24px; background: rgba(255, 255, 255, .35); }
.top-bar .spacer { flex: 1; }
.top-bar .icon-btn { color: var(--md-on-primary); }
.top-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.identity { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.identity .chip { background: rgba(255, 255, 255, .12); color: var(--white); border-color: rgba(255, 255, 255, .28); }
.identity .chip strong { font-weight: 700; }
.identity .badge-platform { background: var(--orange); border-color: var(--orange); color: var(--navy); }
@media (max-width: 599px) { .identity .badge-platform { display: none; } }

.shell { display: grid; grid-template-columns: var(--drawer) 1fr; min-height: calc(100vh - var(--top-bar)); }
.nav { background: var(--md-surface); border-right: 1px solid var(--md-outline-variant); padding: .75rem; }
.nav .nav-section { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--md-on-surface-variant); padding: 1rem .9rem .35rem; }
.nav a { display: flex; align-items: center; gap: .9rem; height: 48px; padding: 0 1rem; border-radius: var(--radius-full);
  color: var(--md-on-surface); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--md-surface-low); }
.nav a[aria-current="page"] { background: var(--md-primary-container); color: var(--md-primary); font-weight: 800; }
.nav a[aria-current="page"] .icon { color: var(--md-primary); }
.nav .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-close, .top-bar .menu-toggle { display: none; }
.scrim { display: none; }
main.content { padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1240px; width: 100%; min-width: 0; }

/* Tablet: navigation rail */
@media (max-width: 1199px) {
  .shell { grid-template-columns: var(--rail) 1fr; }
  .nav { padding: .75rem .5rem; }
  .nav .nav-section { display: none; }
  .nav a { flex-direction: column; justify-content: center; gap: .15rem; height: 64px; padding: 0 .25rem;
    border-radius: var(--radius-l); font-size: .72rem; text-align: center; }
  .nav .nav-label { max-width: 100%; }
}
/* Phone: modal navigation drawer */
@media (max-width: 599px) {
  .shell { display: block; }
  .top-bar .menu-toggle { display: inline-flex; }
  .nav { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(86vw, var(--drawer)); padding: .75rem;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--elevation-2); overflow-y: auto; }
  .nav.open { transform: none; }
  .nav .nav-section { display: block; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: .9rem; height: 48px; padding: 0 1rem;
    border-radius: var(--radius-full); font-size: 1rem; text-align: left; }
  .nav-close { display: flex; justify-content: flex-end; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(14, 40, 65, .4); }
  .identity .chip-org { display: none; }
  .top-bar .brand .divider, .top-bar .brand .app-name { display: none; }
  main.content { padding: 1rem 1rem 2.5rem; }
}

/* Account menu */
.menu-anchor { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: min(92vw, 320px); background: var(--md-surface);
  color: var(--md-on-surface); border-radius: var(--radius-m); box-shadow: var(--elevation-2); padding: .5rem 0; }
.menu .menu-head { padding: .75rem 1rem; border-bottom: 1px solid var(--md-outline-variant); }
.menu .menu-head strong { display: block; }
.menu dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: .5rem 0 0; font-size: .875rem; }
.menu dt { color: var(--md-on-surface-variant); }
.menu dd { margin: 0; font-weight: 700; }
.menu a, .menu button.menu-item { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .7rem 1rem; border: 0;
  background: none; color: inherit; font: inherit; text-decoration: none; cursor: pointer; text-align: left; }
.menu a:hover, .menu button.menu-item:hover { background: var(--md-surface-low); }
.menu form { margin: 0; }
.menu .menu-section { padding: .5rem 1rem; border-top: 1px solid var(--md-outline-variant); }
.menu select { width: 100%; }

/* Components --------------------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.kicker { color: var(--md-on-surface-variant); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 .25rem; }
.card { background: var(--md-surface); border-radius: var(--radius-l); border: 1px solid var(--md-outline-variant);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 1.25rem; }
.stat { background: var(--md-surface); border: 1px solid var(--md-outline-variant); border-radius: var(--radius-l); padding: 1rem 1.25rem; }
.stat .value { font-size: 1.75rem; font-weight: 800; color: var(--md-primary); line-height: 1.1; }
.stat .label { color: var(--md-on-surface-variant); font-size: .875rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 40px; padding: 0 1.25rem;
  border-radius: var(--radius-full); border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--md-primary); color: var(--md-on-primary); }
.btn:hover { box-shadow: var(--elevation-1); filter: brightness(1.12); }
.btn-cta { background: var(--md-cta); color: var(--md-on-cta); }
.btn-tonal { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.btn-outlined { background: transparent; color: var(--md-primary); border-color: var(--md-outline); }
.btn-text { background: transparent; color: var(--md-primary); padding: 0 .75rem; }
.btn-outlined:hover, .btn-text:hover { background: var(--md-surface-low); filter: none; box-shadow: none; }
.btn-danger { background: transparent; color: var(--md-primary); border-color: var(--orange); }
.btn-danger:hover { background: var(--light-fill); filter: none; }
.btn-small { height: 32px; padding: 0 .9rem; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; filter: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--md-on-surface); cursor: pointer; }
.icon-btn:hover { background: var(--md-surface-low); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }

.chip { display: inline-flex; align-items: center; gap: .35rem; height: 32px; padding: 0 .75rem; border-radius: var(--radius-s);
  border: 1px solid var(--md-outline-variant); font-size: .85rem; font-weight: 600; white-space: nowrap; color: var(--md-on-surface); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 .55rem; border-radius: var(--radius-full); font-size: .74rem;
  font-weight: 800; letter-spacing: .02em; background: var(--white); border: 1px solid var(--navy-20); color: var(--md-primary); white-space: nowrap; }
.badge-strong { background: var(--md-primary); border-color: var(--md-primary); color: var(--md-on-primary); }
.badge-outline { background: transparent; border: 1px solid var(--md-outline); color: var(--md-on-surface-variant); }

/* Forms: outlined fields with the label above */
.form { display: grid; gap: 1rem; max-width: 560px; }
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form-row .field { flex: 1 1 200px; }
.field { display: grid; gap: .3rem; }
.field label, .field .label { font-weight: 700; font-size: .875rem; }
.field .hint { color: var(--md-on-surface-variant); font-size: .82rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: inherit; color: var(--md-on-surface); background: var(--md-surface); height: 48px; padding: 0 .9rem;
  border: 1px solid var(--md-outline); border-radius: var(--radius-s); width: 100%; min-width: 0; }
textarea { height: auto; padding: .7rem .9rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--md-primary); box-shadow: 0 0 0 1px var(--md-primary); }
.check { display: flex; gap: .65rem; align-items: flex-start; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: .2rem; accent-color: var(--navy); }
fieldset { border: 1px solid var(--md-outline-variant); border-radius: var(--radius-m); padding: .75rem 1rem 1rem; margin: 0; display: grid; gap: .5rem; }
legend { font-weight: 700; font-size: .875rem; padding: 0 .35rem; }

/* Tables: navy header, light-fill zebra (brand) */
.table-wrap { overflow-x: auto; border-radius: var(--radius-m); border: 1px solid var(--md-outline-variant); }
table.table { border-collapse: collapse; width: 100%; background: var(--md-surface); font-size: .92rem; }
.table th { background: var(--md-primary); color: var(--md-on-primary); text-align: left; font-weight: 700; padding: .65rem .9rem; white-space: nowrap; }
.table td { padding: .65rem .9rem; border-top: 1px solid var(--md-outline-variant); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--light-fill); }
.table .sub { display: block; color: var(--md-on-surface-variant); font-size: .82rem; }
.table td.empty { text-align: center; color: var(--md-on-surface-variant); padding: 1.5rem; }

/* Notices and snackbar (errors use an orange bar and an icon: the brand has no error hue) */
.notice { display: flex; gap: .75rem; align-items: flex-start; background: var(--light-fill); border-left: 4px solid var(--md-primary);
  border-radius: var(--radius-s); padding: .85rem 1rem; margin: 0 0 1rem; }
.notice.error, .notice.warning { border-left-color: var(--orange); }
.notice .icon { color: var(--md-primary); }
.notice.error .icon, .notice.warning .icon { color: var(--orange); }
.snackbar { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 70; display: flex; align-items: center;
  gap: .75rem; max-width: min(92vw, 560px); padding: .85rem .75rem .85rem 1.1rem; border-radius: var(--radius-s);
  background: var(--md-primary); color: var(--md-on-primary); box-shadow: var(--elevation-2); }
.snackbar.error { border-left: 4px solid var(--orange); }
.snackbar .icon-btn { color: var(--md-on-primary); }

/* Secrets, codes, lists */
div.secret { display: flex; align-items: flex-start; gap: .5rem; background: var(--md-surface-low); border: 1px solid var(--md-outline-variant);
  border-radius: var(--radius-s); padding: .85rem 1rem; }
div.secret pre { margin: 0; flex: 1; white-space: pre-wrap; word-break: break-all; font-size: .9rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--md-outline-variant); }
.list li:first-child { border-top: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--md-on-surface-variant); }
dl.facts dd { margin: 0; font-weight: 600; overflow-wrap: break-word; min-width: 0; }
.qr svg { max-width: 240px; height: auto; display: block; }

/* Sign-in pages (no shell) */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: var(--md-primary); }
.auth > div { width: min(100%, 440px); }   /* The panel (logo and card) is centered as one block. */
.auth .card { width: 100%; box-sizing: border-box; padding: 2rem; margin: 0; }
.auth .auth-logo { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.auth .auth-logo img { height: 34px; width: auto; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-bottom: 1.5rem; color: var(--white); }
.auth-brand img { height: 30px; width: auto; }
.auth-brand span { font-weight: 700; }
.menu .menu-links { padding: 0; }
.btn-text.on-dark { color: var(--white); }
.btn-text.on-dark:hover { background: rgba(255, 255, 255, .12); }
main.content-center { margin: 0 auto; }
.notice-spaced { margin-top: 1rem; }
.section-gap { margin-top: 1.5rem; }
.select-compact { height: 32px; width: auto; padding: 0 .5rem; }
.list .sub { display: block; }
@media (max-width: 599px) { .hide-phone { display: none; } }
