@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url(fonts/barlow-semi-condensed-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-semi-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-semi-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  --ink: #17212C;
  --ink-2: #384553;
  --muted: #5F6C7A;
  --paper: #EEF1F3;
  --panel: #FFFFFF;
  --line: #D3D9DF;
  --line-2: #E5E9ED;
  --sign: #0B5CAD;
  --sign-deep: #08427D;
  --sign-wash: #E6EFF9;
  --amber: #9A5700; --amber-bg: #FFF1D6;
  --green: #1B6E40; --green-bg: #E2F2E8;
  --red: #A8261C; --red-bg: #FBE6E3;
  --slate: #55606C; --slate-bg: #E8EBEE;
  --ui: "Barlow", "Segoe UI", system-ui, sans-serif;
  --head: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r-sm: 4px; --r-md: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 15px/1.5 var(--ui); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--sign); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: .005em; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 .75em; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid #F2B705; outline-offset: 2px; }
[hidden] { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail { background: var(--ink); color: #DCE3EA; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.placard { background: var(--sign); color: #fff; border-radius: var(--r-md); padding: 4px; text-decoration: none; display: block; }
.placard-inner { border: 2px solid rgba(255,255,255,.9); border-radius: 4px; padding: 10px 12px 11px; }
.placard .code { font-family: var(--head); font-weight: 700; font-size: 46px; line-height: .95; letter-spacing: .01em; }
.placard .site { font-family: var(--head); font-weight: 500; font-size: 15px; opacity: .92; margin-top: 4px; }
.onsite-pill { display: flex; align-items: baseline; gap: 8px; margin: 14px 2px 6px; padding: 10px 12px; border-radius: var(--r-md); background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.onsite-pill .n { font-family: var(--head); font-weight: 700; font-size: 28px; line-height: 1; }
.onsite-pill .l { font-size: 14px; color: #C3CDD7; }
.onsite-pill:hover { background: rgba(255,255,255,.1); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav a { color: #C9D3DC; text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.me { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.me .who { color: #fff; font-weight: 600; font-size: 14px; }
.me .role { color: #9FB0C0; }
.me a { color: #C9D3DC; margin-right: 12px; }
.dev-flag { margin-top: 10px; font-size: 12px; color: #F2B705; }
main { padding: 28px 36px 64px; min-width: 0; max-width: 1240px; }

/* page header */
.page-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* buttons + inputs */
.btn { font: 600 14px/1 var(--ui); border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; }
.btn:hover { border-color: #AAB4BE; }
.btn.primary { background: var(--sign); border-color: var(--sign); color: #fff; }
.btn.primary:hover { background: var(--sign-deep); }
.btn.go { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { padding: 6px 10px; min-height: 30px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--sign); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 4px; color: var(--ink-2); }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  font: 400 15px/1.35 var(--ui); color: var(--ink); width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; min-height: 40px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sign); box-shadow: 0 0 0 3px var(--sign-wash); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--ink); margin: 6px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--sign); }
.field { margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; }

/* surfaces */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px; margin-bottom: 18px; }
.panel > h2 { margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-gap { margin-top: 30px; }
.empty { color: var(--muted); padding: 18px 0 4px; }
.err-banner { background: var(--red-bg); color: var(--red); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px; font-weight: 500; }
.ok-banner { background: var(--green-bg); color: var(--green); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px; font-weight: 500; }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: #F6F8FA; }

/* status */
.status { display: inline-block; font: 600 12.5px/1 var(--ui); padding: 5px 8px; border-radius: 3px; white-space: nowrap; }
.s-PENDING { background: var(--amber-bg); color: var(--amber); }
.s-APPROVED { background: var(--green-bg); color: var(--green); }
.s-DENIED { background: var(--red-bg); color: var(--red); }
.s-CANCELLED, .s-CLOSED, .s-EXPIRED { background: var(--slate-bg); color: var(--slate); }
.s-ONSITE { background: var(--sign); color: #fff; }
.s-LEFT, .s-EXPECTED { background: var(--slate-bg); color: var(--slate); }
.s-DECLARED { background: var(--slate-bg); color: var(--slate); }
.s-ON_SITE, .s-STORED { background: var(--sign-wash); color: var(--sign-deep); }
.s-INSTALLED { background: var(--green-bg); color: var(--green); }
.s-OFF_SITE { background: var(--slate-bg); color: var(--slate); }
.s-DESTROYED { background: var(--ink); color: #fff; }
.flag { color: var(--red); font-weight: 600; }

/* ticket detail */
.ticket-id { font-family: var(--mono); font-weight: 500; font-size: 26px; letter-spacing: -.02em; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; margin: 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.purpose { white-space: pre-wrap; max-width: 72ch; }
.item { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px; }
.item-head { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: start; }
.item-head .actions { justify-content: flex-end; align-items: center; }
.item-title { font-weight: 600; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.kv span b { font-weight: 500; color: var(--muted); }

/* timelines */
.timeline { list-style: none; margin: 10px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--sign); }
.timeline li:last-child { padding-bottom: 0; }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline .what { font-weight: 500; }
.timeline .detail { font-size: 13.5px; color: var(--ink-2); }
.sig-thumb { display: inline-block; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; max-width: 220px; max-height: 80px; }

/* dashboard tallies */
.tallies { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.tally { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; text-decoration: none; color: inherit; }
.tally .n { font-family: var(--head); font-weight: 700; font-size: 34px; line-height: 1; }
.tally .l { color: var(--muted); font-size: 14px; margin-top: 6px; }
.tally.warn .n { color: var(--amber); }
.tally.alert .n { color: var(--red); }

/* on-site board */
.board-count { font-family: var(--head); font-weight: 700; font-size: 64px; line-height: .9; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.badge-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; text-decoration: none; color: inherit; display: block; }
.badge-tile:hover { border-color: var(--sign); }
.badge-strip { background: var(--sign); color: #fff; padding: 8px 14px; display: flex; justify-content: space-between; align-items: baseline; }
.badge-no { font-family: var(--mono); font-weight: 500; font-size: 24px; letter-spacing: -.02em; }
.badge-strip .since { font-size: 13px; opacity: .9; }
.badge-body { padding: 10px 14px 12px; }
.badge-body .nm { font-weight: 600; font-size: 16px; }
.badge-body .co { color: var(--ink-2); }
.badge-body .meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.badge-tile.overdue .badge-strip { background: var(--amber); }
.print-only { display: none; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.login { width: 100%; max-width: 400px; }
.login .placard { margin-bottom: 18px; }
.login .placard .code { font-size: 64px; }
.login .card { background: var(--panel); border-radius: var(--r-md); padding: 24px; }
.login h1 { font-size: 24px; margin-bottom: 16px; }
.devusers { display: grid; gap: 8px; }
.devusers .btn { justify-content: space-between; width: 100%; }

/* modal */
dialog#modal { border: 0; border-radius: var(--r-md); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 60px rgba(10,20,30,.35); }
dialog#modal::backdrop { background: rgba(14,22,30,.55); }
.modal-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 14px 22px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.sigpad { border: 1px dashed #9AA6B2; border-radius: var(--r-sm); background: #fff; width: 100%; height: 150px; touch-action: none; display: block; cursor: crosshair; }
.sigrow { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }

/* repeating rows */
.rows { display: grid; gap: 10px; }
.rowset { display: grid; gap: 10px; align-items: end; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 12px; background: #FAFBFC; }
.rowset.visitor { grid-template-columns: 1.3fr 1fr 1.2fr .9fr auto; }
.rowset.equip { grid-template-columns: 1.6fr 1fr 1fr 1.1fr 1fr .5fr .9fr auto; }
.rowset label { font-size: 12.5px; }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-sm); max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.bad { background: var(--red); }

.hash { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.chain-ok { border-left: 4px solid var(--green); }
.chain-bad { border-left: 4px solid var(--red); }
.spinner { color: var(--muted); padding: 30px 0; }

@media (max-width: 1100px) {
  .rowset.equip { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .rowset.visitor { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; }
  .placard .code { font-size: 26px; }
  .placard .site { display: none; }
  .placard-inner { padding: 4px 8px; }
  .onsite-pill { margin: 0; padding: 6px 10px; }
  .onsite-pill .n { font-size: 20px; }
  .nav { flex-direction: row; flex-wrap: wrap; margin: 0; width: 100%; order: 3; }
  .nav a { padding: 6px 10px; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; }
  .me .role { display: none; }
  main { padding: 18px 14px 48px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .rowset.equip, .rowset.visitor { grid-template-columns: 1fr; }
  .item-head { grid-template-columns: 1fr; }
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; border: 0; padding: 3px 0; }
  table.stack td:empty { display: none; }
  .tablewrap table:not(.stack) { min-width: 640px; }
  .item-head .actions { justify-content: flex-start; }
  .board-count { font-size: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  body { background: #fff; font-size: 12px; }
  .rail, .actions, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .board { display: none; }
  .print-only { display: block; }
  .print-only table td, .print-only table th { border: 1px solid #999; padding: 6px; }
}
