/* Admin: calm document-like pages, sidebar + breadcrumbs (Notion-style wayfinding) */
body { font-size: 0.9375rem; }
/* Governsure logo: used as supplied (no recolouring), with clear space around it */
.gs-logo { display: block; line-height: 0; justify-self: start; }
.gs-logo img { height: 26px; width: auto; max-width: 100%; display: block; }
.login-logo img { height: 34px; margin-left: -4px; }
.doc-logo img { height: 30px; }
.gs-logo-sm img { height: 20px; }

.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.login-card h1 { margin-top: 8px; }

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100dvh; }
.side-logo { padding: 2px 4px 8px; }
.pharm-switch { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 4px 0 10px; background: var(--surface-2); }
.pharm-switch select { border: none; background: transparent; min-height: 38px; padding: 0 4px; font-weight: 600; font-size: 0.875rem; }
.pharm-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); flex: none; }
.nav { display: grid; gap: 1px; margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border: none; background: transparent; border-radius: 7px;
  color: var(--text-2); font-size: 0.875rem; font-weight: 500; text-decoration: none; justify-content: flex-start; }
.nav-item:active { transform: none; background: var(--press); }
@media (hover: hover) and (pointer: fine) { .nav-item:hover { background: var(--hover); color: var(--text); } }
.nav-item[aria-current="page"] { background: var(--press); color: var(--text); }
.nav-item kbd { margin-left: auto; }
.nav-sep { font-size: 0.6875rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 14px 10px 4px; }
.nav-ic { display: inline-flex; }
.side-foot { margin-top: auto; display: grid; gap: 6px; }
.me { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 0.8125rem; color: var(--text-2); border-top: 1px solid var(--border); }
.me b { color: var(--text); font-weight: 600; display: block; }
.me button { margin-left: auto; }
kbd { font: 500 0.6875rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 28px; min-height: 52px;
  background: var(--chrome); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--text-2); min-width: 0; }
