/* Faculty inventory: a compact workspace with restrained colour and clear tables. */
:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surf: #ffffff;
  --ink: #243041;
  --mute: #647080;
  --line: #dce1e6;
  --acc: #284e75;
  --acc-ink: #ffffff;
  --ok: #357353;
  --use: #375f90;
  --mnt: #91651e;
  --off: #a33d3d;
  --soft: #edf1f5;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171c23;
  --surf: #1e252e;
  --ink: #e2e7ed;
  --mute: #a5afbb;
  --line: #39424d;
  --acc: #a5c3e0;
  --acc-ink: #152332;
  --ok: #86bc98;
  --use: #91b4de;
  --mnt: #d9b876;
  --off: #edaaaa;
  --soft: #28323e;
}
html { scrollbar-gutter: stable; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
a { color: var(--acc); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 19px; line-height: 1.25; font-weight: 650; letter-spacing: -.3px; margin: 0; }
h1 small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; font-weight: 400; letter-spacing: 0; color: var(--mute); }
h2 { font-size: 21px; font-weight: 600; letter-spacing: -.35px; margin-bottom: 18px; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.wrap { width: min(1456px, 100%); margin: auto; padding: 0 36px 24px; }
header { display: flex; align-items: center; gap: 13px; min-height: 92px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.brand-icon { width: 39px; height: 39px; flex: none; padding: 3px; background: #fff; border-radius: 3px; }
header h1 { flex: 1; min-width: 180px; }
.header-controls { display: flex; align-items: center; gap: 16px; }
#identity { max-width: 240px; text-align: right; font-size: 12px; }
#theme { border: 0; background: transparent; color: var(--mute); padding: 5px; font-size: 12px; }
#logout { font-size: 12px; padding: 5px 10px; }
nav { display: flex; align-items: stretch; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 30px; min-height: 54px; }
nav .btn { border: 0; border-bottom: 2px solid transparent; background: transparent; border-radius: 0; padding: 15px 0 13px; color: var(--mute); white-space: nowrap; }
nav .btn:hover { color: var(--ink); background: transparent; }
nav .btn[aria-current="true"] { border-bottom-color: var(--acc); color: var(--acc); }
nav .btn:last-child { margin-left: auto; font-size: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; border: 1px solid var(--line); background: var(--surf); color: var(--ink); padding: 6px 13px; border-radius: 4px; cursor: pointer; font-weight: 500; line-height: 1.4; text-decoration: none; }
.btn:hover { border-color: var(--mute); background: var(--soft); }
.btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.pri:hover { filter: brightness(.94); }
.btn.sm { min-height: 29px; padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 68px; margin-bottom: 22px; }
.panel-heading-text { flex: 1; min-width: 0; }
.panel-heading h2 { margin: 0; font-size: 21px; line-height: 1.4; }
.panel-heading p { margin: 4px 0 0; font-size: 12px; color: var(--mute); line-height: 1.5; }
.panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 34px; flex: 0 0 280px; }
#content { min-width: 0; min-height: calc(100svh - 300px); }
.settings-panel { max-width: 760px; }
.inventory-summary { display: flex; align-items: baseline; gap: 25px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 20px; }
.inventory-summary span { color: var(--mute); font-size: 12px; }
.inventory-summary b { color: var(--ink); font-size: 16px; font-weight: 600; margin-right: 5px; font-variant-numeric: tabular-nums; }
.inventory-summary .summary-free b { color: var(--ok); }
.tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tools h2 { margin: 0; padding: 4px 0; }
.tools input { flex: 1; min-width: 200px; }
.tools input, .tools select, .f input, .f select, .f textarea, .cart-row input, .cart-row select { width: 100%; border: 1px solid var(--line); background: var(--surf); border-radius: 4px; padding: 8px 10px; min-width: 0; }
.tools select { width: auto; max-width: 220px; }
input::placeholder, textarea::placeholder { color: var(--mute); opacity: .85; }
.tbl { background: var(--surf); border: 1px solid var(--line); border-radius: 3px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: var(--soft); color: var(--mute); font-weight: 600; font-size: 11px; letter-spacing: .02em; padding: 11px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th[data-action] { cursor: pointer; }
td { padding: 13px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--soft) 50%, transparent); }
#inventory-rows td:first-child { width: 28%; min-width: 240px; }
#inventory-rows td:nth-child(2) { min-width: 145px; }
#inventory-rows td:nth-child(n+3):nth-child(-n+7) { font-variant-numeric: tabular-nums; }
#inventory-rows td:last-child { min-width: 180px; white-space: nowrap; }
#inventory-rows td:last-child .btn + .btn { margin-left: 6px; }
#inventory-rows td:nth-child(4) { color: var(--ok); font-weight: 600; }
.name { font-weight: 550; cursor: pointer; background: transparent; border: 0; color: var(--ink); padding: 0; text-align: left; line-height: 1.5; }
.name:hover { color: var(--acc); text-decoration: underline; text-underline-offset: 3px; }
.sub { color: var(--mute); font-size: 11px; line-height: 1.6; }
td .sub { margin-top: 3px; }
.hint { font-size: 12px; color: var(--mute); line-height: 1.65; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--mute); white-space: nowrap; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag[data-status="active"], .tag[data-status="approved"], .tag[data-status="completed"] { color: var(--ok); }
.tag[data-status="pending"] { color: var(--mnt); }
.tag[data-status="rejected"], .tag[data-status="deactivated"] { color: var(--off); }
.overdue { color: var(--off); font-size: 12px; font-weight: 600; margin-top: 4px; }
.actions { display: flex; gap: 5px; flex-wrap: wrap; min-width: 110px; }
.notice { padding: 11px 15px; border: 1px solid var(--line); border-left: 3px solid var(--acc); background: var(--surf); margin-bottom: 22px; font-size: 13px; }
.empty { padding: 40px 20px; text-align: center; color: var(--mute); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surf); margin-bottom: 24px; }
.cards .card { padding: 17px 16px; border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.cards .card:last-child { border-right: 0; }
.cards .card strong { display: block; font-size: 26px; font-weight: 550; margin-top: 6px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card, .pipe { background: var(--surf); border: 1px solid var(--line); border-radius: 3px; padding: 24px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.chart-row { display: grid; grid-template-columns: minmax(110px, 1fr) 1.4fr 32px; gap: 15px; align-items: center; padding: 8px 0; font-size: 12px; }
.chart-row b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.chart-track { height: 6px; background: var(--soft); border-radius: 1px; overflow: hidden; }
.chart-fill { height: 100%; background: var(--acc); border-radius: 1px; }
details { margin-top: 12px; font-size: 12px; }
summary { color: var(--mute); cursor: pointer; }
.scroll { max-height: 260px; overflow: auto; }
.list-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-entry:last-child { border-bottom: 0; }
.list-entry p { margin: 8px 0; }
.audit-table td { vertical-align: top; }
.audit-detail { display: grid; grid-template-columns: 125px 1fr; gap: 6px 14px; margin: 12px 0; }
.audit-detail dt { color: var(--mute); }
.audit-detail dd { margin: 0; overflow-wrap: anywhere; }
.auth { width: min(420px, 100%); margin: 70px auto 50px; padding: 30px; }
.auth h2 { font-size: 23px; margin-bottom: 8px; }
.auth > .hint { margin-bottom: 27px; }
.auth .acts { margin-top: 18px; }
.auth .acts .btn { width: 100%; }
.auth > .acts .btn { background: transparent; border: 0; color: var(--acc); min-height: auto; padding: 3px; font-size: 12px; }
.f { display: grid; gap: 16px; }
.f label { display: grid; gap: 6px; font-size: 12px; font-weight: 550; }
.f input, .f select { min-height: 37px; font-weight: 400; }
.f textarea { min-height: 85px; resize: vertical; font-weight: 400; }
.f .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f > .hint { margin-bottom: 0; }
.f .err { color: var(--off); font-size: 12px; font-weight: 400; }
.f .err:empty { display: none; }
.acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
dialog { border: 1px solid var(--line); border-radius: 5px; background: var(--surf); color: var(--ink); padding: 0; width: min(610px, calc(100% - 28px)); max-height: 90dvh; overflow-y: auto; }
dialog::backdrop { background: rgb(15 24 35 / 45%); }
dialog > div { padding: 26px; }
dialog h2 { font-size: 19px; padding-bottom: 17px; border-bottom: 1px solid var(--line); margin-bottom: 21px; }
dialog .f + .acts { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.cart-row { display: grid; grid-template-columns: 1fr 80px 34px; gap: 8px; margin-bottom: 8px; }
.return-row { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 4px; }
.return-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { border-bottom: 1px solid var(--line); padding: 9px 0; font-size: 12px; color: var(--mute); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(450px, calc(100% - 32px)); padding: 12px 17px; border: 1px solid var(--line); border-left: 3px solid var(--acc); border-radius: 3px; background: var(--surf); color: var(--ink); font-size: 13px; box-shadow: 0 3px 15px rgb(0 0 0 / 8%); opacity: 0; pointer-events: none; z-index: 10; }
.toast.on { opacity: 1; }
.conn { color: var(--mute); font-size: 11px; margin: 20px 0 0; }
@media (max-width: 1100px) {
  .wrap { padding-inline: 22px; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .cards .card { border-bottom: 1px solid var(--line); }
  nav { gap: 20px; }
}
@media (max-width: 650px) {
  .wrap { padding: 0 15px 20px; }
  header { flex-wrap: wrap; padding: 17px 0; row-gap: 15px; }
  header h1 { min-width: 0; flex: 1; font-size: 17px; }
  .brand-icon { width: 34px; height: 34px; }
  .header-controls { width: 100%; padding-left: 47px; gap: 14px; }
  #identity { text-align: left; flex: 1; }
  #theme { order: 1; }
  #logout { order: 2; }
  nav { gap: 19px; overflow-x: auto; margin-bottom: 23px; min-height: 49px; }
  nav .btn { flex-shrink: 0; font-size: 12px; padding-top: 13px; padding-bottom: 12px; }
  nav .btn:last-child { margin-left: 0; }
  .panel-heading { flex-direction: column; align-items: stretch; gap: 12px; min-height: 106px; margin-bottom: 20px; }
  .panel-heading h2 { font-size: 20px; }
  .panel-heading-text { flex: none; }
  .panel-actions { flex: none; justify-content: flex-start; }
  #content { min-height: calc(100svh - 350px); }
  h2 { font-size: 20px; }
  .inventory-summary { gap: 16px; flex-wrap: wrap; }
  .inventory-summary span { font-size: 11px; }
  .inventory-summary b { font-size: 15px; }
  .tools input { flex-basis: 100%; }
  .tools select { flex: 1; max-width: none; }
  .split { grid-template-columns: 1fr; gap: 16px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards .card { padding: 15px; }
  .cards .card:nth-child(even) { border-right: 0; }
  .card, .pipe { padding: 19px; }
  .auth { margin-top: 35px; padding: 24px; }
  .f .row { grid-template-columns: 1fr; }
  .cart-row { grid-template-columns: minmax(0, 1fr) 60px 30px; }
  dialog > div { padding: 20px; }
  .toast { right: 16px; bottom: 16px; }
  .audit-detail { grid-template-columns: 90px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

@media (max-width: 650px) { .cards .card:last-child { grid-column: 1 / -1; border-bottom: 0; } }

/* Keep registration compact without clipping fields on small screens. */
.auth.registration { width: min(560px, 100%); margin: clamp(18px, 4vh, 36px) auto 24px; padding: 24px 28px; }
.auth.registration > .hint { margin-bottom: 20px; }
.auth.registration .f { gap: 14px; }
.auth.registration .f .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth.registration .f label { min-width: 0; }
.auth.registration .acts { margin-top: 6px; }
.auth.registration > .acts { margin-top: 14px; }
@media (max-width: 650px) { .auth.registration { padding: 22px 20px; } }

@media (max-height: 700px) {
  .auth.registration { margin-top: 18px; margin-bottom: 12px; padding-block: 20px; }
  .auth.registration > .hint { margin-bottom: 16px; }
  .auth.registration .f { gap: 12px; }
}

/* Activity records show the outcome and the people/products involved. */
.audit-table { min-width: 800px; }
.activity-date { width: 155px; white-space: nowrap; color: var(--mute); font-size: 12px; }
.activity-result { width: 40%; min-width: 250px; }
.activity-result strong { font-weight: 600; }
.activity-result > p { margin: 5px 0; line-height: 1.6; color: var(--mute); }
.activity-subject { min-width: 220px; }
.activity-subject b { font-weight: 550; }
.activity-products { margin: 8px 0; font-size: 12px; line-height: 1.7; }
.activity-note { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 12px; }
.activity-changes { margin: 12px 0; table-layout: fixed; }
.activity-changes th, .activity-changes td { padding: 7px; white-space: normal; overflow-wrap: anywhere; font-size: 11px; }
.activity-result details p { margin: 10px 0; }

#theme { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 7px; flex: 0 0 34px; }
#theme:hover { color: var(--ink); background: var(--bg); }
#language { border: 1px solid var(--line); border-radius: 4px; background: var(--surf); width: 64px; min-width: 64px; padding: 7px 6px; font-size: 12px; cursor: pointer; }
@media(max-width:600px) { .header-controls { gap: 8px; flex-wrap: wrap; } #language { order: 1; } #identity { min-width: 90px; } }

.category-entry { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.teaching-fields { border:1px solid var(--line); border-radius:4px; padding:14px; display:grid; gap:12px; min-width:0; }
.teaching-fields legend { padding:0 6px; color:var(--mute); }
.session-summary dl { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.session-summary dt { color:var(--mute); font-size:12px; }
.session-summary dd { margin:0; }
.loan-sheet { margin:24px 0; border-top:1px solid var(--line); padding-top:18px; }
.print-heading,.print-signatures { display:none; }
@media print {
 :root { color-scheme:light; --ink:#111; --surf:#fff; --mute:#444; --line:#aaa; }
 body { background:white; color:#111; }
 body>.wrap,body>#toast { display:none!important; }
 dialog[open] { position:static; max-height:none; max-width:none; width:100%; margin:0; padding:0; border:0; overflow:visible; }
 dialog::backdrop { background:white; }
 dialog button,dialog form,dialog .acts,dialog details { display:none!important; }
 .print-heading { display:block; }
 .print-signatures { display:flex; justify-content:space-between; margin-top:36px; }
 .tbl { overflow:visible; } .loan-sheet table { min-width:0; font-size:10px; } th,td { padding:6px; }
}

@media print {
 #modal-content { display:flex; flex-direction:column; }
 #modal-content>.print-heading { order:-1; margin-bottom:18px; }
 .print-heading h2 { border:0; padding:0; margin-bottom:4px; }
 .screen-only { display:none!important; }
 .loan-sheet,.session-summary,.print-signatures { break-inside:avoid; }
}

.confirmation { width:min(420px,calc(100% - 32px)); border-radius:12px; box-shadow:0 24px 80px rgb(0 0 0 / 22%); }
.confirmation::backdrop { background:rgb(15 24 35 / 52%); backdrop-filter:blur(3px); }
.confirmation form { padding:26px; }
.confirmation-icon { display:flex; align-items:center; justify-content:center; width:44px; height:44px; margin-bottom:18px; border:1px solid var(--line); border-radius:12px; color:var(--acc); background:var(--soft); }
.confirmation h2 { border:0; padding:0; margin:0 0 10px; font-size:20px; }
.confirmation p { margin:0; color:var(--mute); line-height:1.65; overflow-wrap:anywhere; }
.confirmation-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:26px; }
.confirmation-actions .btn { min-height:38px; padding:8px 15px; }
.confirmation.destructive .confirmation-icon { color:var(--off); }
.confirmation.destructive .pri { background:var(--off); border-color:var(--off); color:var(--surf); }
@media(prefers-reduced-motion:no-preference) { .confirmation[open] { animation:confirmation-enter 150ms ease-out; } @keyframes confirmation-enter { from { opacity:0; transform:translateY(8px) scale(.98); } to { opacity:1; transform:translateY(0) scale(1); } } }

.btn.danger { color:var(--off); }
.btn:disabled { opacity:.5; cursor:not-allowed; }

.profile-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:24px; }
.profile-grid .pipe { margin:0; width:100%; }
#modal .profile-grid { grid-template-columns:1fr; gap:18px; }
#modal .profile-grid .pipe { border:0; padding:0; }
#modal .profile-grid .pipe + .pipe { border-top:1px solid var(--line); padding-top:20px; }
@media(max-width:800px) { .profile-grid { grid-template-columns:1fr; } }
