:root {
  --aq-navy: #08253a;
  --aq-petrol: #0d3f55;
  --aq-blue: #176985;
  --aq-background: #e8f0f3;
  --aq-card: #ffffff;
  --aq-soft: #f1f6f8;
  --aq-border: #d3e0e5;
  --aq-text: #0c2538;
  --aq-muted: #617b8b;
  --aq-success: #1f8b63;
  --aq-success-soft: #dff3e9;
  --aq-warning: #bd741f;
  --aq-warning-soft: #fff0d8;
  --aq-danger: #c84248;
  --aq-danger-soft: #fde7e8;
  --aq-offline: #7b8d97;
  --aq-offline-soft: #e8eef0;
  --aq-radius-lg: 24px;
  --aq-radius-md: 16px;
  --aq-shadow: 0 8px 26px rgba(8, 37, 58, .075);
  --sidebar-width: 244px;
  --touch: 48px;
}

* { box-sizing: border-box; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
html { background: var(--aq-background); }
body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--aq-background);
  color: var(--aq-text);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 4px solid #69bad8; outline-offset: 3px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  background: var(--aq-navy);
  color: #fff;
}
.sidebar-brand { min-height: 62px; padding: 0 9px; display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 15px;
  background: rgba(255,255,255,.1);
  font-size: 17px;
  font-weight: 900;
}
.sidebar-brand strong { display: block; font-size: 21px; line-height: 1.05; letter-spacing: -.02em; }
.sidebar-brand small { margin-top: 3px; display: block; color: #aac0cc; font-weight: 700; }
.side-nav { margin-top: 34px; display: grid; gap: 8px; }
.side-nav a {
  min-height: var(--touch);
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #bcd0da;
  text-decoration: none;
  font-weight: 750;
}
.side-nav a.active { background: #fff; color: var(--aq-navy); box-shadow: 0 8px 18px rgba(0,0,0,.15); }
.nav-mark { width: 15px; height: 15px; flex: 0 0 auto; border: 2px solid currentColor; border-radius: 5px; opacity: .82; }
.side-nav a.active .nav-mark { background: var(--aq-blue); border-color: var(--aq-blue); box-shadow: inset 0 0 0 3px #fff; }
.nav-count { min-width: 24px; height: 24px; margin-left: auto; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; background: var(--aq-danger); color: #fff; font-size: 12px; }
.sidebar-status { margin-top: auto; padding: 17px; border: 1px solid rgba(255,255,255,.12); border-radius: 17px; background: rgba(255,255,255,.065); }
.sidebar-status strong { margin-top: 8px; display: flex; align-items: center; gap: 9px; font-size: 15px; }
.sidebar-status small { margin: 5px 0 0 20px; display: block; color: #aac0cc; }

.workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  min-height: 72px;
  padding: 11px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--aq-border);
  background: rgba(255,255,255,.92);
}
.topbar > div:first-child strong { display: block; color: var(--aq-navy); font-size: 18px; }
.topbar > div:first-child small { color: var(--aq-muted); }
.topbar-status { display: flex; align-items: center; }
.topbar-status > div { min-width: 102px; padding: 0 17px; border-left: 1px solid var(--aq-border); }
.topbar-status span { display: block; color: var(--aq-muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.topbar-status strong { margin-top: 2px; display: block; color: var(--aq-navy); font-size: 14px; }
.test-mode-banner {
  margin: 16px 30px 0;
  min-height: 58px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #e5c188;
  border-left: 5px solid var(--aq-warning);
  border-radius: 15px;
  background: var(--aq-warning-soft);
  color: #684216;
}
.banner-mark { padding: 6px 9px; border-radius: 8px; background: var(--aq-warning); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.test-mode-banner strong { display: block; font-size: 14px; }
.test-mode-banner small { margin-top: 2px; display: block; color: #795224; }

main { width: min(100%, 1500px); margin: 0 auto; padding: 25px 30px 36px; }
.page-title { margin-bottom: 21px; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.page-title h1, .device-detail-header h1 { margin: 3px 0 0; color: var(--aq-navy); font-size: clamp(30px, 3vw, 40px); line-height: 1.08; letter-spacing: -.035em; }
.page-title p { margin: 7px 0 0; color: var(--aq-muted); }
.eyebrow, .metric-label { color: var(--aq-muted); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow.inverse { color: #91adb9; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 23px; }
.metric-card, .section-block, .device-card, .data-card, .gsm-card, .system-card, .device-command-card {
  min-width: 0;
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-radius-lg);
  background: var(--aq-card);
  box-shadow: var(--aq-shadow);
}
.metric-card { min-height: 132px; padding: 19px 21px; border-top: 4px solid var(--aq-blue); }
.metric-card > strong { margin: 8px 0 4px; display: block; color: var(--aq-navy); font-size: 31px; line-height: 1; letter-spacing: -.03em; }
.metric-card small { color: var(--aq-muted); }
.metric-card.success { border-top-color: var(--aq-success); }
.metric-card.warning { border-top-color: var(--aq-warning); }
.metric-card.danger { border-top-color: var(--aq-danger); }
.metric-card.muted { border-top-color: var(--aq-offline); }

.section-block { margin-bottom: 22px; padding: 23px 25px; }
.compact-section { padding-bottom: 14px; }
.section-title { margin-bottom: 17px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-title h2 { margin: 3px 0 0; color: var(--aq-navy); font-size: 23px; line-height: 1.15; }
.text-link, .back-link { min-height: 44px; padding: 9px 13px; display: inline-flex; align-items: center; border-radius: 11px; color: var(--aq-blue); text-decoration: none; font-weight: 800; }
.text-link:hover, .back-link:hover { background: var(--aq-soft); }
.section-count {
  min-height: 32px;
  padding: 6px 11px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--aq-offline-soft);
  color: var(--aq-navy);
  font-size: 12px;
  font-weight: 850;
}
.section-count.success { background: var(--aq-success-soft); color: #155f45; }
.section-count.warning { background: var(--aq-warning-soft); color: #684216; }

.device-list { display: grid; gap: 10px; }
.device-row {
  min-height: 108px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) minmax(130px, .7fr) minmax(210px, 1.1fr) minmax(135px, .75fr) 24px;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--aq-border);
  border-radius: 18px;
  background: var(--aq-soft);
  text-decoration: none;
}
.device-row:hover { border-color: #9eb9c5; }
.device-identity { min-width: 0; display: flex; align-items: center; gap: 13px; }
.device-identity > div, .card-heading > div, .device-detail-header > div,
.section-title > div, .alarm-card > div, .job-card > div:first-child,
.test-sms-card > div, .user-summary > div, .device-command-card > div { min-width: 0; }
.device-avatar { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; background: var(--aq-petrol); color: #fff; font-size: 13px; font-weight: 900; }
.device-identity strong, .filter-summary strong, .last-contact strong { display: block; color: var(--aq-navy); }
.device-identity small, .filter-summary small { margin-top: 3px; display: block; color: var(--aq-muted); overflow-wrap: anywhere; }
.filter-summary > div:first-child { display: flex; justify-content: space-between; gap: 12px; color: var(--aq-muted); font-size: 12px; }
.filter-summary > div:first-child strong { font-size: 12px; }
.last-contact span { color: var(--aq-muted); font-size: 12px; }
.last-contact strong { margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.row-arrow { color: var(--aq-blue); font-size: 29px; line-height: 1; }

.status-badge {
  min-height: 34px;
  max-width: 100%;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: var(--aq-offline-soft);
  color: var(--aq-offline);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: anywhere;
}
.status-badge.large { min-height: 42px; padding: 9px 14px; font-size: 12px; }
.status-badge.success { background: var(--aq-success-soft); color: var(--aq-success); }
.status-badge.warning { background: var(--aq-warning-soft); color: var(--aq-warning); }
.status-badge.danger { background: var(--aq-danger-soft); color: var(--aq-danger); }
.status-dot { width: 10px; height: 10px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.status-dot.ok, .status-dot.success, .data-row .status-dot.info { color: var(--aq-success); background: var(--aq-success); }
.status-dot.warning { color: var(--aq-warning); background: var(--aq-warning); }
.status-dot.error, .status-dot.danger { color: var(--aq-danger); background: var(--aq-danger); }
.status-dot.muted { color: var(--aq-offline); background: var(--aq-offline); }

.progress { height: 10px; margin: 8px 0 5px; overflow: hidden; border-radius: 999px; background: #d9e5e9; }
.progress span { width: var(--progress, 0%); height: 100%; display: block; border-radius: inherit; background: var(--aq-success); }
.progress.warning span { background: var(--aq-warning); }
.progress.danger span { background: var(--aq-danger); }
.progress.unavailable { background: repeating-linear-gradient(135deg, #d9e5e9 0, #d9e5e9 8px, #e8f0f3 8px, #e8f0f3 16px); }
.filter-progress { width: 100%; height: 10px; margin: 8px 0 5px; display: block; overflow: hidden; border: 0; border-radius: 999px; background: #d9e5e9; accent-color: var(--aq-success); }
.filter-progress::-webkit-progress-bar { border-radius: 999px; background: #d9e5e9; }
.filter-progress::-webkit-progress-value { border-radius: 999px; background: var(--aq-success); }
.filter-progress::-moz-progress-bar { border-radius: 999px; background: var(--aq-success); }

.rows { display: grid; }
.data-row { min-height: 67px; padding: 14px 12px; display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--aq-border); }
.data-row:first-child { border-top: 0; }
.data-row strong { color: var(--aq-navy); }
.data-row small { margin-top: 3px; display: block; color: var(--aq-muted); }

.device-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.device-card { padding: 23px; color: inherit; text-decoration: none; }
.card-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-heading h2 { margin: 3px 0 0; color: var(--aq-navy); font-size: 24px; }
.card-heading p { margin: 5px 0 0; color: var(--aq-muted); }
.filter-panel { margin-top: 18px; padding: 16px; border: 1px solid var(--aq-border); border-radius: 16px; background: var(--aq-soft); }
.filter-panel.large { padding: 20px; }
.filter-heading, .filter-scale { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; }
.filter-heading { color: var(--aq-muted); }
.filter-heading strong { color: var(--aq-navy); }
.filter-scale { color: var(--aq-muted); font-size: 12px; }
.info-pairs { margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.info-pairs > div, .settings-list > div { min-width: 0; padding: 15px 17px; border: 1px solid var(--aq-border); border-radius: 14px; background: var(--aq-soft); }
dt { color: var(--aq-muted); font-size: 11px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
dd { margin: 4px 0 0; color: var(--aq-navy); font-weight: 750; overflow-wrap: anywhere; }
.card-action { min-height: 44px; margin-top: 14px; display: flex; align-items: center; justify-content: flex-end; color: var(--aq-blue); font-weight: 800; }

.device-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 17px;
}
.device-page-grid { margin-bottom: 22px; }
.device-overview-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-radius-lg);
  background: var(--aq-card);
  box-shadow: var(--aq-shadow);
}
.section-block .device-overview-card { box-shadow: none; }
.device-overview-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.device-overview-heading h3 {
  margin: 3px 0 0;
  color: var(--aq-navy);
  font-size: 22px;
  line-height: 1.2;
}
.device-overview-heading .device-identity small {
  display: block;
  margin-top: 4px;
  color: var(--aq-muted);
  overflow-wrap: anywhere;
}
.device-overview-facts {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.device-overview-facts > div {
  min-width: 0;
  min-height: 105px;
  padding: 14px 16px;
  border: 1px solid var(--aq-border);
  border-radius: 14px;
  background: var(--aq-soft);
}
.device-overview-facts dd { font-size: 16px; }
.device-overview-facts small {
  display: block;
  margin-top: 5px;
  color: var(--aq-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.device-overview-facts .filter-progress,
.device-overview-facts .progress { margin: 9px 0 5px; }
.danger-text { color: var(--aq-danger); }
.device-status-query {
  min-width: 0;
  margin-top: 12px;
  padding: 15px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--aq-border);
  border-left: 5px solid var(--aq-blue);
  border-radius: 15px;
  background: #fff;
}
.device-status-query-copy { min-width: 0; }
.query-state {
  width: max-content;
  max-width: 100%;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--aq-offline);
  font-size: 17px;
  overflow-wrap: anywhere;
}
.query-state.success { color: var(--aq-success); }
.query-state.warning { color: var(--aq-warning); }
.query-state.muted { color: var(--aq-offline); }
.device-status-query-copy small,
.device-status-query-action small {
  display: block;
  margin-top: 4px;
  color: var(--aq-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.device-status-query-action {
  min-width: 150px;
  display: grid;
  justify-items: stretch;
  text-align: center;
}
.device-status-query-action form { margin: 0; }
.device-status-query-action .primary-button { width: 100%; }
.device-detail-link {
  min-height: 44px;
  margin-top: 9px;
  padding: 8px 5px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--aq-blue);
  text-decoration: none;
  font-weight: 800;
}
.device-detail-link:hover { text-decoration: underline; }

/* Hovedoversigten er bevidst tæt: én læsbar række pr. enhed på brede skærme. */
.overview-metrics { gap: 10px; margin-bottom: 15px; }
.overview-metrics .metric-card {
  min-height: 88px;
  padding: 13px 17px;
  border-top-width: 3px;
}
.overview-metrics .metric-card > strong { margin: 5px 0 2px; font-size: 25px; }
.overview-metrics .metric-card small { font-size: 12px; }
.compact-device-section { padding: 18px 20px 16px; }
.compact-device-section .section-title { margin-bottom: 10px; }
.compact-section-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.compact-device-table {
  --compact-device-columns: minmax(105px, 1.15fr) minmax(82px, .85fr) minmax(72px, .65fr) minmax(110px, 1fr) minmax(78px, .7fr) minmax(108px, .95fr) minmax(108px, 1fr) minmax(112px, 1fr) minmax(96px, .8fr);
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--aq-border);
  border-radius: 15px;
  background: #fff;
}
.compact-device-header,
.compact-device-row {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--compact-device-columns);
  align-items: center;
  gap: 10px;
}
.compact-device-header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 14px 14px 0 0;
  border-bottom: 1px solid var(--aq-border);
  background: rgba(241, 246, 248, .97);
  color: var(--aq-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.compact-device-rows { min-width: 0; }
.compact-device-row {
  min-height: 76px;
  padding: 8px 11px;
  border-top: 1px solid var(--aq-border);
  background: #fff;
}
.compact-device-row:first-child { border-top: 0; }
.compact-device-row:nth-child(even) { background: #f8fbfc; }
.compact-device-row:hover { background: var(--aq-soft); }
.compact-device-row.has-alarm { box-shadow: inset 4px 0 0 var(--aq-danger); }
.compact-device-cell { min-width: 0; }
.compact-cell-label { display: none; }
.compact-device-link {
  min-width: 0;
  display: block;
  border-radius: 9px;
  color: inherit;
  text-decoration: none;
}
.compact-device-link:hover strong { color: var(--aq-blue); text-decoration: underline; }
.compact-device-link strong,
.compact-device-location strong,
.compact-device-serial strong,
.compact-device-value strong,
.compact-device-filter strong,
.compact-device-received strong {
  display: block;
  color: var(--aq-navy);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.compact-device-health small,
.compact-device-filter small,
.compact-device-received small,
.compact-device-query small,
.compact-device-action small {
  margin-top: 2px;
  display: block;
  color: var(--aq-muted);
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.compact-device-serial strong,
.compact-device-value strong,
.compact-device-filter strong,
.compact-device-received time { font-variant-numeric: tabular-nums; }
.compact-device-health .status-badge {
  min-height: 27px;
  padding: 5px 8px;
  gap: 6px;
  font-size: 9px;
  line-height: 1.2;
}
.compact-device-health .status-dot,
.compact-query-state .status-dot { width: 8px; height: 8px; }
.compact-device-health small.danger-text { color: var(--aq-danger); font-weight: 750; }
.compact-device-filter .filter-progress,
.compact-device-filter .progress { height: 6px; margin: 4px 0 2px; }
.compact-query-state {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--aq-offline);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.compact-query-state.success { color: var(--aq-success); }
.compact-query-state.warning { color: var(--aq-warning); }
.compact-query-state.muted { color: var(--aq-offline); }
.compact-device-action { text-align: center; }
.compact-device-action form { margin: 0; }
.compact-status-button {
  width: 100%;
  min-width: 0;
  min-height: var(--touch);
  padding: 7px 9px;
  border-radius: 11px;
  font-size: 12px;
  white-space: normal;
}

.back-link { margin: -8px 0 10px; }
.device-detail-header { margin-bottom: 20px; padding: 23px 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-radius: var(--aq-radius-lg); background: var(--aq-navy); color: #fff; }
.device-detail-header h1 { color: #fff; }
.device-detail-header h2 { margin: 7px 0 0; font-size: 21px; }
.device-detail-header p { margin: 4px 0 0; color: #aec3ce; }
.device-detail-header .eyebrow { color: #9fbac6; }
.device-command-card {
  margin-bottom: 20px;
  padding: 21px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  border-left: 5px solid var(--aq-blue);
}
.device-command-card h2 { margin: 3px 0 6px; color: var(--aq-navy); font-size: 22px; line-height: 1.2; }
.device-command-card p { max-width: 760px; margin: 0; color: var(--aq-muted); overflow-wrap: anywhere; }
.device-command-card p + p { margin-top: 8px; }
.device-command-actions { min-width: 0; display: grid; justify-items: end; gap: 8px; }
.device-command-actions > div { min-width: 0; display: grid; justify-items: end; gap: 8px; }
.device-command-actions form { margin: 0; }
.device-command-actions small, .device-command-actions .field-help { max-width: 360px; margin: 0; color: var(--aq-muted); text-align: right; overflow-wrap: anywhere; }
.device-command-actions .primary-button { max-width: 100%; white-space: normal; }
.detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.data-card { min-height: 137px; padding: 22px; }
.data-card > span { color: var(--aq-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.data-card > strong { margin: 11px 0 5px; display: block; color: var(--aq-navy); font-size: 31px; }
.data-card > strong.small-value { font-size: 17px; overflow-wrap: anywhere; }
.data-card small { color: var(--aq-muted); }
.detail-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 25px; }
.settings-list { margin: 15px 0 0; display: grid; gap: 8px; }
.settings-list > div { display: flex; justify-content: space-between; gap: 18px; }
.settings-list dd { margin-top: 0; text-align: right; }
.telemetry-list > div { padding: 13px 15px; border-bottom: 1px solid var(--aq-border); }
.telemetry-list dt, .telemetry-list dd { min-width: 0; overflow-wrap: anywhere; }
.telemetry-list dt { flex: 1; }
.telemetry-list dd { flex: 2; }

.title-count { min-height: 42px; padding: 9px 14px; display: inline-flex; align-items: center; border-radius: 999px; font-weight: 850; }
.title-count.success { background: var(--aq-success-soft); color: var(--aq-success); }
.title-count.danger { background: var(--aq-danger-soft); color: var(--aq-danger); }
.alarm-list { display: grid; gap: 11px; }
.alarm-card { position: relative; min-height: 118px; padding: 18px 18px 18px 24px; display: flex; align-items: center; gap: 20px; overflow: hidden; border: 1px solid #efc8ca; border-radius: 17px; background: var(--aq-danger-soft); }
.alarm-accent { position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--aq-danger); }
.alarm-card > div { flex: 1; }
.alarm-card h3 { margin: 3px 0 0; color: var(--aq-navy); font-size: 21px; }
.alarm-card p { margin: 5px 0; color: var(--aq-muted); }
.alarm-card small { color: var(--aq-muted); }
.history-clear {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--aq-border);
}
.history-clear summary {
  width: max-content;
  max-width: 100%;
  min-height: var(--touch);
  padding: 11px 18px;
  border: 2px solid #efc8ca;
  border-radius: 13px;
  background: #fff;
  color: #8f252a;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.history-clear summary::-webkit-details-marker { display: none; }
.history-clear summary:focus-visible { outline: 4px solid #69bad8; outline-offset: 3px; }
.history-clear-confirmation {
  margin-top: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #efc8ca;
  border-radius: 14px;
  background: var(--aq-danger-soft);
}
.history-clear-confirmation p { margin: 4px 0 0; color: #704246; }
.history-clear-confirmation form { flex: 0 0 auto; }
.primary-button, .secondary-button, .danger-button {
  min-height: var(--touch);
  min-width: 134px;
  padding: 10px 18px;
  border: 2px solid transparent;
  border-radius: 13px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}
.primary-button { background: var(--aq-petrol); color: #fff; }
.secondary-button { border-color: var(--aq-border); background: #fff; color: var(--aq-navy); }
.danger-button { background: var(--aq-danger); color: #fff; }
button:disabled { cursor: not-allowed; opacity: .46; }

.empty-state { padding: 38px 20px; display: grid; justify-items: center; text-align: center; }
.empty-state.small { padding: 25px 18px; }
.empty-state h2, .empty-state h3 { margin: 10px 0 3px; color: var(--aq-navy); }
.empty-state p { margin: 0; color: var(--aq-muted); }
.empty-symbol, .empty-check { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--aq-offline-soft); color: var(--aq-offline); font-weight: 900; }
.success-state .empty-check { background: var(--aq-success-soft); color: var(--aq-success); font-size: 24px; }
.empty-note { padding: 20px; color: var(--aq-muted); text-align: center; }

.sms-overview-grid .metric-card { min-height: 126px; }
.sms-overview-grid .metric-card > strong {
  max-width: 100%;
  font-size: 27px;
  overflow-wrap: anywhere;
}
.sms-overview-grid .metric-card > strong.compact-value {
  font-size: 18px;
  line-height: 1.25;
}
.section-intro {
  max-width: 940px;
  margin: -5px 0 17px;
  color: var(--aq-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.job-list, .communication-list { display: grid; gap: 11px; }
.job-card {
  min-height: 96px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
  border: 1px solid var(--aq-border);
  border-left: 5px solid var(--aq-offline);
  border-radius: 16px;
  background: var(--aq-soft);
}
.job-card.status-success { border-left-color: var(--aq-success); }
.job-card.status-warning { border-left-color: var(--aq-warning); }
.job-card.status-danger { border-left-color: var(--aq-danger); }
.job-content { min-width: 0; }
.sms-card-kicker {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 12px;
}
.job-card h3 {
  margin: 9px 0 5px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  color: var(--aq-navy);
  font-size: 19px;
}
.technical-label {
  color: var(--aq-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .07em;
}
.sms-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 17px;
  color: var(--aq-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.sms-meta-line > * { min-width: 0; overflow-wrap: anywhere; }
.job-card .notice {
  max-width: 76ch;
  margin: 13px 0 0;
  line-height: 1.45;
}
.job-card form { margin-top: 12px; }
.job-card .reviewed-at { margin-top: 10px; display: block; color: var(--aq-muted); }
.sms-error-details { max-width: 76ch; margin-top: 11px; }
.sms-error-details summary {
  width: max-content;
  max-width: 100%;
  padding: 5px 0;
  color: var(--aq-blue);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.sms-error-details p {
  margin: 6px 0 0;
  color: #8f252a;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.job-status { display: grid; justify-items: end; gap: 7px; }
.job-status strong { color: var(--aq-muted); font-size: 12px; }
.job-card .status-badge.success,
.communication-row .status-badge.success { color: #155f45; }
.job-card .status-badge.warning,
.communication-row .status-badge.warning { color: #684216; }
.job-card .status-badge.danger,
.communication-row .status-badge.danger { color: #8f252a; }
.job-card .status-badge.muted,
.communication-row .status-badge.muted { color: #465a65; }

.sms-journey {
  grid-column: 1 / -1;
  width: 100%;
  margin: 1px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
}
.sms-step {
  min-width: 0;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  border: 1px solid var(--aq-border);
  border-radius: 13px;
  background: #fff;
}
.sms-step > div { min-width: 0; }
.sms-step-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--aq-offline-soft);
  color: var(--aq-navy);
  font-size: 13px;
  font-weight: 900;
}
.sms-step-label {
  display: block;
  color: var(--aq-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.sms-step strong {
  margin: 3px 0 4px;
  display: block;
  color: var(--aq-navy);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.sms-step small,
.sms-step-time {
  display: block;
  color: var(--aq-muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.sms-step-time { margin-top: 7px; font-weight: 750; }
.sms-step.tone-success { border-color: #9ccfbb; }
.sms-step.tone-success .sms-step-icon { background: var(--aq-success-soft); color: #155f45; }
.sms-step.tone-warning { border-color: #e5c188; }
.sms-step.tone-warning .sms-step-icon { background: var(--aq-warning-soft); color: #684216; }
.sms-step.tone-danger { border-color: #efc8ca; }
.sms-step.tone-danger .sms-step-icon { background: var(--aq-danger-soft); color: #8f252a; }
.sms-step.tone-muted .sms-step-icon { background: var(--aq-offline-soft); color: #465a65; }
.device-command-progress {
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 18px;
  border-top: 1px solid var(--aq-border);
}
.device-command-progress > .eyebrow { display: block; margin-bottom: 9px; }
.device-command-progress .sms-journey { margin-bottom: 0; }

.communication-header,
.communication-row {
  display: grid;
  grid-template-columns: minmax(105px, .42fr) minmax(180px, 1fr) minmax(145px, .58fr) minmax(175px, .68fr);
  gap: 17px;
}
.communication-header {
  padding: 0 18px 6px;
  color: var(--aq-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.communication-row {
  min-height: 88px;
  padding: 16px 18px;
  align-items: start;
  border: 1px solid var(--aq-border);
  border-left: 5px solid var(--aq-offline);
  border-radius: 15px;
  background: var(--aq-soft);
}
.communication-row.status-success { border-left-color: var(--aq-success); }
.communication-row.status-warning { border-left-color: var(--aq-warning); }
.communication-row.status-danger { border-left-color: var(--aq-danger); }
.direction-badge {
  width: max-content;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--aq-offline-soft);
  color: #465a65;
  font-size: 11px;
  font-weight: 900;
  white-space: normal;
  text-align: center;
}
.direction-badge.incoming { background: #dceef4; color: #0d526b; }
.direction-badge.outgoing { background: var(--aq-petrol); color: #fff; }
.communication-copy, .communication-state { min-width: 0; }
.communication-copy strong { display: block; color: var(--aq-navy); }
.communication-copy small {
  margin-top: 5px;
  display: block;
  color: #526d7c;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.communication-state { display: grid; justify-items: start; gap: 7px; }
.message-type {
  color: var(--aq-navy);
  font-size: 13px;
  font-weight: 850;
}
.communication-row time {
  min-width: 0;
  justify-self: end;
  color: var(--aq-muted);
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.communication-row time > span {
  display: block;
  color: var(--aq-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.communication-row time > strong {
  margin-top: 5px;
  display: block;
  color: var(--aq-navy);
  font-size: 12px;
  overflow-wrap: normal;
}

.system-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 22px; }
.system-card { min-height: 128px; padding: 21px; border-left: 5px solid var(--aq-offline); }
.system-card > span { color: var(--aq-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.system-card > strong { margin: 11px 0 5px; display: flex; align-items: center; gap: 9px; color: var(--aq-navy); font-size: 19px; }
.system-card small { color: var(--aq-muted); }
.system-card.success { border-left-color: var(--aq-success); }
.system-card.warning { border-left-color: var(--aq-warning); }
.system-card.danger { border-left-color: var(--aq-danger); }

/* Mellemstore skærme beholder alle oplysninger i én tæt enhedsblok på to linjer. */
@media (max-width: 1360px) {
  .compact-device-header { display: none; }
  .compact-device-row {
    min-height: 104px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto;
    column-gap: 9px;
    row-gap: 7px;
  }
  .compact-cell-label {
    margin-bottom: 2px;
    display: block;
    color: var(--aq-muted);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .045em;
    text-transform: uppercase;
  }
  .compact-device-customer { grid-column: 1 / 4; grid-row: 1; }
  .compact-device-location { grid-column: 4 / 6; grid-row: 1; }
  .compact-device-serial { grid-column: 6 / 8; grid-row: 1; }
  .compact-device-health { grid-column: 8 / 11; grid-row: 1; }
  .compact-device-value { grid-column: 1 / 3; grid-row: 2; }
  .compact-device-filter { grid-column: 3 / 5; grid-row: 2; }
  .compact-device-received { grid-column: 5 / 8; grid-row: 2; }
  .compact-device-query { grid-column: 8 / 11; grid-row: 2; }
  .compact-device-action { grid-column: 11 / 13; grid-row: 1 / 3; align-self: center; }
}

/* Raspberry Pi 1024×600: permanent sidebar, kompakt to-kolonneindhold. */
@media (max-width: 1120px), (max-height: 650px) {
  :root { --sidebar-width: 210px; --aq-radius-lg: 20px; }
  body { font-size: 14px; }
  .sidebar { padding: 15px 12px; }
  .side-nav { margin-top: 20px; gap: 5px; }
  .sidebar-status { padding: 13px; }
  .topbar { min-height: 58px; padding: 7px 20px; }
  .topbar > div:first-child small { display: none; }
  .topbar-status > div { min-width: 83px; padding: 0 12px; }
  .test-mode-banner { margin: 10px 20px 0; min-height: 50px; padding: 7px 12px; }
  main { padding: 15px 20px 25px; }
  .page-title { margin-bottom: 13px; }
  .page-title h1, .device-detail-header h1 { font-size: 29px; }
  .page-title p { margin-top: 4px; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
  .metric-card { min-height: 105px; padding: 15px 16px; }
  .metric-card > strong { margin: 5px 0 3px; font-size: 25px; }
  .section-block { margin-bottom: 14px; padding: 18px 20px; }
  .section-title { margin-bottom: 10px; }
  .device-row { min-height: 92px; padding: 12px 14px; grid-template-columns: minmax(165px, 1.2fr) minmax(110px, .65fr) minmax(175px, 1fr) minmax(105px, .65fr) 18px; gap: 10px; }
  .device-avatar { width: 38px; height: 38px; }
  .device-card { padding: 17px; }
  .device-overview-card { padding: 17px; }
  .filter-panel { margin-top: 12px; padding: 12px; }
  .info-pairs { margin-top: 10px; gap: 6px; }
  .info-pairs > div { padding: 12px 14px; }
  .detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .system-card { min-height: 105px; padding: 15px 16px; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 190px; }
  .metric-grid, .system-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-row { grid-template-columns: minmax(150px, 1fr) minmax(125px, .7fr) minmax(170px, 1fr) 18px; }
  .last-contact { display: none; }
  .device-card-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .gsm-card { grid-template-columns: 1fr; }
}

/* Mobil er sekundært; navigationen bliver en kompakt top-shell uden JavaScript. */
@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 10px 12px; }
  .sidebar-brand { min-height: 48px; }
  .brand-mark { width: 40px; height: 40px; }
  .sidebar-brand strong { font-size: 18px; }
  .side-nav { margin-top: 9px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .side-nav a { min-height: 45px; padding: 7px; justify-content: center; font-size: 12px; }
  .nav-mark { display: none; }
  .sidebar-status { display: none; }
  .topbar { display: none; }
  .test-mode-banner { margin: 10px 10px 0; }
  main { padding: 15px 10px 24px; }
  .metric-grid, .device-card-grid, .detail-metrics, .system-status-grid { grid-template-columns: 1fr 1fr; }
  .device-overview-grid { grid-template-columns: 1fr; }
  .device-row { grid-template-columns: 1fr auto 18px; }
  .filter-summary, .last-contact { display: none; }
  .page-title { display: block; }
  .device-detail-header { align-items: flex-start; flex-direction: column; }
  .device-command-card { grid-template-columns: 1fr; align-items: stretch; }
  .device-command-actions, .device-command-actions > div { justify-items: start; }
  .device-command-actions form, .device-command-actions .primary-button { width: 100%; }
  .device-command-actions small, .device-command-actions .field-help { max-width: none; text-align: left; }
  .job-card { grid-template-columns: 1fr; }
  .job-status {
    width: 100%;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: start;
    justify-items: start;
  }
  .communication-header { display: none; }
  .communication-row { grid-template-columns: 1fr; gap: 10px; }
  .communication-row .direction-badge { justify-self: start; }
  .communication-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .communication-row time { justify-self: start; text-align: left; }
  .compact-device-section { padding: 14px 12px 12px; }
  .compact-device-section .section-title { align-items: center; }
  .compact-section-actions { justify-content: flex-start; }
  .compact-device-row {
    min-height: 0;
    padding: 11px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    align-items: start;
    gap: 10px 14px;
  }
  .compact-device-customer,
  .compact-device-location,
  .compact-device-serial,
  .compact-device-health,
  .compact-device-value,
  .compact-device-filter,
  .compact-device-received,
  .compact-device-query,
  .compact-device-action { grid-column: auto; grid-row: auto; }
  .compact-device-action { align-self: end; }
  .compact-device-health .status-badge { max-width: 100%; }
}

@media (max-width: 480px) {
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid, .detail-metrics, .system-status-grid, .info-pairs { grid-template-columns: 1fr; }
  .alarm-card { align-items: flex-start; flex-direction: column; }
  .job-card, .communication-row { padding: 14px; }
  .card-heading { flex-direction: column; align-items: flex-start; }
  .device-overview-heading { align-items: flex-start; flex-direction: column; }
  .device-overview-facts { grid-template-columns: 1fr; }
  .device-status-query { grid-template-columns: 1fr; }
  .device-status-query-action { width: 100%; }
  .job-status { width: 100%; justify-items: start; }
  .alarm-card form, .alarm-card button { width: 100%; }
  .history-clear-confirmation { align-items: stretch; flex-direction: column; }
  .history-clear-confirmation form, .history-clear-confirmation button { width: 100%; }
  .settings-list > div { display: block; }
  .settings-list dd { margin-top: 5px; text-align: left; }
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-metrics .metric-card { min-height: 80px; padding: 11px 13px; }
  .overview-metrics .metric-card > strong { font-size: 22px; }
  .compact-device-customer,
  .compact-device-health,
  .compact-device-action { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Login, konto og sikker test-SMS */
.auth-body {
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(135deg, var(--aq-navy) 0 44%, var(--aq-background) 44%);
}
.auth-shell {
  width: min(920px, 100%);
  min-height: 520px;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  overflow: hidden;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(8, 37, 58, .24);
}
.auth-brand {
  padding: 48px 42px;
  background: var(--aq-petrol);
  color: #fff;
}
.auth-brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 18px;
  background: rgba(255,255,255,.1);
  font-size: 21px;
  font-weight: 900;
}
.auth-brand strong { display: block; font-size: 30px; line-height: 1; }
.auth-brand small { color: #b9ced7; font-size: 18px; font-weight: 700; }
.auth-brand p { max-width: 300px; margin-top: 34px; color: #d8e5ea; }
.auth-card { padding: 45px 48px; }
.auth-card h1 { margin: 5px 0 3px; color: var(--aq-navy); font-size: 36px; }
.auth-intro, .auth-help, .field-help { color: var(--aq-muted); }
.auth-form { margin-top: 22px; display: grid; gap: 9px; }
.auth-form label { margin-top: 5px; color: var(--aq-navy); font-weight: 800; }
.auth-form input[type="text"], .auth-form input[type="password"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  border: 2px solid var(--aq-border);
  border-radius: 12px;
  background: #fff;
  color: var(--aq-text);
  font: inherit;
}
.auth-form input:focus { border-color: var(--aq-blue); outline: 3px solid #d8eef6; }
.auth-submit { width: 100%; margin-top: 13px; }
.auth-help, .field-help { margin: 13px 0 0; font-size: 13px; }
.auth-secondary-action { margin-top: 12px; text-align: center; }
.notice {
  padding: 14px 16px;
  border: 1px solid var(--aq-border);
  border-radius: 12px;
  background: var(--aq-soft);
  color: var(--aq-text);
}
.notice.success { border-color: #a8d8c5; background: var(--aq-success-soft); color: #155f45; }
.notice.warning { border-color: #e5c188; background: var(--aq-warning-soft); color: #684216; }
.notice.danger { border-color: #efc8ca; background: var(--aq-danger-soft); color: #8f252a; }
.auth-card .notice { margin-top: 16px; }
.topbar-actions, .account-actions { display: flex; align-items: center; gap: 13px; }
.account-actions { padding-left: 2px; border-left: 1px solid var(--aq-border); }
.account-actions a, .account-actions button {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--aq-blue);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.account-actions a:hover, .account-actions button:hover { background: var(--aq-soft); }
.flash-stack { margin: 16px 30px 0; display: grid; gap: 8px; }
.test-sms-card {
  margin-bottom: 22px;
  padding: 22px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  border: 2px solid #d6b26f;
  border-radius: var(--aq-radius-lg);
  background: var(--aq-warning-soft);
}
.test-sms-card h2 { margin: 4px 0; color: var(--aq-navy); }
.test-sms-card p { max-width: 760px; margin: 0; color: #684216; }
.test-sms-card form { flex: 0 0 auto; }

@media (max-width: 800px) {
  .auth-body { padding: 12px; background: var(--aq-background); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 24px; }
  .auth-brand p { margin-top: 15px; }
  .auth-card { padding: 28px 24px; }
  .test-sms-card { align-items: stretch; flex-direction: column; }
  .test-sms-card button { width: 100%; }
  .flash-stack { margin: 10px 10px 0; }
}

/* Testbruger-administration */
.title-count {
  background: var(--aq-offline-soft);
  color: var(--aq-navy);
}
.user-create-card .field-help { max-width: 700px; }
.user-mode-notice { margin: 0 0 22px; }
.user-form {
  max-width: 700px;
  display: grid;
  gap: 8px;
}
.user-form label {
  margin-top: 5px;
  color: var(--aq-navy);
  font-weight: 800;
}
.user-form input[type="text"],
.user-form input[type="password"],
.user-form input[type="tel"],
.user-form select {
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  border: 2px solid var(--aq-border);
  border-radius: 12px;
  background: #fff;
  color: var(--aq-text);
  font: inherit;
}
.user-form input:focus,
.user-form select:focus {
  border-color: var(--aq-blue);
  outline: 3px solid #d8eef6;
}
.user-form > button { width: max-content; margin-top: 8px; }
.user-list { display: grid; gap: 12px; }
.user-card {
  padding: 19px;
  border: 1px solid var(--aq-border);
  border-radius: 17px;
  background: var(--aq-soft);
}
.user-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
}
.user-summary strong {
  display: block;
  color: var(--aq-navy);
  font-size: 17px;
  overflow-wrap: anywhere;
}
.user-summary small {
  margin-top: 3px;
  display: block;
  color: var(--aq-muted);
}
.user-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--aq-petrol);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}
.user-account-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr);
  gap: 10px;
}
.user-account-fact {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--aq-border);
  border-left: 4px solid var(--aq-offline);
  border-radius: 13px;
  background: #fff;
}
.user-account-fact > span {
  display: block;
  color: var(--aq-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.user-account-fact > strong {
  margin-top: 4px;
  display: block;
  color: var(--aq-navy);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.user-account-fact > small {
  margin-top: 4px;
  display: block;
  color: var(--aq-muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.user-access-status.success { border-left-color: var(--aq-success); }
.user-access-status.warning { border-left-color: var(--aq-warning); }
.user-access-status.danger { border-left-color: var(--aq-danger); }
.user-access-time { font-variant-numeric: tabular-nums; }
.user-actions {
  margin-top: 14px;
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid var(--aq-border);
}
.user-action-panel { flex: 1 1 250px; min-width: 0; }
.user-action-panel summary {
  width: max-content;
  max-width: 100%;
  min-height: var(--touch);
  padding: 11px 15px;
  border: 2px solid var(--aq-border);
  border-radius: 13px;
  background: #fff;
  color: var(--aq-navy);
  font-weight: 850;
  cursor: pointer;
  list-style: none;
  overflow-wrap: anywhere;
}
.user-action-panel summary::-webkit-details-marker { display: none; }
.user-action-panel summary:focus-visible { outline: 4px solid #69bad8; outline-offset: 3px; }
.user-action-panel[open] summary { margin-bottom: 13px; }
.user-status-access { flex: 1 1 100%; }
.user-device-access-panel {
  max-width: 920px;
  padding: 17px 18px;
  border: 1px solid var(--aq-border);
  border-radius: 14px;
  background: #fff;
}
.user-device-access-panel > p {
  margin: 0 0 13px;
  color: var(--aq-muted);
  line-height: 1.45;
}
.user-device-access-panel form { margin: 0; }
.user-device-access-list {
  max-height: 310px;
  margin-bottom: 14px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.user-device-access-option {
  min-width: 0;
  padding: 10px 11px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--aq-border);
  border-radius: 11px;
  background: var(--aq-soft);
  color: var(--aq-navy);
  cursor: pointer;
}
.user-device-access-option:hover { border-color: var(--aq-blue); background: #fff; }
.user-device-access-option input {
  width: 19px;
  height: 19px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--aq-petrol);
}
.user-device-access-option > span { min-width: 0; }
.user-device-access-option strong,
.user-device-access-option small {
  display: block;
  overflow-wrap: anywhere;
}
.user-device-access-option strong { font-size: 13px; line-height: 1.3; }
.user-device-access-option small {
  margin-top: 2px;
  color: var(--aq-muted);
  font-size: 11px;
  line-height: 1.35;
}
.user-form.compact {
  max-width: 520px;
  padding: 18px;
  border: 1px solid var(--aq-border);
  border-radius: 14px;
  background: #fff;
}
.user-form.compact .field-help { margin: 5px 0 0; }
.user-action-confirmation {
  max-width: 620px;
  padding: 17px 18px;
  border: 1px solid #e5c188;
  border-radius: 14px;
  background: var(--aq-warning-soft);
}
.user-action-confirmation > p { margin: 0; color: #684216; line-height: 1.5; }
.user-action-confirmation > .notice { margin-top: 12px; }
.user-action-confirmation form { margin-top: 14px; }
.user-confirmation-check {
  margin-bottom: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #ddb36f;
  border-radius: 11px;
  background: #fff;
  color: var(--aq-navy);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.user-confirmation-check input { width: 19px; height: 19px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--aq-petrol); }
.user-action-disabled {
  flex: 1 1 250px;
  min-width: 0;
  display: grid;
  gap: 5px;
  justify-items: start;
}
.user-action-disabled small { color: var(--aq-muted); font-size: 12px; }

@media (max-width: 800px) {
  .user-summary { grid-template-columns: auto minmax(0, 1fr); }
  .user-summary .status-badge { grid-column: 2; justify-self: start; }
  .user-account-grid { grid-template-columns: 1fr; }
  .user-actions { flex-direction: column; }
  .user-actions > form,
  .user-actions > form button,
  .user-action-panel,
  .user-action-panel summary,
  .user-device-access-panel,
  .user-action-disabled,
  .user-action-disabled button,
  .user-action-confirmation form,
  .user-action-confirmation button,
  .user-form > button { width: 100%; }
  .user-device-access-list { grid-template-columns: 1fr; }
}


@media (max-width: 800px) {
  .sms-journey { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .sms-step { padding: 13px 14px; }
}

/* SMS conversations */
.sms-page-title { align-items: center; }
.sms-page-title > div { min-width: 0; }
.sms-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.sms-operations-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.sms-messenger {
  min-width: 0;
  height: min(780px, calc(100vh - 235px));
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(245px, .38fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-radius-lg);
  background: #fff;
  box-shadow: var(--aq-shadow);
}
.sms-conversations-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--aq-border);
  background: #f8fafb;
}
.sms-conversations-heading { padding: 20px 19px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sms-conversations-heading h2 { margin: 0; color: var(--aq-navy); font-size: 20px; letter-spacing: -.02em; }
.sms-conversations-heading .section-count { min-height: 26px; padding: 3px 9px; }
.sms-conversation-search { margin: 0; padding: 0 13px 16px; display: flex; gap: 6px; }
.sms-conversation-search input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--aq-border);
  border-radius: 11px;
  background: #fff;
  color: var(--aq-text);
  font: inherit;
  font-size: 13px;
}
.sms-conversation-search input::placeholder { color: #607583; opacity: 1; }
.sms-conversation-search input:focus-visible { outline: 3px solid #69bad8; outline-offset: 1px; }
.sms-conversation-search button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--aq-border);
  border-radius: 10px;
  background: #fff;
  color: var(--aq-blue);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.sms-search-summary { margin: -5px 18px 11px; color: #526b7a; font-size: 12px; overflow-wrap: anywhere; }
.sms-search-summary a { margin-left: 6px; color: var(--aq-blue); }
.sms-conversation-list {
  min-height: 0;
  margin: 0;
  padding: 0 8px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  list-style: none;
}
.sms-conversation-list > li + li { margin-top: 3px; }
.sms-conversation-link {
  min-width: 0;
  padding: 13px 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  text-decoration: none;
}
.sms-conversation-link:hover { border-color: var(--aq-border); background: #eef3f6; }
.sms-conversation-link.is-selected { border-color: #bbd4e5; background: #e5f0f8; }
.sms-conversation-link:focus-visible { outline-offset: -3px; }
.sms-conversation-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e1ebf0;
  color: var(--aq-petrol);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .02em;
}
.sms-conversation-link.is-selected .sms-conversation-avatar { background: var(--aq-petrol); color: #fff; }
.sms-conversation-copy { min-width: 0; flex: 1; }
.sms-conversation-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; }
.sms-conversation-topline strong {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: var(--aq-navy);
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: normal;
}
.sms-conversation-topline time { max-width: 85px; flex: 0 0 auto; color: #5e7380; font-size: 10px; text-align: right; line-height: 1.4; }
.sms-conversation-identity { margin-top: 4px; display: block; overflow: hidden; color: #526b7a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sms-conversation-preview {
  margin-top: 5px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: #536c7b;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.sms-list-empty { align-content: start; padding-top: 35px; }
.sms-list-empty h3 { font-size: 16px; }
.sms-list-empty p { font-size: 13px; }
.sms-thread { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.sms-thread-header {
  min-width: 0;
  padding: 20px 25px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  border-bottom: 1px solid #e3eaef;
  background: #fff;
}
.sms-thread-identity { min-width: 0; display: flex; align-items: center; gap: 12px; flex: 1; }
.sms-thread-identity > div { min-width: 0; }
.sms-thread-avatar { width: 42px; height: 42px; background: var(--aq-petrol); color: #fff; }
.sms-thread-header h2 { margin: 0; color: var(--aq-navy); font-size: 19px; line-height: 1.3; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sms-thread-header p { margin: 4px 0 0; color: #526b7a; font-size: 12px; overflow-wrap: anywhere; }
.sms-thread-device { max-width: 100%; padding: 5px 9px; border-radius: 7px; background: var(--aq-soft); color: #526b7a; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.sms-thread-back { display: none; }
.sms-thread-history {
  min-height: 0;
  padding: 22px 25px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 15px;
  scrollbar-width: thin;
}
.sms-thread-history:focus-visible { outline: 3px solid #69bad8; outline-offset: -3px; }
.sms-thread-pagination { margin: -9px 0 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.sms-thread-pagination .text-link { gap: 6px; font-size: 12px; }
.sms-message-list { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 23px; list-style: none; }
.sms-message { min-width: 0; display: flex; }
.sms-message-outgoing { justify-content: flex-end; }
.sms-message-content { min-width: 0; max-width: min(88%, 560px); }
.sms-message-direction { margin: 0 5px 5px; display: block; color: #526b7a; font-size: 10px; font-weight: 750; }
.sms-message-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 5px;
  background: #edf1f4;
  color: var(--aq-text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sms-message-outgoing .sms-message-bubble { margin-left: auto; border-radius: 18px 18px 5px 18px; background: #1267cc; color: #fff; }
.sms-message-meta { margin: 6px 5px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; color: #526b7a; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.sms-message-status { font-weight: 750; }
.sms-message-status.tone-success { color: #176b4d; }
.sms-message-status.tone-warning { color: #865212; }
.sms-message-status.tone-danger, .sms-message-status.tone-error { color: #ac3339; }
.sms-message-detail { margin: 5px 5px 0; color: #526b7a; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.sms-message-details { margin-top: 6px; color: var(--aq-muted); font-size: 12px; }
.sms-message-details summary { padding: 6px 0; cursor: pointer; }
.sms-message-details summary:focus-visible { outline: 3px solid var(--aq-blue); outline-offset: 3px; }
.sms-message-outgoing .sms-message-direction,
.sms-message-outgoing .sms-message-detail { text-align: right; }
.sms-message-outgoing .sms-message-meta { justify-content: flex-end; }
.sms-thread-footer { padding: 12px 22px; border-top: 1px solid #e3eaef; background: #fafcfd; color: #526b7a; font-size: 11px; text-align: center; }
.sms-empty-icon { width: 57px; height: 47px; display: grid; place-items: center; border-radius: 17px 17px 17px 5px; background: #e5edf2; color: #7892a2; font-size: 29px; line-height: 1; font-weight: 800; }
.sms-thread-placeholder { align-content: center; }
.sms-thread-placeholder p { max-width: 380px; font-size: 14px; line-height: 1.6; }
.sms-thread-placeholder h2 { margin-top: 18px; font-size: 23px; }
.sms-thread-empty { min-height: 240px; align-content: center; }

@media (max-width: 1050px) and (min-width: 701px) {
  .sms-messenger { grid-template-columns: minmax(235px, .45fr) minmax(0, 1fr); }
  .sms-conversation-link { padding-inline: 8px; gap: 8px; }
  .sms-conversation-link .sms-conversation-avatar { display: none; }
  .sms-thread-header { padding: 18px; }
  .sms-thread-history { padding: 20px 18px; }
  .sms-thread-device { margin-left: 54px; }
}

@media (max-width: 800px) {
  .sms-page-title .sms-page-actions { margin-top: 12px; }
}

@media (max-width: 700px) {
  .sms-page-title { align-items: flex-start; gap: 12px; }
  .sms-page-actions { width: 100%; gap: 8px; }
  .sms-page-actions .text-link { padding-left: 0; }
  .sms-operations-link { min-width: 0; min-height: 44px; padding: 8px 12px; font-size: 13px; }
  .sms-messenger { height: 70vh; height: 70dvh; min-height: 460px; max-height: 780px; grid-template-columns: minmax(0, 1fr); border-radius: 18px; }
  .sms-conversations-panel { border-right: 0; }
  .sms-messenger.has-thread .sms-conversations-panel,
  .sms-messenger.is-list-view .sms-thread-placeholder { display: none; }
  .sms-conversations-heading { padding: 19px 19px 14px; }
  .sms-conversation-search { padding-inline: 17px; }
  .sms-conversation-search input { font-size: 16px; }
  .sms-conversation-list { padding-inline: 8px; }
  .sms-conversation-link { padding: 14px 10px; }
  .sms-conversation-topline time { max-width: 95px; }
  .sms-conversation-avatar { width: 42px; height: 42px; }
  .sms-thread-header { padding: 5px 16px 15px; gap: 4px 12px; }
  .sms-thread-back { min-height: 40px; padding: 5px 0; display: inline-flex; flex-basis: 100%; gap: 6px; font-size: 13px; }
  .sms-thread-back > span { font-size: 26px; line-height: 1; }
  .sms-thread-identity { width: 100%; flex: 1 0 100%; }
  .sms-thread-header h2 { font-size: 17px; }
  .sms-thread-device { display: none; }
  .sms-thread-history { padding: 20px 14px; }
  .sms-message-content { max-width: 92%; }
  .sms-message-bubble { padding: 11px 14px; }
  .sms-thread-footer { padding: 10px 14px; }
}

@media (max-width: 380px) {
  .sms-conversation-link { gap: 8px; }
  .sms-conversation-link .sms-conversation-avatar { width: 34px; height: 34px; font-size: 10px; }
  .sms-conversation-topline { gap: 5px; }
  .sms-conversation-topline time { max-width: 75px; }
  .sms-thread-avatar { display: none; }
  .sms-thread-device { margin-left: 0; }
}
