:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --text: #17212b;
  --muted: #687789;
  --line: #d7dee6;
  --green: #138a43;
  --yellow: #d69a00;
  --red: #c82f2f;
  --blue: #2166d5;
  --ink: #0f1720;
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  min-height: 42px;
  padding: 0 16px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  height: 100vh;
}

.left-panel {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: minmax(0, 1fr) 240px;
  height: 100vh;
  min-height: 0;
}

.panel-section h2,
.call-side h3 {
  margin: 0;
}

.panel-section {
  min-height: 0;
  padding: 12px;
}

.addresses-section {
  overflow: auto;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-heading h2,
.section-heading h3 {
  font-size: 17px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.panel-heading-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.addresses {
  display: grid;
  gap: 7px;
}

.address-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 7px solid var(--green);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 44px;
  padding: 7px 8px;
}

.address-row.selected {
  outline: 2px solid rgba(33, 102, 213, 0.24);
}

.address-row.status-online {
  border-left-color: var(--green);
}

.address-row.status-offline_recent {
  border-left-color: var(--yellow);
}

.address-row.status-panel_fault,
.address-row.status-panel,
.address-row.status-camera,
.address-row.status-fault {
  border-left-color: #f97316;
}

.address-row.status-offline {
  border-left-color: var(--red);
}

.address-main {
  align-items: center;
  display: grid;
  grid-column: 1;
  min-width: 0;
}

.address-title-button {
  background: transparent;
  border-radius: 4px;
  color: var(--text);
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.18;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.address-title-button:hover {
  color: var(--blue);
}

.log-meta {
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-height: 28px;
  padding: 5px 7px;
  white-space: nowrap;
}

.status-test-button {
  border: 0;
  cursor: pointer;
}

.status-online .status-pill {
  background: var(--green);
}

.status-offline_recent .status-pill {
  background: var(--yellow);
}

.status-panel_fault .status-pill,
.status-panel .status-pill,
.status-camera .status-pill,
.status-fault .status-pill {
  background: #f97316;
}

.status-offline .status-pill {
  background: var(--red);
}

.address-side {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-column: 2;
  grid-template-columns: auto auto;
  justify-items: end;
}

.call-icon-button {
  background: #e8eef5;
  border: 1px solid #d6e0ea;
  border-radius: 999px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  height: 30px;
  line-height: 1;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

.call-icon-button:hover {
  background: #dce8f5;
  color: var(--blue);
}

.log-section {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.event-log {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.log-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 1px;
  padding-bottom: 3px;
}

.log-message {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-area {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  min-width: 0;
  overflow: hidden;
}

.call-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 330px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.video-stage,
.status-card,
.queue-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.video-stage {
  display: grid;
  grid-template-rows: minmax(360px, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.video-picture {
  background: #0f1720;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.video-picture.has-camera {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.camera-feed {
  background:
    linear-gradient(180deg, rgba(15, 23, 32, 0.03), rgba(15, 23, 32, 0.08)),
    url("/dispatcher-idle-wide.png") center / cover no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  height: 100%;
  min-height: 360px;
  overflow: hidden;
  position: relative;
}

.camera-feed-extra {
  display: none;
}

.video-picture.has-camera .camera-feed-extra {
  display: block;
}

.video-picture.single-video-source {
  grid-template-columns: 1fr;
}

.video-picture.single-video-source .camera-feed {
  display: none;
}

.video-picture.single-video-source:not(.show-camera-source) .panel-feed,
.video-picture.single-video-source.show-camera-source .camera-feed-extra {
  display: block;
}

.device-video {
  background: #0f1720;
  border: 0;
  display: none;
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
  z-index: 1;
}

.device-video.visible {
  display: block;
}

.device-video.visible ~ .road-line,
.device-video.visible ~ .barrier-arm {
  display: none;
}

.road-line {
  background: rgba(255, 255, 255, 0.22);
  bottom: 0;
  height: 46%;
  left: 43%;
  position: absolute;
  transform: perspective(320px) rotateX(50deg);
  width: 14%;
}

.barrier-arm {
  background: repeating-linear-gradient(90deg, #f8f9fb 0 34px, #d32929 34px 68px);
  border-radius: 999px;
  height: 16px;
  left: 18%;
  position: absolute;
  top: 48%;
  transform: rotate(-8deg);
  transform-origin: left center;
  width: 68%;
}

.camera-overlay {
  background: rgba(15, 23, 32, 0.76);
  border-radius: 6px;
  color: #fff;
  display: grid;
  gap: 5px;
  left: 18px;
  padding: 12px 14px;
  position: absolute;
  top: 18px;
  z-index: 2;
}

.camera-overlay span {
  color: #b7c3d2;
  font-size: 12px;
}

.camera-overlay strong {
  font-size: 18px;
  line-height: 1.18;
}

.call-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 14px;
}

.audio-status {
  background: #edf1f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  grid-column: 1 / -1;
  padding: 8px 10px;
}

.audio-status.ok {
  background: #e2f3e8;
  border-color: #b9dfc4;
  color: #19643a;
}

.audio-status.error {
  background: #f8e1df;
  border-color: #edb9b4;
  color: var(--red);
}

.audio-status.pending {
  background: #fff1cf;
  border-color: #efd58f;
  color: #7a5414;
}

.webrtc-diagnostics {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  grid-column: 1 / -1;
  padding: 8px 10px;
}

.webrtc-diagnostics summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.webrtc-diagnostics pre {
  font-family: inherit;
  line-height: 1.35;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.primary-button {
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.danger-button {
  background: #f3dddd;
  color: var(--red);
  font-weight: 800;
}

.open-button {
  background: var(--green);
  color: white;
  font-size: 18px;
  font-weight: 900;
}

.ghost-button {
  background: #edf1f5;
  color: var(--ink);
  font-weight: 700;
}

.call-side {
  display: grid;
  gap: 18px;
  grid-template-rows: minmax(0, 1fr) 150px;
  min-height: 0;
}

.status-card,
.queue-card {
  min-height: 0;
  padding: 16px;
}

.address-information {
  display: grid;
  gap: 22px;
  margin-top: 18px;
}

.address-information-section {
  display: grid;
  gap: 8px;
}

.address-information-heading {
  align-items: center;
  display: flex;
  font-size: 14px;
  gap: 5px;
  line-height: 1.35;
}

.address-information-lines {
  display: grid;
  gap: 6px;
  padding-left: 25px;
}

.address-information-lines span,
.address-information-value {
  font-size: 14px;
  line-height: 1.4;
}

.address-information-value {
  padding-left: 25px;
}

.address-information-name {
  font-size: 16px;
  font-weight: 800;
}

dl {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

dl div {
  display: grid;
  gap: 4px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.call-queue {
  display: grid;
  gap: 9px;
  max-height: 92px;
  overflow-y: auto;
  padding-right: 3px;
}

.queue-row {
  align-items: center;
  background: #fff5db;
  border: 1px solid #ecd08c;
  border-radius: 7px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 10px;
}

.queue-row-copy {
  display: grid;
  gap: 4px;
}

.queue-take-button {
  background: var(--blue);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  min-height: 34px;
  padding: 6px 12px;
}

.queue-take-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 4px 0;
}

@media (max-width: 1050px) {
  .call-layout {
    grid-template-columns: 1fr;
  }

  .call-controls {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .left-panel {
    height: auto;
    min-height: auto;
  }

  .address-side {
    grid-template-columns: repeat(2, 1fr);
  }

  .address-row {
    grid-template-columns: 1fr;
  }

  .address-side {
    grid-column: auto;
    grid-row: auto;
    width: auto;
  }
}

.admin-body {
  background: var(--bg);
  overflow: auto;
}

.admin-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
  padding: 18px;
}

.admin-list,
.admin-editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 0;
  padding: 16px;
}

.admin-editor {
  display: grid;
  align-content: start;
  grid-template-rows: auto auto auto auto;
  overflow: auto;
}

.admin-list {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.admin-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.admin-heading.compact {
  margin-bottom: 10px;
}

.admin-heading h1,
.admin-heading h2 {
  font-size: 24px;
  margin: 0;
}

.admin-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.admin-link {
  background: #edf1f5;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  padding: 10px 12px;
  text-decoration: none;
}

.admin-new-button {
  margin-bottom: 12px;
  width: 100%;
}

.admin-addresses {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
}

.admin-address-row {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  min-height: 56px;
  padding: 9px 11px;
  text-align: left;
}

.admin-address-row.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(33, 102, 213, 0.18);
}

.admin-address-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-address-row span {
  color: var(--muted);
  font-size: 12px;
}

.save-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.editor-mode-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-mode {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.address-form-readonly {
  opacity: 0.84;
}

.address-form-readonly input:disabled,
.address-form-readonly select:disabled,
.address-form-readonly textarea:disabled {
  background: #f4f6f8;
  color: #607084;
  cursor: not-allowed;
}

/* Свойство hidden должно всегда скрывать соседние вкладки. */
[hidden] {
  display: none !important;
}

/* Админка: рабочая компоновка в стиле панели диспетчера. */
.admin-body {
  background: #eef3f9;
}

.admin-shell {
  gap: 0;
  grid-template-columns: 232px minmax(0, 1fr);
  padding: 0;
}

.admin-list {
  background: #101b2e;
  border: 0;
  border-radius: 0;
  color: #f8fbff;
  padding: 16px;
}

.admin-list .admin-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}

.admin-list .admin-heading h1 {
  font-size: 24px;
}

.admin-list .admin-kicker,
.admin-list .admin-address-row span {
  color: #8da0bc;
}

.admin-list .admin-link {
  color: #b9cbec;
  font-size: 12px;
  font-weight: 800;
  margin-top: 5px;
}

.admin-new-button {
  margin-bottom: 14px;
  min-height: 42px;
}

.admin-addresses {
  align-content: start;
  gap: 9px;
  grid-auto-rows: min-content;
}

.admin-address-row {
  background: #16263e;
  border-color: #2a3c58;
  border-radius: 9px;
  color: #f8fbff;
  min-height: 60px;
}

.admin-address-row.selected {
  border-color: #4a7fff;
  box-shadow: 0 0 0 1px rgba(104, 147, 255, 0.72);
}

.admin-address-row.status-online {
  border-color: #20a568;
}

.admin-address-row.status-offline,
.admin-address-row.status-offline_recent {
  border-color: #df5149;
}

.admin-address-row.status-panel_fault,
.admin-address-row.status-panel,
.admin-address-row.status-camera,
.admin-address-row.status-fault {
  border-color: #e1a437;
}

.admin-address-row.status-not_configured {
  border-color: #60728d;
}

.admin-address-row.selected.status-online {
  box-shadow: 0 0 0 1px rgba(32, 165, 104, 0.72);
}

.admin-address-row.selected.status-offline,
.admin-address-row.selected.status-offline_recent {
  box-shadow: 0 0 0 1px rgba(223, 81, 73, 0.72);
}

.admin-address-row.selected.status-panel_fault,
.admin-address-row.selected.status-panel,
.admin-address-row.selected.status-camera,
.admin-address-row.selected.status-fault {
  box-shadow: 0 0 0 1px rgba(225, 164, 55, 0.72);
}

.admin-editor {
  background: #eef3f9;
  border: 0;
  border-radius: 0;
  gap: 0;
  padding: 18px 28px 32px;
}

.admin-page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 0 12px;
}

.admin-page-header h1 {
  color: #172944;
  font-size: 23px;
  margin: 0;
}

.admin-page-status {
  color: #8291a7;
  font-size: 12px;
  font-weight: 700;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.admin-tab {
  background: #dfe7f1;
  border: 0;
  border-radius: 8px;
  color: #4a5c73;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  padding: 0 13px;
}

.admin-tab.selected {
  background: #2769e8;
  color: #fff;
}

.admin-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-login {
  align-items: center;
  background: #edf3fa;
  display: flex;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.admin-login[hidden] { display: none; }

.admin-login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 50px rgba(26, 52, 88, 0.14);
  display: grid;
  gap: 14px;
  max-width: 380px;
  padding: 30px;
  width: 100%;
}

.admin-login-card img {
  height: 52px;
  object-fit: contain;
  object-position: left center;
  width: 52px;
}

.admin-login-card h1 { color: #172944; margin: -8px 0 4px; }
.admin-login-card label { display: grid; gap: 6px; }
.admin-login-card label span { color: #607187; font-size: 12px; font-weight: 800; }
.admin-login-card input { min-height: 42px; }

.admin-dashboard {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(19, 42, 72, 0.05);
  display: block;
  padding: 16px;
}

.dashboard-heading {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dashboard-description {
  color: #72839a;
  font-size: 13px;
  font-style: italic;
  line-height: 1.45;
  margin: 5px 0 0;
  max-width: 760px;
}

.dashboard-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dashboard-dispatcher {
  border: 1px solid #dce5f0;
  border-left: 6px solid #60728d;
  border-radius: 10px;
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  padding: 13px 16px;
}

.dashboard-dispatcher strong {
  color: #172944;
}

.dashboard-dispatcher span {
  color: #72839a;
  font-size: 13px;
}

.dashboard-dispatcher.status-online {
  background: #edf9f2;
  border-left-color: #20a568;
}

.dashboard-dispatcher.status-offline {
  background: #fff0f0;
  border-left-color: #df5149;
}

.dashboard-dispatcher.status-checking {
  background: #f5f7fa;
  border-left-color: #60728d;
}

.dashboard-address-card {
  border: 1px solid #dce5f0;
  border-left: 6px solid #60728d;
  border-radius: 10px;
  display: grid;
  gap: 9px;
  min-height: 96px;
  padding: 15px 16px;
}

.dashboard-address-card strong,
.dashboard-address-status {
  color: #172944;
}

.dashboard-address-status {
  font-weight: 800;
}

.dashboard-address-time,
.dashboard-state {
  color: #72839a;
  font-size: 12px;
  margin: 0;
}

.dashboard-state {
  margin-top: 13px;
}

.dashboard-address-card.status-online {
  background: #edf9f2;
  border-left-color: #20a568;
}

.dashboard-address-card.status-offline,
.dashboard-address-card.status-offline_recent {
  background: #fff0f0;
  border-left-color: #df5149;
}

.dashboard-address-card.status-panel_fault,
.dashboard-address-card.status-panel,
.dashboard-address-card.status-camera,
.dashboard-address-card.status-fault {
  background: #fff8e9;
  border-left-color: #e1a437;
}

.dashboard-metric,
.settings-card,
.setup-card {
  background: #fff;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(19, 42, 72, 0.05);
}

.dashboard-metric {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 18px;
}

.dashboard-metric span {
  color: #708199;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-metric strong {
  color: #172944;
  font-size: 20px;
}

.settings-card,
.setup-card {
  border-bottom: 0;
  margin: 0;
  padding: 16px;
}

.setup-card {
  margin-bottom: 14px;
}

.settings-card .admin-heading h2,
.setup-card .admin-heading h2,
.admin-heading[data-admin-panel="addresses"] h2 {
  color: #172944;
  font-size: 17px;
}

.setup-packages {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.setup-package {
  background: #f9fbff;
  border-color: #d9e3f0;
  border-radius: 10px;
  min-height: 72px;
}

.setup-package.selected {
  background: #f2f6ff;
  border-color: #4a7fff;
  box-shadow: 0 0 0 1px rgba(74, 127, 255, 0.16);
}

.admin-heading[data-admin-panel="addresses"] {
  background: #fff;
  border-radius: 14px 14px 0 0;
  margin: 0;
  padding: 16px 16px 12px;
}

.address-form {
  background: #fff;
  border-radius: 0 0 14px 14px;
  max-width: none;
  padding: 0 16px 16px;
}

.address-form fieldset {
  background: #f8fafc;
  border-color: #e0e7f0;
  border-radius: 10px;
}

.address-form legend {
  color: #263c5b;
}

.editor-mode-actions {
  gap: 9px;
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-list {
    min-height: auto;
  }

  .admin-addresses {
    max-height: 240px;
  }

  .admin-editor {
    padding: 16px;
  }

  .admin-dashboard {
    padding: 14px;
  }

  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Настройки адресов: структура и ритм карточек DISPhand. */
.address-overview-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  margin: 0 0 16px;
  padding: 18px;
}

.address-card-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.address-card-header h2 {
  color: #182235;
  font-size: 18px;
  margin: 5px 0 0;
}

.address-card-description,
.address-section-note {
  color: #687789;
  font-size: 13px;
  font-style: italic;
  line-height: 1.35;
  margin: 7px 0 0;
}

.address-overview-card .setup-packages {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.address-overview-card .setup-package {
  background: #fff;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  min-height: 0;
  padding: 11px 10px;
}

.address-overview-card .setup-package:hover {
  background: #f8fbff;
  border-color: #93b5ff;
}

.address-overview-card .setup-package.selected {
  background: #fff;
  border-color: #4a7fff;
  box-shadow: 0 0 0 1px rgba(74, 127, 255, 0.16);
}

.address-overview-card .setup-package strong {
  color: #26364c;
  font-size: 13px;
}

.address-overview-card .setup-package span {
  color: #718097;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
}

.address-overview-card .setup-package em {
  color: #7c899b;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  margin-top: 1px;
}

.kit-help {
  background: #f6f8fa;
  border-radius: 10px;
  color: #435269;
  font-size: 13px;
  margin-top: 10px;
  min-height: 0;
  padding: 12px 14px;
}

.kit-help:empty {
  display: none;
}

.kit-help-title {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.kit-help-title span {
  color: #718097;
  font-size: 12px;
  text-align: right;
}

.kit-help ul {
  display: grid;
  gap: 3px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.address-form {
  background: transparent;
  border-radius: 0;
  gap: 16px;
  max-width: none;
  padding: 0;
}

.address-form fieldset {
  background: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  column-gap: 14px;
  margin: 0;
  padding: 18px;
  row-gap: 14px;
}

.address-form legend {
  color: #182235;
  float: left;
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  padding: 0;
  width: 100%;
}

.address-section-note {
  grid-column: 1 / -1;
  margin: -4px 0 3px;
}

/* Мониторинг в админке: подробности только в карточке адреса, не на дашборде. */
.monitor-diagnostics-card,
.daily-report-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  margin: 0 0 16px;
  padding: 18px;
}

.monitor-diagnostics-description,
.daily-report-description {
  color: #687789;
  font-size: 13px;
  font-style: italic;
  line-height: 1.35;
  margin: 7px 0 0;
}

.daily-report-actions {
  align-items: end;
  display: flex;
  gap: 10px;
}

.daily-report-actions label {
  display: grid;
  gap: 5px;
}

.daily-report-actions label span {
  color: #687789;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.daily-report-actions input[type="date"] {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #243650;
  font: inherit;
  min-height: 40px;
  padding: 0 10px;
}

.monitor-empty,
.daily-report-state {
  color: #687789;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.daily-report-state {
  margin-bottom: 12px;
}

.monitor-error {
  color: #b53b35;
}

.monitor-summary {
  background: #f7f9fc;
  border-left: 5px solid #718097;
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 13px 14px;
}

.monitor-summary.status-online { border-left-color: #20a568; }
.monitor-summary.status-panel,
.monitor-summary.status-camera,
.monitor-summary.status-fault { border-left-color: #e1a437; }
.monitor-summary.status-offline { border-left-color: #df5149; }

.monitor-summary div,
.monitor-device {
  display: grid;
  gap: 4px;
}

.monitor-summary span,
.monitor-device small {
  color: #718097;
  font-size: 12px;
}

.monitor-summary strong,
.monitor-device strong {
  color: #1d2d44;
  font-size: 14px;
}

.monitor-summary small {
  color: #718097;
  font-size: 12px;
}

.monitor-devices {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.monitor-device {
  background: #f7f9fc;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  min-height: 82px;
  padding: 11px 12px;
}

.monitor-device.online { border-color: #bde6cb; }
.monitor-device.offline { border-color: #f0c8c5; }
.monitor-device.disabled { opacity: 0.72; }
.monitor-device span { color: #263c5b; font-size: 13px; font-weight: 800; }

.daily-report-table-wrap { overflow-x: auto; }

.daily-report-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 980px;
  width: 100%;
}

.daily-report-table th,
.daily-report-table td {
  border-bottom: 1px solid #e3eaf2;
  padding: 10px 9px;
  text-align: center;
}

.daily-report-table th {
  color: #607187;
  font-size: 12px;
  text-align: center;
}

.daily-report-table th small {
  color: #7d8998;
  font-size: 10px;
  font-weight: 700;
}

.server-health {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.operator-installation {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid #dce4ed;
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) auto minmax(220px, auto);
  margin-top: 12px;
  padding: 12px;
}

.security-panel { max-width: 1050px; }

.security-description {
  color: #687789;
  font-size: 13px;
  line-height: 1.45;
  margin: 5px 0 0;
}

.security-warning {
  background: #fff2d8;
  border: 1px solid #ebc56f;
  border-radius: 9px;
  color: #80560b;
  font-size: 13px;
  font-weight: 800;
  margin: 12px 0;
  padding: 12px 14px;
}

.security-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-top: 14px;
}

.security-card {
  align-content: start;
  background: #f7f9fc;
  border: 1px solid #dce4ed;
  border-radius: 10px;
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 16px;
}

.security-card > div:first-child { display: grid; gap: 4px; }
.security-card > div:first-child span,
.security-card > label span { color: #687789; font-size: 12px; }
.security-card > label { display: grid; gap: 5px; }
.security-card input { min-height: 38px; }
.security-message { color: #b23b34; font-size: 12px; margin: 0; min-height: 18px; }
.telegram-confirmation { min-height: 0; }
.telegram-auth-frame {
  background: transparent;
  border: 0;
  display: block;
  height: 40px;
  overflow: hidden;
  width: 238px;
}

.security-card.operator-installation {
  align-items: stretch;
  grid-template-columns: 1fr;
  margin-top: 0;
}

.operator-installation div,
.operator-installation output {
  display: grid;
  gap: 4px;
}

.operator-installation span {
  color: #687789;
  font-size: 12px;
}

.operator-installation output > strong {
  color: #1268d5;
  font-size: 20px;
  letter-spacing: 0.08em;
}

@media (max-width: 980px) {
  .operator-installation { grid-template-columns: 1fr; }
}

.health-chip {
  background: #eef2f6;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
  color: #43546b;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
}

.health-chip.ok { background: #eaf7ef; border-color: #b9e1c8; color: #137447; }
.health-chip.attention { background: #fff8dc; border-color: #ead98d; color: #8a6812; }
.health-chip.warning { background: #fff0db; border-color: #efca8d; color: #995d0a; }
.health-chip.danger { background: #feeceb; border-color: #efb8b4; color: #b23b34; }
.health-chip.checking { color: #687789; }

.daily-report-table th:first-child,
.daily-report-table td:first-child {
  color: #1d2d44;
  font-weight: 700;
  text-align: left;
}

.fault-journal-download {
  align-items: center;
  border-top: 1px solid #e3eaf2;
  color: #687789;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 9px;
  margin-top: 14px;
  padding-top: 12px;
}

.fault-journal-download .admin-link {
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .daily-report-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }
}

@media (max-width: 860px) {
  .monitor-summary,
  .monitor-devices { grid-template-columns: 1fr; }
}

.address-form label span {
  color: #506078;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.address-form input,
.address-form select,
.address-form textarea {
  border-color: #cbd5e1;
  border-radius: 8px;
  min-height: 40px;
}

.address-form .checkbox-label {
  align-self: end;
  color: #506078;
}

.address-form .checkbox-label span {
  color: #506078;
  font-size: 13px;
  text-transform: none;
}

.address-form fieldset:last-of-type {
  padding-bottom: 16px;
}

.address-form .admin-actions {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 0;
}

.address-form .network-result {
  grid-column: 1 / -1;
}

/* Карточка адреса: порядок работы техника и происхождение данных. */
.address-form .address-step {
  position: relative;
}

.address-form .address-step-start {
  border-top: 3px solid #2f6fed;
}

.address-form .address-step-kit {
  border-top: 3px solid #7a5af8;
}

.address-form .address-step-finish {
  border-top: 3px solid #20a568;
}

.address-form label span .field-source {
  display: inline-block;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
  margin-left: 5px;
  text-transform: none;
}

.field-source.manual { color: #66758a; }
.field-source.kit { color: #6d4ee8; }
.field-source.system { color: #16835a; }

.address-form label > .field-description {
  color: #7a8799;
  font-size: 11px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  margin-top: -3px;
}

.address-form .checkbox-label {
  align-items: flex-start;
  flex-wrap: wrap;
}

.address-form .checkbox-label > .field-description {
  flex-basis: calc(100% - 28px);
  margin: -7px 0 0 28px;
}

.wired-internet-workflow {
  background: #f8fafc;
  border: 1px solid #d9e2ec;
  border-left: 4px solid #94a3b8;
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 14px;
}

.wired-internet-heading {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.wired-internet-heading strong {
  color: #25324a;
  display: block;
  font-size: 14px;
}

.wired-internet-heading p,
.wired-internet-instruction {
  color: #687789;
  font-size: 12px;
  line-height: 1.4;
  margin: 4px 0 0;
}

.wired-internet-badge {
  background: #e8edf3;
  border-radius: 999px;
  color: #526277;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
}

.wired-internet-workflow .ghost-button {
  justify-self: start;
}

.wired-internet-workflow.wired-status-progress {
  background: #fff9e9;
  border-left-color: #e1a437;
}

.wired-internet-workflow.wired-status-progress .wired-internet-badge {
  background: #fff0bf;
  color: #8a6510;
}

.wired-internet-workflow.wired-status-verified {
  background: #edf9f3;
  border-left-color: #20a568;
}

.wired-internet-workflow.wired-status-verified .wired-internet-badge {
  background: #d7f2e4;
  color: #167449;
}

.wired-internet-workflow.wired-status-error {
  background: #fff1f0;
  border-left-color: #df5149;
}

.wired-internet-workflow.wired-status-error .wired-internet-badge {
  background: #ffdeda;
  color: #a7332d;
}

.address-form .kit-owned input,
.address-form .kit-owned select {
  background: #fbfaff;
  border-color: #ddd5ff;
}

.address-form .system-field input {
  background: #f4fbf7;
  border-color: #c8ead9;
}

@media (max-width: 640px) {
  .address-form label span .field-source {
    display: block;
    margin: 2px 0 0;
  }

  .address-form .checkbox-label > .field-description {
    flex-basis: 100%;
    margin-left: 0;
  }
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

@media (max-width: 1180px) {
  .address-overview-card .setup-packages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .address-card-header,
  .kit-help-title {
    align-items: stretch;
    flex-direction: column;
  }

  .kit-help-title span {
    text-align: left;
  }

  .address-overview-card .setup-packages {
    grid-template-columns: 1fr;
  }
}

.settings-card,
.setup-card {
  border-bottom: 1px solid var(--line);
  margin: -2px 0 14px;
  padding-bottom: 14px;
}

.setup-card {
  margin-top: 0;
}

.setup-packages {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-package {
  align-items: start;
  display: grid;
  gap: 4px;
  justify-items: start;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
}

.setup-package.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(39, 97, 202, 0.12);
}

.setup-package strong {
  font-size: 15px;
}

.setup-package span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.setup-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.setup-actions button {
  flex: 1;
}

.settings-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
}

.settings-form .wide,
.settings-form button {
  grid-column: 1 / -1;
}

.address-form {
  display: grid;
  gap: 12px;
  max-width: 920px;
  padding-right: 6px;
}

.address-form fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 14px;
}

.address-form legend {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  padding: 0 5px;
}

.address-form label,
.settings-form label {
  display: grid;
  gap: 6px;
}

.address-form label span,
.settings-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.address-form input,
.address-form select,
.address-form textarea,
.settings-form input,
.settings-form select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 0 12px;
}

.address-form textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

.checkbox-label {
  align-items: center;
  display: flex !important;
  gap: 10px !important;
  min-height: 42px;
}

.checkbox-label input {
  height: 18px;
  min-height: 18px;
  width: 18px;
}

.wide-field {
  grid-column: 1 / -1;
}

.admin-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

.network-result {
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
}

.network-result > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 7px;
  padding: 10px;
}

.network-result .network-ok {
  background: #eef9f1;
  border-color: #bde6cb;
}

.network-result .network-fail {
  background: #fff1f1;
  border-color: #efc3c3;
}

.network-result div div {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

@media (max-width: 860px) {
  .admin-body {
    overflow: auto;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .admin-editor {
    overflow: visible;
  }

  .settings-form,
  .address-form fieldset {
    grid-template-columns: 1fr;
  }
}

/* Финальные переопределения: карточки адреса должны оставаться отдельными. */
.address-form {
  background: transparent;
  border-radius: 0;
  gap: 16px;
  max-width: none;
  padding: 0;
}

.address-form fieldset {
  background: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  column-gap: 14px;
  padding: 18px;
  row-gap: 14px;
}

.address-form legend {
  color: #182235;
  float: left;
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  padding: 0;
  width: 100%;
}

.address-form label span {
  color: #506078;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.address-form input,
.address-form select,
.address-form textarea {
  border-color: #cbd5e1;
  border-radius: 8px;
  min-height: 40px;
}

.address-form .checkbox-label {
  align-self: end;
}

.address-form .checkbox-label span {
  color: #506078;
  font-size: 13px;
  text-transform: none;
}

.address-form .admin-actions,
.address-form .network-result,
.address-section-note {
  grid-column: 1 / -1;
}

.address-section-note {
  color: #687789;
  font-size: 13px;
  font-style: italic;
  line-height: 1.35;
  margin: -4px 0 3px;
}