.crumbs span:last-child { color: var(--text); font-weight: 500; }
.crumbs .sep { color: var(--text-3); }
.bar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; }
.view { padding: 8px 28px 64px; max-width: 1080px; width: 100%; outline: none; }
.view-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 18px 0 20px; }
.view-head h1 { font-size: 1.75rem; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.lede { color: var(--text-2); margin-top: 6px; max-width: 62ch; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { background: var(--surface); border-radius: 12px; padding: 14px 16px; min-height: 86px; }
.metric .label { font-size: 0.8125rem; color: var(--text-2); }
.metric .value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.metric .sub { font-size: 0.75rem; color: var(--text-3); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
.panel { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; background: var(--surface-2); min-width: 0; }
.panel h2 { font-size: 0.9375rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.panel + .panel { margin-top: 16px; }
.panel.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.panel.warn h2 { color: var(--warn-text); }
.gap-list { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.gap-list li { display: flex; gap: 10px; align-items: baseline; font-size: 0.875rem; }
.gap-list .n { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 4px 10px; align-items: center; font-size: 0.875rem; padding: 5px 0; }
.bar-row .track { grid-column: 1 / -1; height: 6px; background: var(--hover); border-radius: 3px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--brand); border-radius: 3px; }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 10px 14px; font-size: 0.875rem; background: var(--surface); margin-bottom: 16px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice code { font-size: 0.8125rem; }

/* Database-style table */
.seg { display: inline-flex; background: var(--surface); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { min-height: 30px; border: none; background: transparent; font-size: 0.8125rem; color: var(--text-2); padding: 0 12px; border-radius: 7px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 0 0 1px var(--border); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-height: 34px; font-size: 0.875rem; padding: 5px 10px; border-radius: 8px; }
.filters input { min-width: 220px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 0.8125rem; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .table tr.clickable:hover td { background: var(--hover); } }
.table .q { max-width: 420px; }
.table .when { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.table-wrap .table tr:last-child td { border-bottom: none; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-2); display: grid; gap: 6px; justify-items: center; }
.empty-state b { color: var(--text); font-size: 1rem; }
.skel-row td { padding: 12px 10px; }
.skel-row .skeleton { height: 12px; }

/* Inline editing */
.inline { border: 1px solid transparent; background: transparent; min-height: 32px; padding: 4px 8px; margin: -4px -8px; border-radius: 7px; width: auto; max-width: 100%; font-size: 0.875rem; }
@media (hover: hover) and (pointer: fine) { .inline:hover { background: var(--hover); } }
.inline:focus { border-color: var(--brand); background: var(--surface-2); outline: none; }
select.inline { padding-right: 24px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 150px auto; gap: 8px; align-items: start; padding: 12px; background: var(--surface); border-radius: 12px; margin-bottom: 14px; }
.add-row input, .add-row select { min-height: 38px; font-size: 0.875rem; }
.pin-input { display: flex; gap: 6px; }
.pin-reveal { font: 600 1.25rem/1 ui-monospace, Menlo, monospace; letter-spacing: 0.2em; }

/* Appearance */
.appearance { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%; border: none; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.colour-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.colour-row input[type=color] { width: 44px; height: 38px; padding: 3px; }
.colour-row input[type=text] { width: 120px; font-family: ui-monospace, Menlo, monospace; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-prev { width: 48px; height: 48px; border-radius: 12px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }
.form-section { display: grid; gap: 8px; padding: 18px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: none; padding-top: 0; }
.form-section h2 { font-size: 0.9375rem; }
.chips-edit { display: grid; gap: 6px; }
.phone { position: sticky; top: 72px; border: 1px solid var(--border-strong); border-radius: 26px; padding: 14px 12px; background: var(--bg); display: grid; gap: 10px; font-size: 0.8125rem; }
.phone .ph-top { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.phone .ph-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--prev-solid); color: #fff; font-size: 0.5625rem; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.phone .ph-mark img { width: 100%; height: 100%; object-fit: cover; }
.phone .ph-q { justify-self: end; background: var(--prev-tint); padding: 8px 11px; border-radius: 14px 14px 4px 14px; max-width: 86%; }
.phone .ph-call { background: var(--prev-soft); border-radius: 8px; padding: 8px 10px; font-weight: 500; display: flex; gap: 6px; }
.phone .ph-call .icon { color: var(--prev-text); width: 16px; height: 16px; }
.phone .ph-men { color: var(--prev-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.phone .ph-warn { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 8px 10px; }
.phone .ph-comp { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 20px; padding: 5px 5px 5px 12px; color: var(--text-3); }
.phone .ph-send { margin-left: auto; width: 26px; height: 26px; border-radius: 50%; background: var(--prev-solid); }

/* Printable pages */
.doc { max-width: 800px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--text); padding-bottom: 14px; margin-bottom: 20px; }
.doc h1 { font-size: 1.6rem; }
.doc .metrics { grid-template-columns: repeat(4, 1fr); }
.doc-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.8125rem; color: var(--text-2); display: flex; justify-content: space-between; }
.poster { max-width: 560px; margin: 8px auto; border: 1px solid var(--border-strong); border-radius: 18px; padding: 36px 36px 24px; display: grid; gap: 18px; justify-items: center; text-align: center; background: #fff; color: #1F1F1E; }
.poster .pm { width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.25rem; overflow: hidden; }
.poster .pm img { width: 100%; height: 100%; object-fit: cover; }
.poster h1 { font-size: 2rem; letter-spacing: -0.03em; }
.poster .qr { width: 240px; height: 240px; }
.poster ol { text-align: left; display: grid; gap: 6px; margin: 0; padding-left: 22px; font-size: 1rem; }
.poster .no-pid { background: #FBF3DB; color: #7A4A04; border-radius: 10px; padding: 8px 14px; font-weight: 600; }
.poster .url { font-family: ui-monospace, Menlo, monospace; font-size: 0.8125rem; color: #6B6A66; word-break: break-all; }
.poster .pw { font-size: 0.8125rem; color: #6B6A66; }
.poster .pw b { color: #0E4A3B; }

/* Command palette: no open animation (keyboard-driven, used constantly) */
.palette-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; }
.palette { width: 100%; max-width: 600px; background: var(--surface-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); overflow: hidden; border: 1px solid var(--border); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.palette-input input { border: none; min-height: 52px; font-size: 1rem; padding: 0; background: transparent; }
.palette-input input:focus-visible { outline: none; }
.palette-results { max-height: 50vh; overflow: auto; padding: 6px; }
.pal-group { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 0.875rem; }
.pal-item .meta { margin-left: auto; color: var(--text-3); font-size: 0.75rem; white-space: nowrap; }
.pal-item[aria-selected="true"] { background: var(--press); }

.detail dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 0.9375rem; }
.detail dt { color: var(--text-2); }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 30; transform: translateX(-100%); transition: transform 300ms var(--ease-drawer); box-shadow: 0 0 40px rgba(0,0,0,0.15); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .bar, .view { padding-left: 16px; padding-right: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .appearance { grid-template-columns: 1fr; }
  .phone { position: static; max-width: 320px; }
  .add-row { grid-template-columns: 1fr 1fr; }
}

@media print {
  .side, .bar, .no-print, .toast-wrap { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .poster { border: none; margin: 0 auto; }
  .panel, .metric { break-inside: avoid; }
}

/* SOP upload */
.drop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; cursor: pointer; color: var(--text-2); transition: background-color 140ms ease, border-color 140ms ease; }
.drop > .icon { width: 22px; height: 22px; color: var(--text-2); }
.drop b { color: var(--text); font-weight: 600; }
.drop u { color: var(--text); text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .drop:hover { background: var(--hover); } }
.drop.over { background: var(--brand-soft); border-color: var(--brand); }
.drop .pref { margin-left: auto; display: flex; align-items: center; gap: 8px; cursor: default; }
.review-list { display: grid; gap: 10px; }
.review-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.review-row.bad { background: var(--danger-bg); border-color: var(--danger-border); }
.rv-file { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.rv-file b { font-weight: 600; overflow-wrap: anywhere; }
.rv-fields { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.rv-fields input { min-height: 36px; font-size: 0.875rem; padding: 6px 10px; }
.rv-id { font-family: ui-monospace, Menlo, monospace; }
.rv-notes { grid-column: 1 / -1; display: grid; gap: 4px; }
.rv-notes:empty { display: none; }
.rv-note { font-size: 0.8125rem; color: var(--text-2); }
.rv-note.warn { color: var(--warn-text); }
.rv-note.bad { color: var(--danger-text); }
@media (max-width: 900px) { .review-row { grid-template-columns: 1fr; } .drop .pref { margin-left: 0; } }

/* Help */
.help-search { margin: 0 0 20px; max-width: 520px; }
.help-search input { width: 100%; }
.help-group { margin-bottom: 24px; }
.help-group h2 { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.help-item { border-bottom: 1px solid var(--border); }
.help-item summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 4px; cursor: pointer; font-weight: 500; border-radius: 6px; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary:hover { background: var(--hover); }
.help-item summary .icon { width: 16px; height: 16px; color: var(--text-3); transition: transform 160ms var(--ease-out); flex: none; }
.help-item[open] summary .icon { transform: rotate(90deg); }
.help-body { padding: 0 4px 14px 28px; line-height: 1.55; max-width: 640px; }
.help-body p, .help-body ol, .help-body ul { margin: 0 0 8px; }
.help-body ol, .help-body ul { padding-left: 1.2em; }
.help-body a, .login-help a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.help-contact { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); margin: 8px 0 16px; max-width: 680px; }
.help-contact p { margin: 2px 0 0; }
.login-help { text-align: center; margin: 4px 0 0; }
@media (prefers-reduced-motion: reduce) { .help-item summary .icon { transition: none; } }
