:root {
    --bg: #f4f6fa;
    --ink: #17273e;
    --muted: #69788c;
    --line: #e3e9f1;
    --blue: #2859d7;
    --green: #148569;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
header { min-height: 76px; background: #14243b; color: white; padding: 18px 40px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { font-size: 22px; font-weight: 750; letter-spacing: 1px; }
.brand span { margin-left: 22px; font-size: 13px; font-weight: 400; letter-spacing: 0; color: #b7c7de; }
.header-actions { display: flex; align-items: center; gap: 18px; font-size: 12px; color: #b7c7de; }
main { max-width: 1680px; padding: 34px 40px 24px; margin: auto; }
.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { color: #5277b1; font-size: 10px; font-weight: 750; letter-spacing: 1.8px; }
h1 { margin: 5px 0 7px; font-size: 30px; font-weight: 650; letter-spacing: -.6px; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
p { margin: 0; color: var(--muted); }
.updated { color: var(--muted); font-size: 12px; white-space: nowrap; padding-bottom: 3px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 12px; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; padding: 8px 13px; font: inherit; font-size: 12px; }
button:hover { background: #eef3fc; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--blue); color: white; border-color: var(--blue); font-weight: 600; }
button.primary:hover { background: #204fc4; }
input, select { width: 100%; height: 38px; padding: 7px 10px; border: 1px solid #d7dfea; border-radius: 6px; color: var(--ink); background: white; font: inherit; font-size: 13px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid #91b4fd; outline-offset: 1px; }
.filters { padding: 18px 20px 10px; display: grid; grid-template-columns: 150px 150px 1fr 1fr 1.6fr; gap: 14px; }
label { font-size: 12px; color: #46566b; display: grid; gap: 6px; }
.filter-bottom { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); padding-top: 10px; color: var(--muted); font-size: 11px; }
.filter-bottom button { margin-left: auto; border: none; }
.check { display: flex; gap: 7px; align-items: center; font-size: 12px; cursor: pointer; }
.check input { width: 14px; height: 14px; accent-color: var(--blue); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 20px 0 12px; }
.metric { padding: 18px 21px; min-height: 125px; }
.metric-label { color: #536177; font-size: 12px; }
.metric-value { font-size: 34px; line-height: 1.35; font-weight: 650; letter-spacing: -.7px; margin-top: 4px; }
.metric-value.compact { font-size: 26px; margin-top: 8px; min-height: 38px; letter-spacing: -.4px; }
.green { color: var(--green); }
.metric-note { margin-top: 5px; color: var(--muted); font-size: 11px; }
.method { color: var(--muted); font-size: 11px; padding: 0 2px; margin-bottom: 20px; }
.insights { display: grid; grid-template-columns: 1fr 1.12fr; gap: 18px; margin-bottom: 22px; }
.insight { padding: 20px; min-height: 260px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading span { color: var(--muted); font-size: 11px; }
.city-head, .city-row { display: grid; grid-template-columns: minmax(90px, 1.1fr) minmax(110px, 1.2fr) minmax(145px, 1fr); gap: 14px; align-items: center; }
.city-head { font-size: 10px; color: var(--muted); margin-bottom: 12px; }
.city-row { margin-bottom: 12px; font-size: 12px; }
.city-count { display: flex; align-items: center; gap: 10px; }
.track { height: 6px; background: #edf1f8; border-radius: 3px; flex: 1; overflow: hidden; }
.fill { background: #688de3; height: 100%; border-radius: 3px; }
.city-mean { font-variant-numeric: tabular-nums; }
.city-mean small { color: var(--muted); margin-left: 5px; font-size: 10px; }
.hours { height: 147px; display: grid; grid-template-columns: repeat(24, 1fr); gap: 5px; }
.hour { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 147px; }
.hour-count { font-size: 10px; color: var(--muted); line-height: 20px; }
.hour-track { height: 100px; width: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.hour-bar { background: #547ddb; border-radius: 3px 3px 0 0; width: 100%; }
.hour-label { color: var(--muted); font-size: 9px; margin-top: 7px; }
.chart-note { font-size: 11px; margin-top: 16px; line-height: 1.6; }
.table-panel { overflow: hidden; }
.table-panel > .section-heading { padding: 20px 21px 0; }
.table-panel > .section-heading h2 { margin-bottom: 2px; }
.table-wrap { overflow-x: auto; max-height: 650px; }
table { width: 100%; border-collapse: collapse; min-width: 1240px; font-size: 12px; }
thead { position: sticky; top: 0; z-index: 1; }
th { background: #f8fafd; color: #536177; text-align: left; font-weight: 500; padding: 12px 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
th span { font-size: 10px; font-weight: 400; }
th button.sort { background: transparent; border: 0; padding: 0; font-size: 12px; color: inherit; text-align: left; }
td { vertical-align: top; padding: 14px 13px; border-bottom: 1px solid #edf0f5; }
tbody tr:hover { background: #f9fbff; }
.request { max-width: 325px; min-width: 240px; }
.request-id { font-weight: 650; color: #2859b9; font-size: 13px; }
.request-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; color: #607088; line-height: 1.6; }
.time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.time small { display: block; color: var(--muted); font-size: 10px; }
.badge { display: inline-block; border-radius: 5px; padding: 3px 7px; white-space: nowrap; background: #f0f2f6; color: #617086; font-size: 10px; }
.badge.active { background: #e5f5ee; color: #087557; }
.badge.unavailable { background: #fff2e5; color: #9b6222; }
.badge.missing { background: #edf0f5; color: #67778f; }
.deal { color: #4268b3; font-size: 10px; margin-top: 5px; white-space: nowrap; }
.baseline { font-size: 9px; color: var(--muted); margin-left: 5px; }
.empty { text-align: center; color: var(--muted); padding: 35px; }
.table-footer { padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.table-footer button { padding: 6px 12px; margin-left: 6px; }
footer { font-size: 11px; color: var(--muted); margin-top: 20px; }
.error { padding: 14px 18px; border: 1px solid #eac3c3; background: #fff3f3; color: #953c3c; border-radius: 9px; margin-top: 18px; }
dialog { width: min(1040px, 94vw); max-height: 88vh; border: 1px solid var(--line); border-radius: 14px; padding: 26px; color: var(--ink); }
dialog::backdrop { background: #14243b80; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.dialog-heading h2 { margin-top: 5px; font-size: 22px; }
.detail-description { margin-bottom: 18px; white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 24px; margin-bottom: 22px; }
.detail-grid label { color: var(--muted); font-size: 11px; }
.detail-grid strong { display: block; margin-top: 3px; font-size: 13px; font-weight: 500; }
pre { background: #f4f6fa; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; font-size: 11px; max-height: 300px; white-space: pre-wrap; word-break: break-word; }
.history-summary { color: #526b8f; font-size: 12px; margin: -6px 0 20px; }
.updated-badge { display: inline-block; margin: 5px 0 0 6px; padding: 2px 6px; color: #2859b9; background: #edf3ff; border: 1px solid #cbdcfa; border-radius: 4px; font-size: 10px; line-height: 1.5; font-weight: 500; }
.updated-badge:hover, .updated-badge:focus { background: #dce9ff; }
.publication { min-width: 155px; max-width: 230px; }
.detail-grid strong { white-space: pre-wrap; overflow-wrap: anywhere; }
.history-heading { margin-top: 25px; }
.history-warning { background: #fff7e9; border: 1px solid #ecd6aa; color: #866124; padding: 10px 12px; border-radius: 6px; font-size: 11px; margin: 10px 0; white-space: normal; }
.event { border-left: 2px solid #cedcf2; padding: 0 0 18px 16px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.event-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; }
.event-heading time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-note { color: var(--muted); font-size: 11px; margin: 6px 0 10px; white-space: normal; }
.change { margin-top: 12px; }
.change-label { color: #536177; font-size: 11px; margin-bottom: 5px; }
.change-values { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 8px; font-size: 12px; }
.change-values > div { background: #f5f7fa; padding: 8px 10px; border-radius: 5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.change-values > div:last-child { background: #eff6ff; }
.change-values small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.change-arrow { align-self: center; color: #7590b7; text-align: center; }
.muted { color: var(--muted); }
details summary { cursor: pointer; color: #5874a0; font-size: 11px; margin-top: 12px; }
.raw-data { margin-top: 24px; }
.field-history-popover { position: fixed; z-index: 20; max-height: 360px; overflow: auto; border: 1px solid #ccdaed; background: white; border-radius: 10px; box-shadow: 0 12px 36px #14243b35; padding: 14px; color: var(--ink); text-align: left; white-space: normal; }
.popover-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 10px; font-size: 12px; }
.popover-heading button { padding: 0 5px; font-size: 18px; border: none; }
.field-history-popover .event { padding-left: 10px; }
.field-history-popover .change-values { gap: 4px; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); }
.monitor-panel { padding: 20px; margin-bottom: 22px; }
.monitor-source { min-width: 190px; }
.health-indicators { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 18px; }
.health-indicators > div { display: grid; gap: 7px; align-content: start; }
.health-indicators > div > span { font-size: 11px; color: var(--muted); }
.health { width: fit-content; padding: 5px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.health.ok { background: #e5f5ee; color: #087557; }
.health.failed { background: #fff0ed; color: #a54433; }
.health.unknown { background: #edf0f5; color: #67778f; }
.health.stale { background: #fff4dc; color: #916923; }
.monitor-status strong { font-size: 14px; font-weight: 550; }
.monitor-message { margin-top: 12px; font-size: 12px; color: var(--muted); }
.monitor-message.caution { color: #946722; }
.monitor-actions, .diagnostic-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.monitor-diagnostics { margin-top: 15px; }
.monitor-diagnostics .detail-grid { margin-top: 12px; }
.monitor-reason { font-size: 12px; color: #98624c; margin: 10px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.saved-html { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 14px; font-size: 11px; }
.saved-html .event-note { width: 100%; margin: 0; }
.alert-record { margin: 18px 0; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.alert-facts { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 12px; font-size: 11px; color: #66778e; }
.alert-html { margin-top: 12px; font-size: 11px; }
.alert-html > button { margin-left: 8px; }
.checksum, #html-view-info { overflow-wrap: anywhere; font-size: 11px; color: var(--muted); }
#html-view { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
#html-view-body { white-space: pre; max-height: 420px; }
@media (max-width: 650px) {
    .monitor-panel { padding: 14px; }
    .monitor-panel > .section-heading { flex-wrap: wrap; }
    .health-indicators { grid-template-columns: 1fr 1fr; }
    .monitor-status { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
    main { padding: 26px 22px; }
    header { padding: 18px 22px; }
    .filters { grid-template-columns: repeat(4, 1fr); }
    .search { grid-column: 1 / -1; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .insights { grid-template-columns: 1fr; }
    .updated { display: none; }
}
@media (max-width: 650px) {
    main { padding: 22px 12px; }
    header { padding: 15px; flex-wrap: wrap; }
    .brand span { margin-left: 10px; }
    .header-actions { width: 100%; justify-content: space-between; }
    h1 { font-size: 26px; }
    .filters { grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
    .filter-bottom { flex-wrap: wrap; gap: 8px; }
    .filter-bottom span { width: 100%; order: 3; }
    .metric { padding: 14px; }
    .metric-value.compact { font-size: 20px; }
    .metric-label { font-size: 11px; }
    .metrics { gap: 10px; }
    .insight { padding: 14px; }
    .city-head, .city-row { grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
    .city-row { font-size: 11px; }
    .hours { gap: 3px; }
    .hour-label { font-size: 8px; }
    .table-panel > .section-heading { flex-wrap: wrap; padding: 16px 14px 0; }
    .detail-grid { grid-template-columns: 1fr; }
}


/* Compact monitoring disclosure; diagnostics stay hidden until opened. */
.monitor-panel { padding: 0; overflow: hidden; }
.monitor-summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; border-left: 3px solid #98a5b7; }
.monitor-summary::-webkit-details-marker { display: none; }
.monitor-summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.monitor-panel[data-state="ok"] > summary { border-left-color: var(--green); }
.monitor-panel[data-state="warning"] > summary { border-left-color: #c89635; }
.monitor-title { font-size: 13px; white-space: nowrap; }
.summary-indicator { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; white-space: nowrap; }
.monitor-summary .health { font-size: 11px; padding: 4px 7px; }
.summary-status { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.summary-checked { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.monitor-chevron { color: var(--muted); font-size: 18px; transition: transform .15s; }
.monitor-panel[open] .monitor-chevron { transform: rotate(180deg); }
.monitor-content { padding: 18px; border-top: 1px solid var(--line); }
.monitor-message:empty { display: none; }
.login-main { width: 100%; max-width: 460px; padding: 24px; }
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-card { padding: 30px; display: grid; gap: 18px; }
.login-card h1 { font-size: 25px; margin: 0; }
.login-card label { display: grid; gap: 7px; font-size: 12px; }
.login-card input { width: 100%; }
.login-card .error { margin: 0; }
@media (max-width: 1200px) {
    .monitor-summary { flex-wrap: wrap; gap: 8px 14px; }
    .summary-status { flex: 1; }
}
@media (max-width: 650px) {
    .monitor-panel { padding: 0; }
    .monitor-summary { padding: 12px; }
    .monitor-title { width: calc(100% - 30px); }
    .monitor-chevron { order: -1; }
    .monitor-title { order: -2; }
    .summary-checked { width: 100%; margin-left: 0; }
    .summary-status { flex-basis: 100%; }
    .monitor-content { padding: 14px; }
    .monitor-content > .section-heading { flex-wrap: wrap; }
    .login-card { padding: 24px; }
}
