.loading { padding: 80px; text-align: center; color: var(--sub); }
.table-card, .settings-card, .contact-form { padding: 22px; }
.table-card { overflow: auto; }
.table-card table { width: 100%; border-collapse: collapse; font-size: 11px; }
.table-card th { text-align: left; color: var(--sub); font: 500 8px 'DM Mono'; text-transform: uppercase; }
.table-card th, .table-card td { padding: 12px; border-bottom: 1px solid var(--line); }
.cards-list { display: grid; align-content: start; gap: 14px; }
.settings-card h2, .contact-form h2 { font-size: 15px; margin: 0 0 17px; }
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.form-grid label, .contact-form label { font-size: 9px; color: var(--sub); }
input, select { width: 100%; border: 1px solid #d7ddd5; background: #fff; padding: 10px; border-radius: 7px; color: var(--ink); font: 500 11px Manrope; margin-top: 5px; }
.toggle-row { display: flex; gap: 20px; margin-top: 17px; }
.toggle-row label { display: flex; gap: 7px; align-items: center; color: var(--ink); }
.toggle-row input { width: auto; margin: 0; }
.action { border: 0; border-radius: 7px; padding: 10px 14px; cursor: pointer; font: 600 10px Manrope; }
.primary-action { background: var(--dark); color: white; margin-top: 17px; }
.secondary-action { background: #e7ece6; color: var(--dark); }
.incident-list { display: grid; gap: 12px; }
.incident-row { display: grid; grid-template-columns: minmax(0, 1fr) 136px; column-gap: 24px; align-items: center; padding: 24px; }
.incident-row.has-actions { grid-template-columns: minmax(0, 1fr) 136px auto; }
.incident-row.is-resolved { opacity: .68; }
.incident-main { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.incident-main .state-pill { display: inline-flex; margin: 0 0 2px; }
.incident-row h2, .incident-row h3 { font-size: 12px; margin: 0; }
.incident-row p { font-size: 9px; color: var(--sub); margin: 0; }
.incident-peak { font: 500 14px 'DM Mono'; text-align: right; }
.row-actions { display: flex; gap: 7px; justify-content: flex-end; }
.contacts-layout { display: grid; grid-template-columns: 1.25fr .8fr; align-items: start; gap: 17px; }
.section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.section-head h2 { font-size: 15px; margin: 0; }
.section-head p { font-size: 9px; color: var(--sub); margin: 4px 0 0; }
.card.section-head { align-items: flex-start; flex-direction: column; margin-bottom: 0; padding: 18px 20px; }
.card.section-head > div { min-width: 0; }
.contact-card { padding: 16px; display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: start; }
.contacts-layout .empty { min-height: 140px; flex-direction: column; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.contacts-layout .empty .empty-mark { flex: 0 0 39px; }.contacts-layout .empty strong { margin: 0; line-height: 1.4; }
.contact-card.editing { grid-template-columns: 1fr; align-items: stretch; }
.contact-avatar { width: 38px; height: 38px; border-radius: 10px; background: #e5eee8; color: var(--green); display: grid; place-items: center; font-weight: 700; }
.contact-card h3 { font-size: 12px; margin: 2px 0 8px; }
.channel-list { display: flex; flex-wrap: wrap; gap: 6px; }
.channel-list span { font: 500 8px 'DM Mono'; background: #edf0eb; padding: 5px 7px; border-radius: 5px; }
.contact-actions { display: flex; align-items: center; gap: 10px; }
.edit-link, .cancel-link, .danger-link, .channel-remove { border: 0; background: none; font: 600 9px Manrope; cursor: pointer; }
.edit-link, .cancel-link { color: var(--brand); }
.danger-link, .channel-remove { color: var(--red); }
.channel-fields { display: grid; grid-template-columns: 105px 1fr 30px; gap: 8px; margin-top: 8px; align-items: center; }
.channel-remove { font-size: 16px; }
#addChannel { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 12px; border: 1px dashed rgba(41,71,132,.38); border-radius: 8px; padding: 10px 12px; color: var(--brand); background: var(--brand-soft); font: 600 9px Manrope; cursor: pointer; }
#addChannel:hover { border-style: solid; background: #dfe7f6; } #addChannel:focus-visible { outline: 3px solid rgba(41,71,132,.16); outline-offset: 2px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--dark); color: white; padding: 12px 16px; border-radius: 8px; font-size: 10px; box-shadow: var(--shadow); z-index: 20; }
.toast.error { background: var(--red); }
@media (max-width: 900px) { .contacts-layout { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .incident-row, .incident-row.has-actions { grid-template-columns: 1fr auto; row-gap: 16px; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .form-grid, .incident-row, .incident-row.has-actions, .channel-fields { grid-template-columns: 1fr; }
  .toggle-row { flex-direction: column; gap: 10px; }
  .incident-peak { text-align: left; }
}

/* Dimmer identity: official blue and supplied logo artwork. */
:root {
  --brand: #294784;
  --brand-deep: #1f3768;
  --brand-soft: #e9eef8;
  --ink: #17233a;
  --sub: #65718a;
  --paper: #f4f6fa;
  --card: #ffffff;
  --line: #dfe5ef;
  --dark: var(--brand);
  --green: var(--brand);
  --lime: #ffffff;
  --amber: #e7a73e;
  --shadow: 0 18px 50px rgba(41, 71, 132, .09);
}
body { background: var(--paper); }
.topbar { background: var(--brand); border-bottom: 0; box-shadow: 0 8px 28px rgba(36, 61, 107, .18); }
.logo { width: 126px; height: 46px; overflow: hidden; flex: 0 0 auto; text-decoration: none; }
.logo img { width: 126px; height: 46px; display: block; object-fit: cover; }
.topbar nav button { color: rgba(255, 255, 255, .72); cursor: pointer; }
.topbar nav button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topbar nav button.active { color: var(--brand); background: #fff; }
.signed-in-user small { display: block; font-size: 8px; font-weight: 400; opacity: .7; }
.system-ok { color: #fff; }
.system-ok i { background: #9ee6c0; box-shadow: 0 0 0 4px rgba(158, 230, 192, .18); }
.lang { border-color: rgba(255, 255, 255, .3); }
.lang button { color: rgba(255, 255, 255, .7); }
.lang button.active { color: var(--brand); background: #fff; }
.avatar { color: var(--brand); background: #fff; }
.metrics { background: var(--brand); }
.metric label, .metric p, .metric strong small { color: rgba(255, 255, 255, .68); }
.metric .good { color: #fff; }
.tag, .state-pill { color: var(--brand); background: var(--brand-soft); }
.device-icon, .empty-mark, .contact-avatar { color: var(--brand); background: var(--brand-soft); }
.series { stroke: var(--brand); }
.dot { stroke: var(--brand); }
.primary-action, .button-grid .primary, .toast { background: var(--brand); }
.secondary-action { color: var(--brand); background: var(--brand-soft); }
.footer a { color: var(--brand); }
input:focus, select:focus { border-color: var(--brand); outline: 3px solid rgba(41, 71, 132, .12); }
.view-as-banner { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 10px 24px; color: #fff; background: #17233a; font-size: 10px; }
.view-as-banner button { border: 1px solid rgba(255,255,255,.38); border-radius: 6px; padding: 7px 10px; color: #fff; background: transparent; font: 600 9px Manrope; cursor: pointer; }
.view-as-banner button:hover { background: rgba(255,255,255,.12); }
.signed-in-user { max-width: 140px; overflow: hidden; color: rgba(255,255,255,.78); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.logout-link { border: 0; padding: 6px 0; color: #fff; background: transparent; font: 600 9px Manrope; cursor: pointer; }
.user-card { display: grid; grid-template-columns: 38px minmax(0,1fr) auto auto auto; gap: 12px; align-items: center; padding: 16px; }
.user-card h2 { margin: 0; font-size: 11px; }.user-card p { margin: 4px 0 0; color: var(--sub); font-size: 8px; }
.role-pill { padding: 6px 8px; border-radius: 6px; color: var(--brand); background: var(--brand-soft); font: 500 8px 'DM Mono'; }
.user-status { color: var(--sub); font-size: 8px; }.user-status.active { color: var(--brand); }
.user-active { display: flex !important; align-items: center; gap: 8px; color: var(--ink) !important; }.user-active input { width: auto; margin: 0; }
@media(max-width:800px){.user-card{grid-template-columns:38px 1fr auto}.user-card .role-pill,.user-card .user-status{grid-column:2}.user-card .contact-actions{grid-column:3;grid-row:1/4}}

/* Sensor fleet view. */
.sensor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.discovered-section { margin-bottom: 24px; padding: 18px; border: 1px solid #e8c875; border-radius: 13px; background: #fff9e9; }
.discovered-section > .section-head { align-items: center; }.discovery-count { min-width: 28px; padding: 6px; border-radius: 14px; color: #fff; background: var(--amber); text-align: center; font: 600 9px 'DM Mono'; }
.discovered-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }.discovered-card { padding: 18px; }
.discovered-head,.discovered-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }.discovered-head span,.discovered-footer small { color: var(--sub); font-size: 8px; }.discovered-head h3 { margin: 3px 0 0; font: 600 13px 'DM Mono'; }
.discovered-settings { display: grid; grid-template-columns: 1.2fr 1fr 1fr .7fr .7fr; gap: 9px; margin: 14px 0; }.discovered-settings label { color: var(--sub); font-size: 8px; }.discovered-footer small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.discovered-footer .primary-action { flex: 0 0 auto; margin: 0; }
.form-error { margin: 14px 0 4px; padding: 11px 13px; border: 1px solid rgba(201,87,79,.4); border-radius: 8px; color: #963b35; background: #fff1ef; font-size: 9px; }
.form-error strong { display: block; margin-bottom: 5px; }.form-error ul { margin: 0; padding-left: 18px; }.field-invalid { color: #963b35 !important; font-weight: 600; }.field-invalid input,.field-invalid select,[aria-invalid="true"] { border-color: #c9574f; background: #fffafa; outline: 3px solid rgba(201,87,79,.1); }
.sensor-card { padding: 22px; }
.sensor-card.sensor-received { animation: sensor-received 1.5s ease-out; }
.sensor-card.sensor-alarm { border-color: rgba(201,87,79,.55); box-shadow: 0 18px 50px rgba(201,87,79,.12); }
.sensor-card.sensor-alarm .sensor-live { background: rgba(201,87,79,.32); }
.sensor-card.sensor-offline { border: 2px solid #963b35; box-shadow: 0 18px 50px rgba(150,59,53,.2); }
.sensor-card.sensor-offline .sensor-live { background: rgba(150,59,53,.38); }
.state-pill.alarm { color: #a43f38; background: #f8e7e5; }
.alarm-value { color: var(--red); }
.reading-alert { margin-top: 5px; color: var(--red) !important; font-weight: 700; text-transform: uppercase; }
@keyframes sensor-received {
  0% { border-color: #84a6eb; box-shadow: 0 0 0 0 rgba(41,71,132,.48), var(--shadow); }
  35% { border-color: var(--brand); box-shadow: 0 0 0 7px rgba(41,71,132,.18), 0 20px 54px rgba(41,71,132,.2); }
  100% { border-color: var(--line); box-shadow: 0 0 0 13px rgba(41,71,132,0), var(--shadow); }
}
.sensor-card-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.sensor-card-head h2 { margin: 2px 0 0; font-size: 16px; }
.sensor-location { margin: 0; color: var(--brand); font: 500 8px 'DM Mono'; letter-spacing: .06em; text-transform: uppercase; }
.state-pill.online { color: var(--brand); background: var(--brand-soft); }
.state-pill.offline { color: var(--red); background: #f8e7e5; }
.sensor-live { display: grid; grid-template-columns: .7fr 1.3fr; gap: 1px; margin: 18px 0; overflow: hidden; border-radius: 9px; background: var(--line); }
.sensor-live > div { min-height: 78px; padding: 13px; background: #f3f5f9; }
.sensor-live span, .sensor-live small { display: block; color: var(--sub); font-size: 8px; }
.sensor-live strong { display: block; margin: 7px 0 3px; font: 600 15px 'DM Mono'; }
.sensor-live strong small { display: inline; font-size: 8px; }
.device-identity { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.device-identity div { min-width: 0; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.device-identity div:nth-child(odd) { border-right: 1px solid var(--line); }
.device-identity div:nth-last-child(-n+2) { border-bottom: 0; }
.device-identity dt { margin-bottom: 5px; color: var(--sub); font-size: 8px; text-transform: uppercase; }
.device-identity dd { margin: 0; overflow: hidden; color: var(--ink); font: 500 10px 'DM Mono'; text-overflow: ellipsis; white-space: nowrap; }
.sensor-settings { display: grid; grid-template-columns: 1.3fr .8fr .9fr; gap: 10px; }
.sensor-settings > label { color: var(--sub); font-size: 9px; }
.input-suffix { display: flex; align-items: center; gap: 7px; }
.input-suffix small { color: var(--sub); font-size: 8px; white-space: nowrap; }
.sensor-card-footer { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.sensor-card-footer .toggle-row, .sensor-card-footer .primary-action { margin: 0; }
.sensor-buttons { display: flex; gap: 7px; }
.sensor-history { margin: 18px -22px -22px; padding: 18px 22px 20px; border-top: 1px solid var(--line); background: #f7f8fb; border-radius: 0 0 13px 13px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.history-head > strong { font-size: 11px; }
.history-head div { display: flex; gap: 4px; }
.history-head button { padding: 5px 8px; border: 0; border-radius: 5px; color: var(--sub); background: #e7eaf0; font: 600 8px Manrope; cursor: pointer; }
.history-head button.active { color: #fff; background: var(--brand); }
.sensor-history svg { display: block; width: 100%; min-width: 620px; height: auto; }
.history-chart-scroll, .history-table-wrap { overflow-x: auto; }
.history-axis-label, .history-axis-unit { fill: var(--sub); font: 8px 'DM Mono'; }
.history-point { fill: rgba(255,255,255,.72); stroke: var(--brand); stroke-width: 2; cursor: crosshair; transition: r .12s ease, fill .12s ease; }
.history-point:hover, .history-point:focus { r: 7px; fill: var(--brand); outline: none; }
.history-range { stroke: rgba(41,71,132,.28); stroke-width: 3; stroke-linecap: round; }
.history-tooltip { position: fixed; z-index: 100; display: none; max-width: 320px; padding: 10px 12px; border-radius: 8px; color: #fff; background: var(--ink); box-shadow: 0 10px 30px rgba(23,35,58,.25); pointer-events: none; }
.history-tooltip.visible { display: grid; gap: 4px; }
.history-tooltip strong { font: 600 12px 'DM Mono'; }
.history-tooltip span { color: rgba(255,255,255,.76); font-size: 9px; white-space: nowrap; }
.history-summary { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 5px; color: var(--sub); font: 500 8px 'DM Mono'; }
.history-loading { min-height: 155px; display: grid; place-items: center; color: var(--sub); font-size: 10px; }
.history-table-wrap { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.history-table { min-width: 720px; font-size: 9px; }
.history-table th, .history-table td { padding: 9px 10px; white-space: nowrap; }
.history-table th { color: var(--sub); font: 500 7px 'DM Mono'; }
@media(max-width:1000px){.sensor-grid{grid-template-columns:1fr}}
@media(max-width:1000px){.discovered-grid{grid-template-columns:1fr}.discovered-settings{grid-template-columns:1fr 1fr}}
@media(max-width:600px){.sensor-settings{grid-template-columns:1fr}.sensor-card-footer{align-items:stretch;flex-direction:column}.sensor-buttons{justify-content:space-between}.device-identity{grid-template-columns:1fr}.device-identity div,.device-identity div:nth-child(odd),.device-identity div:nth-last-child(-n+2){border-right:0;border-bottom:1px solid var(--line)}.device-identity div:last-child{border-bottom:0}.history-head{align-items:start;flex-direction:column}}
@media(prefers-reduced-motion:reduce){.sensor-card.sensor-received{animation:none;border-color:var(--brand)}}

/* Operational overview. */
.overview-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(310px,.7fr); gap: 17px; margin-top: 17px; }
.overview-chart-explainer { display: flex; align-items: center; gap: 14px; margin-top: 14px; color: var(--sub); font-size: 8px; }
.overview-chart-explainer span { display: flex; align-items: center; gap: 5px; }.overview-chart-explainer b { margin-left: auto; font-weight: 500; }
.overview-chart-explainer i { display: inline-block; width: 15px; }.average-key { border-top: 2px solid var(--brand); }.range-key { border-top: 4px solid rgba(41,71,132,.25); }
.overview-chart { height: 225px; margin-top: 4px; padding-left: 0; }.overview-chart svg { height: 215px; }
.overview-axis { fill: var(--sub); font: 8px 'DM Mono'; }.overview-range { stroke: rgba(41,71,132,.25); stroke-width: 4; stroke-linecap: round; }.overview-dot { cursor: help; }
.attention-card { padding: 22px; }
.overview-incidents { display: grid; gap: 8px; margin-top: 16px; }
.overview-incident { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.overview-incident:last-child { border-bottom: 0; }
.overview-incident div strong, .overview-incident div small { display: block; }
.overview-incident div strong { font-size: 10px; }
.overview-incident div small { margin-top: 3px; color: var(--sub); font-size: 8px; }
.overview-incident > b { font: 500 12px 'DM Mono'; }
.overview-incident > b small { color: var(--sub); font-size: 7px; }
.empty.compact, .incident-empty { min-height: 150px; flex-direction: column; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.empty.compact .empty-mark, .incident-empty .empty-mark { flex: 0 0 39px; }
.empty.compact strong, .incident-empty strong { margin: 0; line-height: 1.4; }
.fleet-section { margin: 20px 0 17px; }
.fleet-section .section-head { margin-bottom: 10px; }
.fleet-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.fleet-sensor { display: flex; justify-content: space-between; gap: 10px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.fleet-sensor > div:first-child { min-width: 0; }
.fleet-sensor span, .fleet-sensor small { display: block; color: var(--sub); font-size: 7px; }
.fleet-sensor > div:first-child strong { display: block; margin: 4px 0; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.fleet-reading { flex: 0 0 auto; text-align: right; }
.fleet-reading > strong { font: 600 15px 'DM Mono'; }
.fleet-reading > span { display: inline; }
.fleet-reading small { margin-top: 7px; color: var(--brand); }
.fleet-sensor.alarm { border-color: rgba(201,87,79,.55); background: #fff8f7; }
.fleet-sensor.alarm .fleet-reading strong, .fleet-sensor.alarm .fleet-reading small { color: var(--red); }
.fleet-sensor.offline { border: 2px solid #963b35; background: #fff5f4; }
.fleet-sensor.offline .fleet-reading small { color: #963b35; font-weight: 700; }
.admin-tools { margin-top: 17px; }
.admin-tools > button { margin-bottom: 9px; }
.admin-tools-panel { padding: 18px; }
.admin-tools-panel > p { margin: 0 0 13px; color: var(--sub); font-size: 9px; }
.admin-test-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.admin-test-grid > div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 5px; padding: 8px; border-radius: 7px; background: #f1f3f7; }
.admin-test-grid span { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.admin-test-grid button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--brand); background: #fff; font-size: 8px; cursor: pointer; }
.admin-test-grid button.primary { color: #fff; background: var(--brand); }
@media(max-width:1100px){.fleet-grid{grid-template-columns:repeat(3,1fr)}.admin-test-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:900px){.overview-grid{grid-template-columns:1fr}.fleet-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.fleet-grid,.admin-test-grid{grid-template-columns:1fr}}
