/* FCEI styles: office pages and the field app.
   Status colours avoid relying on red/green; every status also has words. */
:root {
  --ink: #1b2430;
  --muted: #5b6676;
  --line: #d5dbe3;
  --bg: #f4f6f9;
  --card: #ffffff;
  --brand: #1f3a5f;
  --brand-2: #2d5b8f;
  --good-bg: #dbe9fb;  --good-ink: #123e73;   /* blue = done / synced */
  --wait-bg: #ffe9b8;  --wait-ink: #6b4500;   /* amber = waiting */
  --alert-bg: #ead9f7; --alert-ink: #4b1c71;  /* purple = needs a decision */
  --focus: #ffb000;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.4; }
a { color: var(--brand-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
h1 { font-size: 1.5rem; margin: .4rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; }

/* ---------- office frame ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; background: var(--brand); color: #fff; padding: .6rem 1rem; }
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.15rem; }
.brand span { font-weight: 400; opacity: .8; font-size: .95rem; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.topbar nav a { padding: .35rem .6rem; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.16); }
.who { margin-left: auto; font-size: .9rem; display: flex; gap: .5rem; align-items: center; }
.who .role { opacity: .75; }
.who button.link { color: #fff; }
.who a.who-link { color: #fff; }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 460px; }
.alert-card { border-left: 6px solid var(--alert-ink); }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: .8rem; }
.notice { padding: .7rem 1rem; border-radius: 8px; background: var(--good-bg); color: var(--good-ink); }
.notice.warn { background: var(--wait-bg); color: var(--wait-ink); }
.notice.ok { background: var(--good-bg); color: var(--good-ink); }
.big-text { font-size: 1.3rem; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .2rem 1rem; align-items: start; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 1rem; padding: .6rem 1rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.field { display: block; margin: 0 0 .8rem; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.field small { display: block; color: var(--muted); margin-top: .2rem; }
.req { color: var(--alert-ink); }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: .55rem .6rem; border: 1px solid #b8c2cf; border-radius: 7px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
.check { display: flex; gap: .5rem; align-items: center; margin: .4rem 0 .8rem; }
.check input { width: 1.2rem; height: 1.2rem; }
button, .button {
  display: inline-block; font: inherit; padding: .55rem 1rem; border-radius: 7px; border: 1px solid #9fb0c4; background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
button:hover, .button:hover { background: #eef3f9; }
button.primary, .button.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--brand); }
button.big, .button.big { padding: .8rem 1.3rem; font-size: 1.05rem; }
button.link { background: none; border: 0; padding: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
form.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: end; }
.inline-form .field { margin: 0; min-width: 200px; }
.inline-form > input[type=text] { width: auto; flex: 1 1 12rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0 1rem; align-items: center; }
.actions-row form { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; align-items: center; }
.filters input[type=search] { max-width: 320px; }
.filters select { width: auto; }
.danger-zone { margin-top: 2rem; text-align: right; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list thead th { background: #e9eef5; font-size: .85rem; }
table.list tr.inactive td { color: var(--muted); }
table.list .sel { width: 2rem; }
table.compare th { width: 160px; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e5e9ef; color: #39424e; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good-ink); }
.badge.good::before { content: "✓ "; }
.badge.wait { background: var(--wait-bg); color: var(--wait-ink); }
.badge.wait::before { content: "• "; }
.badge.alert { background: var(--alert-bg); color: var(--alert-ink); }
.badge.alert::before { content: "! "; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: 1rem 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; text-decoration: none; color: var(--ink); }
.stat b { display: block; font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: .9rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 2px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .5rem .8rem; text-decoration: none; border-radius: 7px 7px 0 0; }
.tabs a.active { background: var(--card); border: 2px solid var(--line); border-bottom-color: var(--card); margin-bottom: -2px; font-weight: 600; }
.pager { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; }
.menu li { margin: .4rem 0; }
dl.details dt { font-weight: 600; }
dl.details dd { margin: 0 0 .6rem; }
.photos { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.photos figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .4rem; width: 200px; }
.photos img { width: 100%; height: 150px; object-fit: cover; border-radius: 5px; display: block; }
.photos figcaption { font-size: .78rem; color: var(--muted); margin-top: .3rem; }

/* ---------- printable QR labels ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0; }
.label { display: flex; gap: 12px; align-items: center; border: 1px dashed #888; padding: 14px; background: #fff; break-inside: avoid; page-break-inside: avoid; }
.qr { width: 150px; height: 150px; flex: none; }
.qr img, .qr svg { width: 150px; height: 150px; display: block; image-rendering: pixelated; }
.label-code { font-size: 1.8rem; font-weight: 800; letter-spacing: .02em; }
@media print {
  .topbar, footer, .noprint, h1 { display: none !important; }
  body, main { background: #fff; padding: 0; margin: 0; max-width: none; }
  .labels { grid-template-columns: 1fr 1fr; }
  .notice { display: none; }
}

/* ---------- field app ---------- */
body.field { background: #eef1f5; padding-bottom: 5rem; }
.f-top { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: .5rem .8rem; display: flex; align-items: center; gap: .6rem; }
.f-top .title { font-weight: 700; }
.f-top .spacer { flex: 1; }
.f-top button { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); padding: .35rem .7rem; }
.sync-pill { border-radius: 999px; padding: .3rem .7rem; font-size: .85rem; font-weight: 600; border: 0; cursor: pointer; }
.sync-pill.good { background: var(--good-bg); color: var(--good-ink); }
.sync-pill.wait { background: var(--wait-bg); color: var(--wait-ink); }
.sync-pill.alert { background: var(--alert-bg); color: var(--alert-ink); }
.f-main { padding: .8rem; max-width: 720px; margin: 0 auto; }
.f-building { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .8rem; display: flex; gap: .6rem; align-items: center; }
.f-building .code { font-size: 1.4rem; font-weight: 800; }
.f-building .info { flex: 1; min-width: 0; }
.f-building .addr { color: var(--muted); font-size: .9rem; }
.f-building.none { border-style: dashed; }
.f-big-actions { display: grid; gap: .6rem; margin-bottom: 1rem; }
.f-big-actions button { width: 100%; padding: 1.1rem; font-size: 1.15rem; border-radius: 12px; }
.f-row { display: flex; gap: .6rem; }
.f-row > * { flex: 1; }
.f-section { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-bottom: .8rem; }
.f-section h2 { margin: 0 0 .6rem; font-size: 1.05rem; }
.f-list { list-style: none; padding: 0; margin: 0; }
.f-list li { border-top: 1px solid var(--line); padding: .6rem .2rem; display: flex; gap: .6rem; align-items: center; cursor: pointer; }
.f-list li:first-child { border-top: 0; }
.f-list .grow { flex: 1; min-width: 0; }
.f-list .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-msg { padding: .7rem .9rem; border-radius: 10px; margin-bottom: .8rem; }
.f-msg.good { background: var(--good-bg); color: var(--good-ink); }
.f-msg.wait { background: var(--wait-bg); color: var(--wait-ink); }
.f-msg.alert { background: var(--alert-bg); color: var(--alert-ink); }
.f-ident { font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; font-weight: 700; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.3rem 0 .8rem; }
.chips button { padding: .3rem .7rem; border-radius: 999px; font-size: .85rem; }
.f-photos { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.f-photos .ph { position: relative; width: 92px; }
.f-photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--line); }
.f-photos .cap { font-size: .72rem; color: var(--muted); text-align: center; }
.f-sticky-save { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom)); display: flex; gap: .6rem; z-index: 15; }
.f-sticky-save button { flex: 1; padding: .9rem; font-size: 1.05rem; border-radius: 10px; }
.hidden { display: none !important; }

