/* Pocketbook: the sign-in, account and admin pages. Same look as the Pocketbook screens
   (app/css/pocketbook.css): Queensland Government blue, the RFSQ badge, the phone's own
   font. Started from Orchard's stylesheet; only the palette and type changed. */

:root {
  --accent: #005eb8;
  --accent-dark: #00478c;
  --accent-tint: #e5eef7;
  --black: #141414;
  --ink: #1d1d1f;
  --ink-2: #55585e;
  --grey-on-black: #A6A6A6;
  --hair: #e4e4e9;
  --line: #BDBDBD;
  --paper: #FFFFFF;
  --ground: #f5f5f7;
  --soft: #EFEFEF;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font-body);
  --radius: 12px;
  --nav-w: 232px;
  --top-h: 60px;
  --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.55 var(--font-body); color: var(--ink); background: var(--ground); }
img { max-width: 100%; }
a { color: var(--accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .6em; }
h1 { font-size: 34px; }
h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 16px; margin-top: 1.4em; }
p { margin: 0 0 1em; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 8px; }

/* --- frame ------------------------------------------------------------------------ */
/* Cherry red, so the header never merges with a page's own black band below it. The
   logo is the all-white reverse: its red cherry would vanish on this red. */
.topbar { position: sticky; top: 0; z-index: 5; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 20px; background: linear-gradient(160deg, #005eb8 0%, #00478c 55%, #002951 100%); color: #fff; }
.topbar :focus-visible { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px #fff; }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand-logo { height: 40px; width: 40px; }
.brand-name { font: 700 19px/1 var(--font-head); letter-spacing: -.01em; }
.brand:hover { color: #fff; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 13px; }
.userbox a, .userbox .btn-link { color: #fff; }
.userbox form { margin: 0; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; color: #fff; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 22px; height: 2px; background: currentColor; position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.sidenav { background: var(--paper); border-right: 1px solid var(--hair); padding: 22px 0; }
.sidenav ul { list-style: none; margin: 0 0 18px; padding: 0; }
.sidenav a { display: block; padding: 8px 22px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; font-size: 14px; }
.sidenav a:hover { background: var(--ground); }
.sidenav a[aria-current="page"] { border-left-color: var(--accent); font-weight: 600; background: var(--ground); }
.nav-heading { margin: 4px 22px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.content { padding: 30px 36px 60px; max-width: 1240px; width: 100%; }
.content-wide { max-width: 1680px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.kicker { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* --- building blocks ---------------------------------------------------------------- */
.panel { background: var(--paper); border: 1px solid var(--hair); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.panel > :last-child { margin-bottom: 0; }
/* position: relative so absolutely positioned children (screen-reader labels in wide
   tables) are clipped by the scroll box instead of widening the whole page. */
.panel-flush { padding: 0; overflow-x: auto; position: relative; }
.table-scroll { overflow-x: auto; position: relative; }
.panel.narrow { max-width: 620px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 + .panel, .grid-2 + section { margin-top: 20px; }
.stack > * + * { margin-top: 16px; }
.panel .grid-2 + .field, .panel .field + .grid-2, .panel form + .facts { margin-top: 18px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button-row form { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); font: 600 14px/1.2 var(--font-body); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--ground); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-danger { color: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger:hover { background: var(--accent-tint); color: var(--accent-dark); }
.btn-small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.field label, .field .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"], .field input:not([type]),
.filters input, .filters select, .inline-form input, .inline-form select {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: 400 15px/1.3 var(--font-body); color: var(--ink); }
.field input:focus, .filters input:focus, .filters select:focus, .inline-form input:focus, .inline-form select:focus { border-color: var(--ink); outline: none; box-shadow: var(--focus); }
.field .hint { margin: -2px 0 8px; font-size: 13px; color: var(--ink-2); }
.field .static { margin: 0; padding: 9px 0; }
.field-error input { border-color: var(--accent-dark); }
.error-text { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--accent-dark); }
.checks { border: 0; padding: 0; margin: 0; }
.checks legend { font-weight: 600; margin-bottom: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-disabled { color: var(--ink-2); cursor: not-allowed; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters input { width: 280px; }
.filters select { width: auto; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 14px 0 0; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.inline-form input, .inline-form select { width: auto; min-width: 140px; }

.notice { padding: 12px 16px; border-left: 4px solid var(--ink); background: var(--soft); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 18px; }
.notice-error { border-left-color: var(--accent); background: var(--accent-tint); }
.notice-info { border-left-color: var(--line); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 600 12px/1.5 var(--font-body); white-space: nowrap; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.badge-ok { background: var(--black); color: #fff; }
.badge-warn { background: var(--accent-tint); color: var(--accent-dark); }
.badge-off { background: var(--soft); color: var(--ink-2); }
.badge-info { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table form { margin: 0; }
.table-dense td { padding: 8px 16px; }
.panel > .table th:first-child, .panel > .table td:first-child { padding-left: 0; }
.panel-flush > .table th:first-child, .panel-flush > .table td:first-child { padding-left: 24px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 1em; font-size: 14px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }
.access-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0; font-size: 14px; }
.access-list dt { font-weight: 600; }
.access-list dd { margin: 0; }
.plain { list-style: none; margin: 0 0 1em; padding: 0; }
.plain li + li { margin-top: 4px; }
.disclosure { margin-top: 12px; border-top: 1px solid var(--hair); padding-top: 12px; }
.disclosure summary { cursor: pointer; font-weight: 600; }
.disclosure form { margin-top: 12px; }
.danger-zone { display: flex; align-items: center; gap: 14px; margin-top: 8px; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 22px; background: var(--paper); border: 1px solid var(--hair); border-top: 4px solid var(--black); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tile:hover { border-top-color: var(--accent); color: var(--ink); }
.tile-label { font: 700 19px/1.15 var(--font-head); }
.tile-text { color: var(--ink-2); font-size: 14px; }

/* --- permission grid ---------------------------------------------------------------- */
.perm-full { padding: 12px 16px; margin-bottom: 16px; background: var(--soft); border-radius: var(--radius); }
.perm-module { border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 18px 8px; margin: 0 0 16px; }
.perm-module legend { font: 700 17px/1.1 var(--font-head); padding: 0 6px; }
.perm-module > .muted { margin: 0 0 6px; font-size: 13px; }
.perm-all { font-weight: 600; border-bottom: 1px solid var(--hair); padding-bottom: 10px; margin-bottom: 4px; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.perm-table th { text-align: left; font-weight: 400; padding: 10px 16px 10px 0; width: 45%; vertical-align: top; }
.perm-table td { padding: 6px 0; }
.perm-table tr + tr th, .perm-table tr + tr td { border-top: 1px solid var(--hair); }
.perm-scopes { display: flex; flex-wrap: wrap; gap: 0 18px; }
.is-covered { opacity: .45; }

/* --- account pieces ------------------------------------------------------------------ */
.steps { padding-left: 20px; }
.steps li { margin-bottom: 14px; }
.qr { width: 200px; margin: 12px 0; padding: 8px; background: #fff; border: 1px solid var(--hair); }
.qr svg { display: block; width: 100%; height: auto; }
.key { display: inline-block; padding: 6px 10px; background: var(--soft); letter-spacing: .08em; }
.manual-key summary { cursor: pointer; font-size: 14px; color: var(--accent-dark); }
.codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 28px; list-style: none; padding: 16px 20px; background: var(--soft); border-radius: var(--radius); }
.codes code { font-size: 16px; letter-spacing: .06em; }
.mail-text { white-space: pre-wrap; font: 14px/1.6 var(--font-body); margin: 0; }
.venue-list li { margin-bottom: 8px; }
.venue-list .inline-form { margin: 0; align-items: center; }
.venue-list code { min-width: 70px; }

/* --- chart tooltip (any element with data-tip-title / data-tip) --------------------- */
.tip { position: fixed; z-index: 20; pointer-events: none; min-width: 150px; max-width: 280px; padding: 10px 12px; background: var(--black); color: #fff; border-radius: var(--radius); font-size: 13px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.tip[hidden] { display: none; }
.tip-title { display: block; margin-bottom: 4px; color: var(--grey-on-black); font-size: 12px; }
.tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-key { display: inline-flex; align-items: center; gap: 6px; color: #D9D9D9; }
.tip-key i { display: inline-block; width: 10px; height: 2px; }

/* --- dialog -------------------------------------------------------------------------- */
.dialog { border: 0; border-top: 6px solid var(--accent); border-radius: var(--radius); padding: 26px 28px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.dialog::backdrop { background: rgba(20, 20, 20, .6); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* --- signed-out pages ------------------------------------------------------------------ */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: linear-gradient(160deg, #005eb8 0%, #00478c 55%, #002951 100%); }
.auth-card { width: 100%; max-width: 440px; background: var(--paper); border-radius: var(--radius); padding: 34px 36px 30px; }
.auth-brand { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--hair); }
.auth-brand img { height: 64px; width: 64px; flex: none; }
.auth-org { display: grid; gap: 4px; }
.auth-app { font: 700 21px/1.1 var(--font-head); letter-spacing: -.01em; }
.auth-sub { font-size: 14px; color: var(--ink-2); }
.auth-card h1 { font-size: 26px; }
.auth-foot { margin: 18px 0 0; font-size: 14px; text-align: center; }

/* --- small screens --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-flex; }
  .brand-logo { display: none; }
  .brand-name { border-left: 0; padding-left: 0; }
  /* minmax(0, 1fr), not 1fr: a plain 1fr track grows to fit a wide table and pushes the whole page off the screen. */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: fixed; top: var(--top-h); left: 0; bottom: 0; width: min(280px, 85vw); z-index: 4; overflow-y: auto; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  /* Hidden means out of the tab order too, not just off screen. */
  .nav-open .sidenav { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .25); transition: transform .2s ease; }
  .content { padding: 22px 18px 48px; }
  .userbox-name { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .filters input { width: 100%; }
  .access-list, .facts { grid-template-columns: 1fr; }
  .access-list dd, .facts dd { margin-bottom: 8px; }
  .perm-table th { width: auto; display: block; padding-bottom: 0; }
  .perm-table td { display: block; }
  .auth-card { padding: 26px 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .topbar, .sidenav, .page-actions, form { display: none !important; } .shell { display: block; } .panel { border: 0; } }
