/* arrivalPulseRelayAdmin web UI styles (look of the approved prototype).
   Plain CSS, no framework and no build step. Sections: base elements and
   utility classes (.row, .stack, .card, .tbl, .pill, buttons, inputs),
   login, app frame (header, menu, content), displays, modal and toast,
   agency alert text, relay command notice. Status colours: .st-ok green,
   .st-warn orange, .st-pend blue, .st-bad red, .st-off grey (the same
   meaning everywhere: pills, tiles, map markers). */

/* Base elements and utility classes */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #F4F5F7; color: #16191D; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; }
[hidden] { display: none !important; }
a { color: #1F4FB8; } a:hover { color: #163A8A; }
h1 { margin: 0; font-size: 22px; font-weight: 600; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: #5B636D; }
.small { font-size: 12px; }
.error { color: #B42318; font-weight: 500; }
.grow { flex: 1; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: #FFFFFF; border: 1px solid #DDE1E6; border-radius: 8px; }
.pad { padding: 16px 18px; }
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; min-width: 760px; }
.tbl.narrow { min-width: 520px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: #4D5560; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid #DDE1E6; background: #FAFBFC; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #EEF0F2; vertical-align: top; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #F7F9FC; }
.empty { padding: 24px; text-align: center; color: #5B636D; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.st-ok { background: #E3F4E8; color: #14532D; } .st-ok .dot { background: #1E8E3E; }
.st-warn { background: #FFF1DE; color: #7A3E00; } .st-warn .dot { background: #F08C1A; }
.st-off { background: #ECEEF1; color: #3D444D; } .st-off .dot { background: #8A939E; }
.st-pend { background: #E6EDFB; color: #173F8F; } .st-pend .dot { background: #2F64D6; }
.st-bad { background: #FDECEA; color: #8A1C12; } .st-bad .dot { background: #B42318; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid #C5CBD3; background: #FFFFFF; color: #16191D; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F0F2F5; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { min-height: 28px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: #1F4FB8; border-color: #1F4FB8; color: #FFFFFF; } .btn-primary:hover { background: #163A8A; }
.btn-danger { border-color: #B42318; color: #B42318; } .btn-danger:hover { background: #FDECEA; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: #4D5560; margin-bottom: 4px; }
.inp { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid #C5CBD3; border-radius: 6px; font: inherit; background: #FFFFFF; color: #16191D; }
textarea.inp { min-height: 140px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.hint { font-size: 12px; color: #5B636D; margin-top: 4px; }
.seg { display: inline-flex; border: 1px solid #C5CBD3; border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: #FFFFFF; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; color: #2B3138; }
.seg button + button { border-left: 1px solid #C5CBD3; }
.seg .on { background: #16191D; color: #FFFFFF; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #ECEEF1; font-size: 12px; margin: 0 6px 4px 0; }
.notice { padding: 12px 14px; border-radius: 6px; background: #FFF1DE; color: #7A3E00; }
.notice.info { background: #E6EDFB; color: #173F8F; }
.notice.ok { background: #E3F4E8; color: #14532D; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.title { font-size: 20px; font-weight: 600; }

/* App frame */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.header { background: #FFFFFF; border-bottom: 1px solid #DDE1E6; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand-name { font-weight: 600; font-size: 16px; }
.body { flex: 1; display: flex; align-items: flex-start; }
.menu { flex: 0 0 220px; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.nav { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 6px; color: #2B3138; text-decoration: none; font-weight: 500; }
.nav:hover { background: #E8EBEF; color: #2B3138; }
.nav-on { background: #DCE6FA; color: #123A8C; }
.nav .pill { padding: 1px 8px; margin-left: auto; }
.content { flex: 1; min-width: 0; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 20px; }

/* Displays */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.tile.on { outline: 2px solid #1F4FB8; outline-offset: -1px; }
.tile .num { font-size: 28px; font-weight: 600; margin-top: 8px; }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 16px; }
.kv > div:nth-child(odd) { color: #5B636D; }
.kv.kv-tight { grid-template-columns: 120px 1fr; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
#map { height: 560px; border-radius: 8px; }
.countdown { font-size: 22px; font-weight: 600; }

/* Modal and toast */
.modal { position: fixed; inset: 0; background: rgba(22, 25, 29, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.modal-card { width: 100%; max-width: 480px; padding: 22px; display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow: auto; }
.modal-title { font-size: 17px; font-weight: 600; }
.toast { position: fixed; right: 16px; bottom: 16px; max-width: 420px; background: #16191D; color: #FFFFFF; padding: 12px 16px; border-radius: 8px; z-index: 1100; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.bad { background: #B42318; }

@media (max-width: 760px) {
  .header { padding: 10px 16px; }
  .body { flex-direction: column; align-items: stretch; }
  .menu { position: static; flex: none; flex-direction: row; overflow-x: auto; padding: 8px 12px; gap: 4px; border-bottom: 1px solid #DDE1E6; background: #FFFFFF; }
  .nav { white-space: nowrap; padding: 7px 10px; }
  .content { padding: 16px 16px 40px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv > div:nth-child(even) { margin-bottom: 8px; }
  #map { height: 420px; }
}
.alert-item { border-top: 1px solid #EEF0F2; padding: 10px 0; display: grid; gap: 4px; }
.alert-item:first-child { border-top: 0; }
.pre-line { white-space: pre-line; }
/* Agency alert text that contained HTML (rebuilt by safeHtml() in app.js):
   only paragraphs, line breaks, emphasis, lists and links remain; they use
   the admin UI's own fonts and sizes. */
.agency-html p { margin: 0 0 6px; }
.agency-html p:last-child { margin-bottom: 0; }
.agency-html ul, .agency-html ol { margin: 4px 0 6px; padding-left: 22px; }
/* Notice to the other signed-in users after a relay start/stop/restart
   (renderServiceNotice() in app.js). */
.svc-notice { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid #DDE1E6; }
.svc-notice[hidden] { display: none; }
.svc-info { background: #E8F1FB; }
.svc-warn { background: #FFF4E5; }
.svc-bad  { background: #FDECEA; }
/* v26.0.8: diagnostics banner (Detailed logging / tracing), health card */
.diag-line + .diag-line { margin-top: 4px; }
.health-warn { color: #9A3412; font-weight: 600; }
.btn-small { padding: 3px 8px; font-size: 12px; }
.inp-date { max-width: 150px; }