/* scanner overlay */
.scanner { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; min-height: 0; background: #000; }
.scanner .frame { position: absolute; left: 10%; right: 10%; top: 28%; height: 26%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.scanner .bar { padding: .7rem; display: flex; gap: .5rem; background: #111; flex-wrap: wrap; padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); }
.scanner .bar button { flex: 1; min-width: 120px; padding: .8rem; border-radius: 10px; }
.scanner .bar input { flex: 3; min-width: 180px; font-size: 1.1rem; }
.scanner .hint { color: #fff; text-align: center; padding: .5rem; font-size: .95rem; background: #111; }
.dialog-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: #fff; width: 100%; max-width: 720px; max-height: 88vh; overflow: auto; border-radius: 14px 14px 0 0; padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
@media (min-width: 760px) { .dialog-back { align-items: center; } .dialog { border-radius: 14px; } }

/* ---------- pick-or-type boxes (suggest.js) ---------- */
.combo { position: relative; display: flex; }
.combo > input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.combo-btn { flex: none; width: 2.8rem; padding: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; border-color: #b8c2cf; font-size: 1.1rem; line-height: 1; }
.combo-list { position: absolute; z-index: 12; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: .2rem 0; list-style: none; background: #fff;
  border: 1px solid #9fb0c4; border-radius: 8px; box-shadow: 0 6px 18px rgba(20,30,45,.18); max-height: 16.5rem; overflow-y: auto; }
.combo-list li { padding: .55rem .75rem; min-height: 2.75rem; display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.combo-list li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.combo-list li small { display: inline; color: var(--muted); margin: 0; white-space: nowrap; }
.combo-list li.active, .combo-list li:hover { background: var(--good-bg); color: var(--good-ink); }
.combo-list li[aria-selected=true] > span { font-weight: 700; }
.combo-list li[aria-selected=true] > span::before { content: "✓ "; }
.combo-list li.combo-empty, .combo-list li.combo-more { color: var(--muted); font-size: .85rem; cursor: default; background: none; }

/* ---------- photo viewer (viewer.js), field app and office ---------- */
html.pv-open, html.pv-open body { overflow: hidden; }
.pv { position: fixed; inset: 0; z-index: 60; background: #0d1117; color: #fff; display: flex; flex-direction: column; }
.pv-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .8rem; padding: .5rem .7rem; padding-top: calc(.5rem + env(safe-area-inset-top)); background: rgba(0,0,0,.6); }
.pv-title { flex: 1; min-width: 8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-count { opacity: .75; font-weight: 400; margin-left: .3rem; }
.pv-tools { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pv-tools button, .pv-tools a { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; padding: .45rem .75rem; min-width: 2.75rem; min-height: 2.75rem; font-size: 1rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.pv-tools button:hover, .pv-tools a:hover { background: rgba(255,255,255,.24); }
.pv-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.pv.zoomed .pv-stage { cursor: grab; }
.pv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center; will-change: transform; -webkit-user-drag: none; }
.pv-msg { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; margin: 0; text-align: center; background: var(--wait-bg); color: var(--wait-ink); border-radius: 8px; padding: .5rem .8rem; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 3rem; height: 4.5rem; font-size: 2rem; line-height: 1; color: #fff; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.35); border-radius: 10px; padding: 0; }
.pv-prev { left: .4rem; }
.pv-next { right: .4rem; }
.pv.single .pv-nav, .pv.zoomed .pv-nav { display: none; }
.pv-foot { margin: 0; padding: .4rem .8rem; padding-bottom: calc(.4rem + env(safe-area-inset-bottom)); font-size: .82rem; background: rgba(0,0,0,.6); display: flex; flex-wrap: wrap; gap: .2rem 1rem; justify-content: space-between; }
.pv-hint { opacity: .7; }
.pv-note:empty { display: none; }
/* thumbnails that open the viewer */
.ph-open { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; }
.photos a[data-photo] { cursor: zoom-in; display: block; }

/* ---------- office menu bar on the field app's start screen ---------- */
.field .topbar.f-office { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; white-space: nowrap; padding: .45rem .8rem; gap: 1rem; }
.field .topbar.f-office nav { flex-wrap: nowrap; }
.field .topbar.f-office .who { margin-left: auto; flex: none; }
.field .topbar.f-office.offline nav a { opacity: .45; pointer-events: none; }
.field .topbar.f-office .f-office-note { display: none; font-size: .8rem; background: var(--wait-bg); color: var(--wait-ink); border-radius: 999px; padding: .1rem .55rem; }
.field .topbar.f-office.offline .f-office-note { display: inline-block; }
@media (max-width: 600px) { .field .topbar.f-office .brand span { display: none; } }
.field .topbar.f-office.offline .who button { opacity: .45; pointer-events: none; }
.f-msg .f-row { margin-top: .5rem; }

/* ---------- maintenance tickets (prototype) ---------- */
.badge.hold { background: #dfe5ec; color: #2c3a4b; }
.badge.hold::before { content: "‖ "; }
.badge.type-cm { background: #1f3a5f; color: #fff; }
.badge.type-pm { background: #e7eef7; color: #1f3a5f; border: 1px solid #9fb0c4; }
.ticket-head { margin: -.6rem 0 .2rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
h2.ticket-summary { margin-top: .4rem; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "details actions" "rest actions"; grid-template-rows: auto 1fr; gap: 0 1rem; align-items: start; }
.ticket-grid .t-details { grid-area: details; }
.ticket-grid .ticket-actions { grid-area: actions; }
.ticket-grid .t-rest { grid-area: rest; }
.ticket-form input[type=email] { width: 100%; font: inherit; padding: .55rem .6rem; border: 1px solid #b8c2cf; border-radius: 7px; background: #fff; color: var(--ink); }
.ticket-actions .card h3 { margin: 0 0 .6rem; font-size: 1rem; }
.ticket-actions .card button { width: 100%; }
.close-card { border-left: 6px solid var(--brand-2); }
.grid-part { display: grid; grid-template-columns: 5rem 1fr; gap: 0 .6rem; }
.pre { white-space: pre-wrap; }
ol.timeline { list-style: none; margin: 0; padding: 0; border-left: 3px solid var(--line); }
ol.timeline li { position: relative; margin: 0 0 .8rem; padding: 0 0 0 1rem; }
ol.timeline li::before { content: ""; position: absolute; left: -7px; top: .35rem; width: 11px; height: 11px; border-radius: 50%; background: var(--brand-2); }
ol.timeline .when { font-size: .85rem; color: var(--muted); }
ol.timeline .note { background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: .4rem .6rem; margin-top: .25rem; }
.assign-row { display: flex; gap: .3rem; }
.assign-row select { width: auto; min-width: 9rem; padding: .35rem .4rem; }
.assign-row button { padding: .35rem .7rem; }
.ticket-form fieldset { margin-bottom: 1rem; }
@media (max-width: 900px) {
  .ticket-grid { grid-template-columns: 1fr; grid-template-areas: "details" "actions" "rest"; grid-template-rows: auto; }
}
/* On a phone the ticket list becomes one card per ticket. */
@media (max-width: 700px) {
  table.list.tickets, table.list.tickets tbody, table.list.tickets tr, table.list.tickets td { display: block; width: 100%; }
  table.list.tickets thead { display: none; }
  table.list.tickets tr { border-bottom: 2px solid var(--line); padding: .4rem 0; }
  table.list.tickets td { border: 0; padding: .15rem .6rem; }
  table.list.tickets td::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  table.list.tickets td[data-label="Ticket"]::before { content: ""; }
}

/* ---------- previous callers pop-up (new call form) ---------- */
.caller-box { position: relative; }
.caller-box > p.small { margin: 0 0 .4rem; }
/* No "top": the list opens right under the caller boxes and floats over the rest of the form. */
.caller-pop { position: absolute; left: .6rem; right: .6rem; z-index: 30; background: var(--card); border: 4px solid var(--brand-2); border-radius: 8px; box-shadow: 0 10px 28px rgba(20, 30, 45, .28); }
.caller-pop[hidden], .caller-picked[hidden] { display: none; }
.caller-pop-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; padding: .45rem .7rem; border-bottom: 1px solid var(--line); }
.caller-pop-head .link { margin-left: auto; }
.caller-pop-scroll { max-height: 22rem; overflow: auto; }
.caller-table { width: 100%; margin: 0; }
.caller-table th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.caller-table tbody tr { cursor: pointer; }
.caller-table tbody tr:hover, .caller-table tbody tr.active { background: var(--good-bg); color: var(--good-ink); }
.caller-pop-more { margin: 0; padding: .35rem .7rem; border-top: 1px solid var(--line); }
.caller-picked { margin-top: .6rem; padding: .6rem .8rem; border-radius: 8px; background: var(--good-bg); color: var(--good-ink); }
.caller-picked-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; }
.caller-picked-head .link { margin-left: auto; }
.caller-picked .muted { color: inherit; opacity: .85; }
.caller-picked p { margin: .4rem 0 .2rem; }
.caller-open { margin: .2rem 0 0; padding-left: 1.2rem; }
.caller-open li { margin: .15rem 0; }
@media (max-width: 700px) {
  .caller-pop { left: 0; right: 0; }
  .caller-table td:nth-child(4), .caller-table th:nth-child(4) { display: none; } /* e-mail column hidden on phones */
}

/* ---------- KeyStone branding ---------- */
:root { --ks-orange: #f08a24; --ks-navy: #0b2f57; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.brand { display: inline-flex; align-items: center; gap: .45rem; }
.brand-mark { width: 1.9rem; height: auto; flex: none; }
.f-top .brand-mark { width: 1.6rem; }

/* Sign-in page (approved mockup 2026-11-16). It stays light in every theme: the partner logos are navy on light. */
body.login { min-height: 100vh; display: flex; flex-direction: column; color-scheme: light; color: #1b2430;
  background: linear-gradient(180deg, #b9cce3 0, #d7e3f2 170px, #eef3fa 330px, #f7f9fd 60%, #e8eef7 100%); overflow-x: hidden; }
.login-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.login-bg img { position: absolute; bottom: 110px; opacity: .55; display: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%); mask-image: radial-gradient(closest-side, #000 55%, transparent 100%); }
.login-bg .bg-l { left: 0; width: 300px; }
.login-bg .bg-r { right: 0; width: 360px; }
@media (min-width: 1000px) { .login-bg img { display: block; } }
.login-main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 1.2rem 16px 1rem; display: flex; flex-direction: column; align-items: center; }
.login-mark { margin: 0; width: 100%; max-width: 600px; line-height: 0; }
.login-mark img { width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 95%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 95%, transparent 100%);
  mask-composite: intersect; }
.login-sub { margin: .3rem 0 0; width: 100%; display: flex; align-items: center; gap: .9rem; font-weight: 700; font-size: clamp(1rem, 3.6vw, 1.45rem); color: #2a3442; letter-spacing: .01em; }
.login-sub::before, .login-sub::after { content: ""; flex: 1; height: 3px; border-radius: 3px; }
.login-sub::before { background: linear-gradient(to right, transparent, var(--ks-orange)); }
.login-sub::after { background: linear-gradient(to left, transparent, var(--ks-orange)); }
.login-sub span { white-space: nowrap; }
.login-partners { display: flex; align-items: center; justify-content: center; gap: 1.1rem; margin: 1.2rem 0 1.3rem; flex-wrap: nowrap; }
.login-partners img { height: auto; display: block; }
/* NIA and Fire Creek (official files, 2026-11-16): same height, so the pair looks balanced. */
.login-partners .nia, .login-partners .firecreek { width: auto; height: min(120px, 25vw); }
.login-partners .sep { width: 2px; align-self: stretch; background: #9aa6b6; border-radius: 2px; }
.login-main .notice { width: 100%; max-width: 420px; margin: 0 0 .8rem; }
.login-form { width: 100%; max-width: 420px; display: grid; gap: .8rem; }
.login-field { position: relative; display: flex; align-items: center; background: #fff; border: 1px solid #c4cfdd; border-radius: 8px; box-shadow: 0 2px 6px rgba(20, 45, 80, .12); }
.login-field:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(45, 91, 143, .25); }
.login-field .ico { width: 1.45rem; height: 1.45rem; flex: none; margin-left: .85rem; color: #3b4757; }
.login-field input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 1.05rem; padding: .85rem .8rem; color: #1b2430; outline: none; }
.login-field input::placeholder { color: #4f5b6b; }
.login-field .pw-eye { border: 0; background: transparent; padding: .5rem .8rem; margin: 0; color: #3b4757; cursor: pointer; line-height: 0; }
.login-field .pw-eye .ico { margin: 0; }
.login-field .pw-eye.on { color: var(--brand-2); }
.login-form button.login-submit { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; margin-top: .3rem; font-weight: 700; font-size: 1.15rem;
  background: linear-gradient(180deg, #1d4a7c, var(--ks-navy)); border-color: var(--ks-navy); border-radius: 8px; box-shadow: 0 3px 8px rgba(11, 47, 87, .3); }
.login-form button.login-submit:hover { background: var(--ks-navy); }
.login-submit .ico { width: 1.4rem; height: 1.4rem; }
.login-swoosh { position: relative; z-index: 1; line-height: 0; margin-top: 1.5rem; }
.login-swoosh svg { display: block; width: 100%; height: clamp(70px, 9vw, 120px); }
@media (max-width: 480px) {
  .login-main { padding-top: .6rem; }
  .login-partners { gap: .7rem; margin: .9rem 0 1rem; }
}

/* KeyStone field form: pinned location, Change Room / Location panel, "Can't read" ticks. */
.f-locbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--good-bg); color: var(--good-ink); border-radius: 10px; padding: .55rem .7rem; margin: 0 0 .8rem; }
.f-loctext { flex: 1 1 12rem; min-width: 0; line-height: 1.35; }
.f-loctext .muted { color: inherit; opacity: .8; }
.f-need { font-weight: 600; text-decoration: underline; }
.f-locbar button { flex: none; background: #fff; border-color: var(--good-ink); color: var(--good-ink); font-weight: 600; }
.f-locpanel { border: 2px solid var(--good-bg); border-radius: 10px; padding: .7rem .7rem .2rem; margin: -.4rem 0 .9rem; }
.f-locpanel #room-note:not(:empty) { display: block; margin: -.4rem 0 .7rem; color: var(--wait-ink); }
.f-ident-row { display: flex; gap: .4rem; align-items: stretch; }
.f-ident-row input { flex: 1; min-width: 0; }
.f-ident-row button { flex: none; white-space: nowrap; }
#tag-note:not(:empty) { margin: -.3rem 0 .7rem; }
#tag-note button { margin-top: .35rem; }
.f-lab { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .2rem; }
.f-lab > label:first-child, .f-lab1 { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.f-lab > label:first-child { margin: 0; }
.f-lab .cant { font-weight: 400; font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.f-lab .cant input { width: 1.1rem; height: 1.1rem; margin: 0; }
.f-photos-h { margin-top: 1rem; }
.f-photo-btns button { flex: 1 1 0; }
#save-banner:not(:empty) { margin-bottom: .6rem; }
#save-banner button { margin-left: .4rem; }
/* Save bar: the main button gets its own full-width row, Save and Cancel share the second. */
.f-sticky-save { flex-wrap: wrap; }
.f-sticky-save button.primary[data-act="save-next"] { flex: 1 1 100%; }
.f-sticky-save button[data-act="save-next"] ~ button { padding: .6rem; }
body.field:has(button[data-act="save-next"]) { padding-bottom: 9rem; }
.f-photo-btns button { white-space: nowrap; padding-left: .4rem; padding-right: .4rem; }
.f-pin { width: 1.05em; height: 1.05em; vertical-align: -.15em; }
#serial-note:not(:empty) { margin: -.4rem 0 .7rem; }
#serial-note button { margin-top: .35rem; }
.wait-card { border-left: 6px solid var(--wait-ink); background: var(--wait-bg); color: var(--wait-ink); }
.wait-card a { color: inherit; font-weight: 600; }
.cant-read { grid-column: 1 / -1; }
.cant-read .check { display: inline-flex; margin-right: 1.2rem; }
.room-fix input { padding: .3rem .4rem; }

/* KeyStone 1.4.0: permanent records */
.badge.cancelled { background: #ece7f3; color: #4b3a6b; }
.list tr.voided td, .list tr.reversed td { text-decoration: line-through; color: #6b7480; }
.list tr.voided td small, .list tr.reversed td small { text-decoration: none; display: inline-block; }
.list tr.corrected td { color: #6b7480; }
.list tr.reversal td { color: #8a3b12; }
.compare tr.differs td { background: #fff6e0; }
.compare th { text-align: left; width: 18%; }
[data-office-actions] .check, [data-merge-form] .check { display: block; margin: .3rem 0; }
@media (prefers-color-scheme: dark) {
  .badge.cancelled { background: #3a3150; color: #e1d8f2; }
  .compare tr.differs td { background: #3d3420; }
  .list tr.reversal td { color: #f0a77a; }
}

/* ---------- KeyStone 1.5.0: ARMA Ticket first, locked caller boxes, priority help ---------- */
.arma-box input[name="arma_number"] { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; max-width: 22rem; }
.arma-status { margin: .3rem 0 0; min-height: 1.3em; }
.arma-status.ok { color: var(--good-ink); }
.arma-status.warn { background: var(--wait-bg); color: var(--wait-ink); padding: .4rem .6rem; border-radius: 6px; }
.ticket-rest.locked { opacity: .45; }
.caller-locked input:disabled, .caller-locked select:disabled { background: #e9ecf1; color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.prio-grid { display: grid; gap: .8rem; }
@media (min-width: 760px) { .prio-grid { grid-template-columns: minmax(14rem, 1fr) 2fr; align-items: start; } }
.prio-field .field > span { display: flex; align-items: center; gap: .4rem; }
.prio-field { position: relative; }
.prio-info { position: static; display: inline-flex; }
.info-tip { width: 1.6rem; height: 1.6rem; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--brand-2); background: var(--card); color: var(--brand-2); font: italic 700 .9rem/1 Georgia, serif; cursor: help; }
.prio-info .tip { display: none; position: absolute; z-index: 40; top: 2.2rem; left: 0; width: min(26rem, 100%); box-sizing: border-box; background: var(--card); color: var(--ink); border: 2px solid var(--brand-2); border-radius: 8px; padding: .6rem .8rem; box-shadow: 0 8px 22px rgba(20, 30, 45, .22); font-weight: 400; font-size: .92rem; }
.prio-info:hover .tip, .prio-info:focus-within .tip, .prio-info.open .tip { display: block; }
.prio-info .tip-row { display: block; margin-top: .4rem; }
.response-req { border-left: 4px solid var(--brand-2); background: var(--bg); padding: .5rem .8rem; border-radius: 0 8px 8px 0; }
.response-req h3 { margin: 0 0 .3rem; font-size: 1rem; }
.response-req p { margin: .3rem 0; }
.badge.type-com { background: var(--good-bg); color: var(--good-ink); }

/* ---------- KeyStone 1.5.0 Phase B: work classification (catalog) ---------- */
.catalog-search { position: relative; }
.catalog-results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: -.4rem 0 0; padding: .2rem 0; list-style: none; max-height: 18rem; overflow-y: auto; background: var(--card); border: 2px solid var(--brand-2); border-radius: 8px; box-shadow: 0 8px 22px rgba(20, 30, 45, .22); }
.catalog-results li { padding: .45rem .7rem; cursor: pointer; }
.catalog-results li[aria-selected="true"], .catalog-results li:hover { background: var(--bg); color: var(--brand-2); font-weight: 600; }
.catalog-results li[aria-disabled="true"] { cursor: default; font-weight: 400; }
.catalog-lists { display: grid; gap: 0 .8rem; }
@media (min-width: 760px) { .catalog-lists { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.catalog-picker [hidden] { display: none !important; }
.catalog-chosen { margin: .1rem 0 .6rem; }
.catalog-message { margin: 0 0 .6rem; }
.catalog-path { color: var(--brand-2); }
/* Admin > Settings > Work catalog */
.work-catalog td.cat-d1 { padding-left: 1.6rem; }
.work-catalog td.cat-d2 { padding-left: 3.2rem; }
.work-catalog tr.cat-other td { color: var(--muted); }
.cat-actions > summary { cursor: pointer; color: var(--brand-2); }
.cat-actions[open] { min-width: min(22rem, 80vw); }
.cat-form { border-top: 1px solid var(--line); padding: .5rem 0; }
.cat-form h4 { margin: .2rem 0 .4rem; font-size: .95rem; }
button.danger { background: #a3261b; border-color: #a3261b; color: #fff; }
.cat-form input[type="number"] { width: 7rem; }
@media (max-width: 700px) {
  table.list.work-catalog, table.list.work-catalog tbody, table.list.work-catalog tr, table.list.work-catalog td,
  table.list.import-cards, table.list.import-cards tbody, table.list.import-cards tr, table.list.import-cards td { display: block; width: 100%; box-sizing: border-box; }
  table.list.import-cards thead { display: none; }
  table.list.import-cards tr { border-bottom: 2px solid var(--line); padding: .4rem 0; }
  table.list.import-cards td { border: 0; padding: .15rem .6rem; text-align: left; }
  table.list.import-cards td::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  .details dd { overflow-wrap: anywhere; }
  table.list.work-catalog thead { display: none; }
  table.list.work-catalog tr { border-bottom: 2px solid var(--line); padding: .4rem 0; }
  table.list.work-catalog td { border: 0; padding: .15rem .6rem; text-align: left; }
  table.list.work-catalog td::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  table.list.work-catalog td[data-label="Entry"]::before { content: ""; }
  .cat-actions[open] { min-width: 0; }
}

/* ---------- KeyStone 1.5.0 Phase D: check-in / check-out ---------- */
/* The compact timer sits in the existing navigation header (no separate bar or floating window).
   Its state is always written in words ("Escort", "On site", "Parts", "may leave"), not only colour. */
.hdr-timer { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff;
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-decoration: none; flex: none; }
.hdr-timer:hover, .hdr-timer:focus { background: rgba(255,255,255,.28); }
.hdr-timer.warn { background: var(--wait-bg); color: var(--wait-ink) !important; }
.hdr-timer .ht-warn[hidden] { display: none; }
.field .topbar.f-office .hdr-timer { padding: .15rem .55rem; }
.session-notice { border-left: 6px solid var(--ks-orange); }
.session-notice[hidden] { display: none; }
.session-notice h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.session-notice .actions-row { margin-top: .6rem; }
.session-panel h2 { margin-top: 0; }
.big-timer { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
label.choice { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 8px; margin: .3rem 0; cursor: pointer; }
label.choice input { margin-top: .2rem; flex: none; width: auto; }
label.choice.unavailable { opacity: .65; cursor: not-allowed; }
label.check { display: flex; gap: .5rem; align-items: flex-start; margin: .5rem 0; font-size: .92rem; }
label.check input { margin-top: .2rem; flex: none; width: auto; }
label.check[hidden], .checkin-extra[hidden] { display: none; }
.checkin-extra { margin: .4rem 0 .2rem 1.6rem; }
table.time-table tr.running td { background: var(--wait-bg); }
table.time-table tr.time-note td { background: transparent; padding-top: 0; border-top: 0; }
.time-totals { margin-top: .6rem; }
@media (max-width: 700px) {
  .topbar .hdr-timer { order: 1; }
  table.list.time-table, table.list.time-table tbody, table.list.time-table tr, table.list.time-table td,
  table.list[data-open-sessions], table.list[data-open-sessions] tbody, table.list[data-open-sessions] tr, table.list[data-open-sessions] td { display: block; width: 100%; box-sizing: border-box; }
  table.list.time-table thead, table.list[data-open-sessions] thead { display: none; }
  table.list.time-table tr, table.list[data-open-sessions] tr { border-bottom: 2px solid var(--line); padding: .4rem 0; }
  table.list.time-table td, table.list[data-open-sessions] td { border: 0; padding: .15rem .6rem; text-align: left; }
  table.list.time-table td[data-label]::before, table.list[data-open-sessions] td::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  table.list.time-table tr.time-note { border-bottom-width: 1px; }
  .big-timer { font-size: 1.35rem; }
}
@media (max-width: 700px) { table.list.tickets td[data-label=""]::before { content: ""; } }

/* KeyStone 1.5.0 Phase D: Technicians checked in now (Tickets and Check In / Out pages) */
.checked-in-board h2 { margin-top: 0; font-size: 1.1rem; }
.checked-in-board [data-board-status] { margin: .4rem 0 0; }
.checked-in-board [data-board-status].warn { color: var(--warn, #8a5a00); font-weight: 600; }

/* KeyStone 1.5.0 password policy: password boxes with Show/Hide, and the requirements checklist.
   Each line has a symbol and words (met / not met); colour is only a third signal. */
.pw-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.pw-field { display: flex; align-items: stretch; gap: .4rem; }
.pw-field input { flex: 1 1 auto; min-width: 0; }
.pw-field .pw-eye { flex: none; display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; min-width: 44px; padding: .3rem .7rem; margin: 0;
  border: 1px solid #b8c2cf; border-radius: 7px; background: var(--card); color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; }
.pw-field .pw-eye .ico { width: 1.25rem; height: 1.25rem; }
.pw-field .pw-eye.on { border-color: var(--brand-2); color: var(--brand-2); font-weight: 600; }
.pw-field .pw-eye:focus-visible, .pw-rules:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pw-rules { margin: -.3rem 0 .9rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.pw-rules-title { margin: 0 0 .3rem; font-weight: 600; font-size: .92rem; }
.pw-list { list-style: none; margin: 0; padding: 0; }
.pw-rule { display: flex; gap: .5rem; align-items: baseline; padding: .15rem 0; font-size: .92rem; }
.pw-mark { flex: none; width: 1.2rem; text-align: center; font-weight: 700; }
.pw-rule[data-state="yes"] { color: var(--good-ink); }
.pw-rule[data-state="yes"] .pw-mark { color: var(--good-ink); }
.pw-rule[data-state="no"] { color: var(--wait-ink); }
.pw-rule[data-state="wait"] { color: var(--muted); }
@media (max-width: 480px) {
  .pw-field .pw-eye-text { font-size: .85rem; }
  .pw-rule { font-size: .95rem; }
}
