/*
  Cerberus Document Management: modern layout, original brand colours and menu hierarchy.
  Navy (#000066 / #000080) and lavender (#999CD4 / #AEB0DD) come from the original site.
*/
:root {
  --navy: #000066; --navy-2: #000080; --accent: #3a3fb8; --lav: #999CD4; --lav-2: #AEB0DD; --tint: #eceefa; --tint-2: #f6f7fd;
  --bg: #f1f2f9; --card: #ffffff; --text: #1c1d33; --muted: #5d6080; --line: #d9dbee;
  --ok: #0b6b2e; --ok-bg: #e5f6ea; --err: #a3151f; --err-bg: #fdebed; --note: #5a4300; --note-bg: #fff6d6;
  --radius: 8px; --shadow: 0 1px 2px rgba(0,0,102,.08), 0 4px 14px rgba(0,0,102,.06);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
img { border: 0; max-width: 100%; height: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header ---- */
header.site { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 16px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand img { display: block; }
.brandtext { display: flex; flex-direction: column; }
.brandtext .app { font-size: 20px; font-weight: 600; color: var(--navy-2); line-height: 1.2; }
.brandtext .tag { font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.utility { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font-size: 14px; }
.utility .who { color: var(--muted); }
.utility .who strong { color: var(--text); }
.utility .signin { background: var(--navy-2); color: #fff; padding: 6px 16px; border-radius: 999px; font-weight: 600; }
.utility .signin:hover { background: var(--accent); text-decoration: none; }

/* ---- top menu: same hierarchy as the original site ---- */
.navtoggle { position: absolute; opacity: 0; pointer-events: none; }
.topnav { position: sticky; top: 0; z-index: 50; background: var(--navy); box-shadow: 0 2px 6px rgba(0,0,60,.25); }
.burger { display: none; padding: 12px 20px; color: #fff; font-weight: 600; cursor: pointer; }
.burger::before { content: "\2630\00a0\00a0"; }
.menubar { list-style: none; margin: 0 auto; padding: 0 16px; max-width: 1280px; display: flex; flex-wrap: wrap; align-items: stretch; }
.menubar > li { position: relative; display: flex; }
.menubar li { margin: 0; }
.menubar .menulabel span { display: flex; align-items: center; padding: 0 16px 0 8px; color: var(--lav-2); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.menubar form { display: flex; margin: 0; }
.menubar a.top, .menubar button.top {
  display: flex; align-items: center; gap: 6px; padding: 13px 16px; border: 0; background: none; color: #fff; font: 600 15px "Segoe UI", system-ui, Arial, sans-serif; cursor: pointer; text-decoration: none; border-radius: 0;
}
.menubar button.trigger::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .8; }
.menubar > li:hover > a.top, .menubar > li:hover > button.top, .menubar > li:focus-within > a.top, .menubar > li:focus-within > button.top { background: var(--navy-2); }
.menubar > li > ul { display: none; position: absolute; left: 0; top: 100%; min-width: 260px; margin: 0; padding: 6px 0; list-style: none; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--lav); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }
.menubar > li:hover > ul, .menubar > li:focus-within > ul { display: block; }
.menubar > li > ul a { display: block; padding: 8px 18px; color: var(--text); white-space: nowrap; }
.menubar > li > ul a:hover, .menubar > li > ul a:focus-visible { background: var(--tint); color: var(--navy-2); text-decoration: none; }

/* ---- page ---- */
.page { max-width: 1280px; margin: 20px auto 8px; padding: 0 16px; }
main { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 26px 26px; min-height: 55vh; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 14px; color: var(--navy-2); line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; color: var(--navy-2); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.lead { max-width: 70ch; }
.navy { color: var(--navy-2); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-bottom: 8px; }
.toolbar p, .toolbar-links { margin: 0 0 8px; }
footer.site { text-align: center; color: var(--muted); font-size: 13px; padding: 12px 16px 28px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--tint); color: var(--navy); font-weight: 600; font-size: 14px; border-bottom: 2px solid var(--lav-2); white-space: nowrap; }
thead th:first-child { border-top-left-radius: 6px; } thead th:last-child { border-top-right-radius: 6px; }
thead th a { color: var(--navy); }
tbody tr:hover { background: var(--tint-2); }
tfoot th { background: var(--tint); border-top: 2px solid var(--lav-2); }
td .link { font-weight: normal; }

/* ---- forms ---- */
.card { background: var(--tint-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
.card.narrow { max-width: 440px; margin: 28px auto; background: #fff; box-shadow: var(--shadow); }
.card h2:first-child { margin-top: 0; }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; color: var(--navy); }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 10px 0; padding: 6px 14px 10px; }
legend { font-weight: 600; padding: 0 6px; color: var(--navy); }
fieldset label { display: inline-block; margin: 6px 18px 0 0; font-weight: 400; color: var(--text); }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], input[type=date], input[type=month], select, textarea {
  width: 100%; max-width: 380px; padding: 8px 10px; border: 1px solid #b7b9d6; border-radius: 6px; background: #fff; color: var(--text); font: inherit; }
textarea { max-width: 520px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(58,63,184,.35); outline-offset: 1px; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; vertical-align: middle; accent-color: var(--navy-2); }
button, .btn { display: inline-block; padding: 8px 18px; border: 1px solid var(--navy-2); border-radius: 6px; background: var(--navy-2); color: #fff; font: 600 15px "Segoe UI", system-ui, Arial, sans-serif; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; }
/* "Back" buttons are grey so they read as leaving the screen rather than saving. */
a.btn.back { background: #6b6f80; border-color: #6b6f80; color: #fff; }
a.btn.back:hover, a.btn.back:focus-visible { background: #4f5362; border-color: #4f5362; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 400; text-decoration: none; }
button.link:hover { background: none; text-decoration: underline; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
form.inline input[type=search], form.inline input[type=text] { width: 230px; }
.row { display: flex; flex-wrap: wrap; gap: 0 22px; }
.row > * { flex: 1 1 210px; }
.row > .wide { flex: 1 1 340px; }
/* Search-style filter bars: every field on one row on a normal screen; wraps again on narrow ones. */
.row.oneline { flex-wrap: nowrap; }
.row.oneline > * { flex: 1 1 0; min-width: 0; }
.row.oneline > .wide { flex: 1.7 1 0; }
@media (max-width: 1000px) { .row.oneline { flex-wrap: wrap; } .row.oneline > * { flex: 1 1 210px; } .row.oneline > .wide { flex: 1 1 340px; } }
.row > .wide label { white-space: nowrap; }
.pager { display: flex; gap: 18px; align-items: center; margin: 10px 0; }

/* ---- messages ---- */
.error, .ok, .notice { display: block; padding: 9px 14px; border-radius: 6px; margin: 0 0 12px; border: 1px solid transparent; }
.error { background: var(--err-bg); color: var(--err); border-color: #f1b9be; font-weight: 600; }
.ok { background: var(--ok-bg); color: var(--ok); border-color: #b5e0c3; font-weight: 600; }
.notice { background: var(--note-bg); color: var(--note); border-color: #ecd68a; }

/* ---- home ---- */
.home { display: flex; flex-wrap: wrap; gap: 26px; align-items: flex-start; }
.home .text { flex: 1 1 360px; max-width: 640px; }
.home .headline { font-size: 20px; font-weight: 600; color: var(--navy-2); line-height: 1.35; margin-bottom: 16px; }
.home img.montage { flex: 0 1 400px; width: 400px; max-width: 100%; border-radius: 14px; box-shadow: var(--shadow); }
.home .features { margin: 0 0 14px; padding-left: 20px; }
.home .features li { margin: 0 0 8px; }

/* ---- phones and tablets: the same menu, collapsed behind a button ---- */
@media (max-width: 860px) {
  header.site { padding: 10px 14px; }
  .brandtext .app { font-size: 18px; }
  .burger { display: block; }
  .menubar { display: none; flex-direction: column; padding: 0; }
  .navtoggle:checked ~ .topnav .menubar { display: flex; }
  .menubar > li { flex-direction: column; border-top: 1px solid rgba(255,255,255,.12); }
  .menubar a.top, .menubar button.top { padding: 12px 20px; width: 100%; }
  .menubar .menulabel span { padding: 10px 20px; }
  .menubar > li > ul { display: block; position: static; box-shadow: none; border: 0; border-radius: 0; background: rgba(255,255,255,.06); padding: 0; }
  .menubar > li > ul a { color: #fff; padding: 10px 34px; white-space: normal; }
  .menubar > li > ul a:hover { background: rgba(255,255,255,.14); color: #fff; }
  .page { padding: 0 8px; margin-top: 12px; }
  main { padding: 16px 14px 20px; }
  th, td { padding: 7px 6px; font-size: 14px; }
  table { display: block; overflow-x: auto; }
}

@media print {
  header.site, .topnav, footer.site, .skip, .pager, .noprint, button, .btn, form.inline, input[type=checkbox] { display: none !important; }
  html, body { background: #fff; color: #000; }
  .page { margin: 0; padding: 0; max-width: none; }
  main { border: 0; box-shadow: none; padding: 0; }
  th { background: #eee; color: #000; }
  .card { border: 1px solid #999; background: #fff; }
}

/* ---- read-only view of live data ---- */
.robanner { background: #b00020; color: #fff; text-align: center; padding: 7px 14px; font-size: 14px; position: sticky; top: 0; z-index: 60; }
/* Hide every "save" button (forms that POST) except log in; search and filter forms use GET so they keep working. The server refuses the writes regardless. */
body.readonly main form[method="post"]:not(.keep) button,
body.readonly main form[method="post"]:not(.keep) .btn { display: none; }
body.readonly .topnav { top: 31px; }
.failed { color: var(--err); }

/* ---- slow searches: spinner banner, disabled button, selected counter ---- */
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }
.busy-banner { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 28px);
  padding: 10px 18px; border-radius: 8px; background: var(--navy-2); color: #fff; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.busy-banner[hidden] { display: none; }
button:disabled { opacity: .65; cursor: wait; }
button:disabled:hover { background: var(--navy-2); border-color: var(--navy-2); }
html.is-busy a[data-busy-link] { cursor: wait; }
.selected-count { font-weight: 700; color: var(--navy); }
.selected-count.over { color: var(--err); }
@media print { .busy-banner { display: none !important; } }
