:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --idle: #64748b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 248px 1fr;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #101827;
  color: white;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 24px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 4px;
  color: #aab3c2;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}

nav a.active,
nav a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-dot {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bad);
  color: white;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  padding: 24px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  overflow: hidden;
}

.topbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
}

.topbar-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.topbar-actions .status-pill {
  margin-right: 4px;
}

.auth-page.page-section.active {
  display: grid;
  place-items: center;
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.guest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.ghost-link:hover {
  background: #f8fafc;
}

.account-menu {
  position: relative;
}

.account-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 700;
  display: grid;
  gap: 8px;
  min-width: 230px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.account-popover strong,
.account-popover span {
  display: block;
}

.account-popover span {
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fee2e2;
  color: var(--bad);
  font-weight: 700;
}

.login-hints {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.text-link {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

p,
.panel-title span {
  color: var(--muted);
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  background: #e0ecff;
  color: var(--primary-dark);
  white-space: nowrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 18px;
}

.page-section {
  display: none;
  min-height: 0;
}

.page-section.active {
  overflow: auto;
}

.panel.page-section.active {
  display: block;
}

.dashboard-page.page-section.active,
.layout.page-section.active {
  display: grid;
}

.dashboard-page.page-section.active {
  overflow: hidden;
}

.dashboard-page {
  gap: 18px;
  min-height: 0;
  overflow: hidden;
}

.dashboard-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  min-height: 0;
  height: 100%;
}

.map-stage,
.device-drawer {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.map-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.map-stage-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(420px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
}

.compact-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.compact-metrics .metric {
  padding: 10px;
}

.compact-metrics .metric strong {
  margin-top: 4px;
  font-size: 20px;
}

.device-drawer {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  overflow: hidden;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.ghost {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

button.ghost:hover {
  background: #f8fafc;
}

button.danger {
  background: var(--bad);
  color: white;
}

button.danger:hover {
  background: #b91c1c;
}

button.ghost.danger {
  border-color: rgba(220, 38, 38, 0.24);
  background: white;
  color: var(--bad);
}

button.ghost.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f9fafb;
}

.ok {
  background: #d1fae5;
  color: var(--ok);
}

.warn {
  background: #fef3c7;
  color: var(--warn);
}

.bad {
  background: #fee2e2;
  color: var(--bad);
}

.idle {
  background: #e2e8f0;
  color: var(--idle);
}

.map-board {
  position: relative;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    #eef4ff;
  background-size: 34px 34px;
}

.map-board.is-dragging {
  cursor: grabbing;
}

.map-board.is-tianditu,
.map-board.is-osm,
.map-board.is-leaflet {
  background: #eef4ff;
}

.map-board .leaflet-container,
.map-board.leaflet-container {
  width: 100%;
  height: 100%;
  background: #eef4ff;
  font: inherit;
}

.map-board .leaflet-control-zoom {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.map-board .leaflet-control-zoom a {
  color: var(--text);
}

.screen-marker {
  border: 0;
  background: transparent;
}

.screen-marker .pin {
  position: relative;
  transform: none;
}

.screen-marker .pin:hover,
.screen-marker .pin.selected {
  transform: scale(1.15);
}

.osm-tile-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.osm-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.local-map-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.1), transparent 22%),
    radial-gradient(circle at 72% 62%, rgba(5, 150, 105, 0.12), transparent 24%),
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    #edf5ff;
  background-size: auto, auto, 42px 42px, 42px 42px, auto;
}

.local-road,
.local-river {
  position: absolute;
  left: -8%;
  width: 118%;
  border-radius: 999px;
  transform-origin: center;
}

.local-road {
  height: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.road-a {
  top: 26%;
  transform: rotate(13deg);
}

.road-b {
  top: 58%;
  transform: rotate(-9deg);
}

.road-c {
  top: 42%;
  transform: rotate(82deg);
}

.local-river {
  top: 70%;
  height: 26px;
  background: rgba(96, 165, 250, 0.34);
  transform: rotate(7deg);
}

.local-place {
  position: absolute;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.place-a {
  left: 42%;
  top: 45%;
}

.place-b {
  left: 18%;
  top: 24%;
}

.place-c {
  right: 14%;
  bottom: 20%;
}

.map-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.map-pin-layer {
  position: absolute;
  inset: 0;
  z-index: 450;
  pointer-events: none;
}

.map-pin-layer .pin {
  pointer-events: auto;
}

.map-controls {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 520;
  display: grid;
  gap: 6px;
}

.map-controls button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.map-controls button:hover {
  background: #eff6ff;
  color: var(--primary-dark);
}

.map-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  font-size: 12px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.legend-dot.online {
  background: var(--ok);
}

.legend-dot.warning {
  background: var(--warn);
}

.legend-dot.offline {
  background: var(--bad);
}

.legend-dot.maintenance {
  background: var(--idle);
}

.map-info {
  min-width: 210px;
  color: var(--text);
  line-height: 1.5;
}

.map-info strong,
.map-info p {
  display: block;
  margin: 0 0 4px;
}

.map-attribution {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 500;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
}

.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.pin:hover,
.pin.selected {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.34);
  outline: 3px solid rgba(37, 99, 235, 0.25);
}

.pin.online {
  background: var(--ok);
}

.pin.warning {
  background: var(--warn);
}

.pin.offline {
  background: var(--bad);
}

.pin.maintenance {
  background: var(--idle);
}

.pin small {
  position: absolute;
  top: 30px;
  left: 50%;
  width: max-content;
  max-width: 150px;
  transform: translateX(-50%);
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

.order-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  background: white;
}

input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.span-2 {
  grid-column: 1 / -1;
}

.field-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.estimate-note {
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.device-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.device-option {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  cursor: pointer;
}

.device-option input {
  width: auto;
  margin-top: 3px;
}

.device-option strong,
.device-option small {
  display: block;
}

.device-option small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 500;
}

.device-search {
  width: 100%;
}

.device-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.device-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.device-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.device-tabs button.active,
.device-tabs button:hover {
  background: white;
  color: var(--primary-dark);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.device-tab-panel {
  min-height: 0;
  overflow: hidden;
  display: none;
}

.device-tab-panel.active {
  display: grid;
}

#deviceListPanel {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

#deviceDetailPanel {
  overflow: auto;
  padding-right: 2px;
}

.filter-chip {
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.filter-chip.active,
.filter-chip:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #dbeafe;
  color: var(--primary-dark);
}

.device-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.device-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  text-align: left;
}

.device-list-item.active,
.device-list-item:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eff6ff;
}

.device-list-main {
  min-width: 0;
}

.device-list-main strong,
.device-list-main small {
  display: block;
}

.device-list-main small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.device-list-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.device-detail {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.device-detail dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.device-detail dl div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
}

.device-detail dt,
.device-detail dd {
  margin: 0;
}

.device-detail dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.device-detail dd {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.device-control {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.device-control h3 {
  margin: 0;
  font-size: 14px;
}

.power-actions,
.power-schedule {
  display: grid;
  gap: 8px;
}

.power-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.signal-switch {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7ed;
}

.signal-switch p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.signal-status {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.signal-status.active {
  border-color: #fca5a5;
  background: #fef2f2;
}

.signal-status strong {
  color: var(--text);
  font-size: 13px;
}

.signal-status span {
  color: var(--muted);
  font-size: 12px;
}

.signal-url-field,
.signal-actions {
  grid-column: 1 / -1;
}

.signal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.signal-preview {
  width: 100%;
  max-height: 180px;
  border-radius: 8px;
  background: #0f172a;
}

.emergency-source-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  align-items: start;
}

.emergency-source-form,
.emergency-source-list {
  min-width: 0;
}

.emergency-source-list {
  display: grid;
  gap: 12px;
}

.emergency-source-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.emergency-source-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.emergency-source-card strong {
  display: block;
}

.emergency-source-card small,
.emergency-source-card p {
  color: var(--muted);
}

.emergency-source-card p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.emergency-source-card video {
  width: 100%;
  max-height: 220px;
  border-radius: 8px;
  background: #0f172a;
}

.remote-monitor {
  display: grid;
  gap: 8px;
}

.monitor-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 132px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.72)),
    repeating-linear-gradient(90deg, #1e293b 0 12px, #0f172a 12px 24px);
  color: white;
  text-align: center;
}

.monitor-preview::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
}

.monitor-preview span,
.monitor-preview small {
  position: relative;
  display: block;
}

.monitor-preview span {
  font-weight: 800;
}

.monitor-preview small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.remote-monitor dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.remote-monitor dl div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #f8fafc;
}

.power-schedule {
  grid-template-columns: 1fr 1fr;
}

.power-schedule .check-label {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
}

.power-schedule .check-label input {
  width: auto;
}

.power-schedule button {
  grid-column: 1 / -1;
}

.device-playlist {
  display: grid;
  gap: 8px;
}

.device-playlist h3 {
  margin: 0;
  font-size: 14px;
}

.playlist-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.playlist-item strong,
.playlist-item small {
  display: block;
}

.playlist-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.playlist-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.playlist-preview {
  display: grid;
  gap: 8px;
}

.playlist-preview summary {
  width: fit-content;
  cursor: pointer;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.playlist-preview video {
  width: 100%;
  max-height: 180px;
  border-radius: 8px;
  background: #0f172a;
}

.preview-unavailable {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
}

.order-form button {
  grid-column: 1 / -1;
}

.account-panel-wide {
  grid-column: 1 / -1;
}

.management-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.management-toolbar input,
.management-toolbar select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
}

.management-toolbar select {
  max-width: 180px;
}

.management-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  gap: 14px;
  align-items: start;
}

.management-detail {
  min-width: 0;
}

.package-management-layout.customer-view {
  display: block;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-content: start;
}

.account-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.profile-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.profile-dl div {
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.profile-dl dt,
.profile-dl dd {
  margin: 0;
}

.profile-dl dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.customer-portal-grid section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.customer-portal-grid h3 {
  margin: 0 0 10px;
}

.customer-summary,
.billing-summary,
.queue-summary {
  margin-bottom: 14px;
}

.customer-order-list {
  margin-top: 0;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.material-upload-form {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.customer-material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.customer-material-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.customer-material-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
}

.customer-material-card > div {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.customer-material-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.customer-material-card strong,
.customer-material-card small {
  display: block;
}

.customer-material-card small,
.customer-material-card p {
  color: var(--muted);
}

.ai-video-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  align-items: start;
}

.ai-video-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.ai-video-result {
  min-width: 0;
}

.ai-plan-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.ai-plan-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ai-plan-card strong,
.ai-plan-card small {
  display: block;
}

.ai-plan-card small,
.ai-plan-card p,
.ai-check-list {
  color: var(--muted);
}

.ai-preview-frame {
  display: grid;
  place-items: center;
  min-height: 180px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.88), rgba(5, 150, 105, 0.82)),
    #2563eb;
  color: white;
  text-align: center;
}

.ai-preview-frame span,
.ai-preview-frame small {
  display: block;
}

.ai-preview-frame span {
  font-size: 26px;
  font-weight: 900;
}

.ai-preview-frame small {
  margin-top: 8px;
  max-width: 80%;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.5;
}

.storyboard-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.storyboard-list article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.storyboard-list span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ai-check-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

.revenue-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.revenue-summary {
  margin-bottom: 14px;
}

.revenue-cost-notes {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.revenue-cost-notes strong {
  color: var(--text);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.chart-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.chart-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-card header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-box {
  min-height: 230px;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: 230px;
}

.chart-box text {
  fill: var(--muted);
  font-size: 12px;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-dot {
  fill: white;
  stroke: var(--primary);
  stroke-width: 2;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 90px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.bar-row span {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.bar-row strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.pie-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.pie-chart {
  width: 150px;
  aspect-ratio: 1;
  border: 8px solid #f8fafc;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line);
}

.pie-legend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pie-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  font-size: 12px;
}

.pie-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.pie-legend span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revenue-table {
  margin-top: 14px;
}

.price-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.price-summary-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.price-summary-card span,
.price-summary-card strong,
.price-summary-card small {
  display: block;
}

.price-summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.price-summary-card strong {
  margin-top: 5px;
  font-size: 22px;
}

.price-summary-card small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.package-grid.management-list {
  grid-template-columns: 1fr;
}

.package-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.package-card.recommended {
  border-color: rgba(5, 150, 105, 0.35);
  box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.12);
}

.buy-package-card.selected {
  border-color: rgba(37, 99, 235, 0.5);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.customer-package-grid {
  margin-bottom: 14px;
}

.package-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.package-card strong,
.package-card small {
  display: block;
}

.package-card small,
.package-card p,
.package-devices {
  color: var(--muted);
}

.package-card p {
  line-height: 1.55;
}

.package-price {
  font-size: 28px;
  font-weight: 800;
}

.package-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.package-meta span {
  border-radius: 999px;
  padding: 5px 8px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.package-devices {
  font-size: 13px;
  line-height: 1.5;
}

.package-admin-detail {
  margin-top: 0;
}

.package-device-section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.package-device-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.package-device-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.package-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.package-edit-form h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 15px;
}

.package-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.package-edit-form textarea {
  min-height: 72px;
  resize: vertical;
}

.package-price-advice {
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: #eff6ff;
}

.package-price-advice span,
.package-price-advice strong,
.package-price-advice small {
  display: block;
}

.package-price-advice span {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.package-price-advice strong {
  margin-top: 4px;
  font-size: 22px;
}

.package-price-advice small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.package-recommend-row {
  grid-column: 1 / -1;
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--text) !important;
}

.package-recommend-row input {
  width: auto;
}

.package-device-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.package-device-picker label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
}

.package-device-picker input {
  width: auto;
  margin-top: 2px;
}

.package-device-picker span,
.package-device-picker small {
  display: block;
}

.package-device-picker small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.load-pill {
  display: inline-flex !important;
  align-items: center;
  width: fit-content;
  min-height: 20px;
  margin-top: 0 !important;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 800;
  white-space: nowrap;
}

.load-pill.low {
  background: #d1fae5;
  color: var(--ok);
}

.load-pill.medium {
  background: #fef3c7;
  color: var(--warn);
}

.load-pill.high {
  background: #fee2e2;
  color: var(--bad);
}

.package-edit-actions {
  grid-column: 1 / -1;
}

.package-selected-detail {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.package-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.package-detail-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.package-detail-grid span,
.package-detail-grid strong,
.package-detail-grid small {
  display: block;
}

.package-detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.package-detail-grid strong {
  margin-top: 4px;
  font-size: 17px;
}

.package-detail-grid small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.price-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.price-table {
  min-width: 1080px;
}

.price-table th,
.price-table td {
  vertical-align: middle;
}

.price-table td strong,
.price-table td small {
  display: block;
}

.price-table td small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tier-pill {
  display: inline-flex;
  max-width: 150px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.slot-price-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.slot-price-list div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.slot-price-list span,
.slot-price-list strong,
.slot-price-list small {
  display: block;
}

.slot-price-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.slot-price-list strong {
  margin-top: 3px;
  font-size: 16px;
}

.slot-price-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.account-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-card strong,
.account-card small {
  display: block;
}

.account-card small,
.account-card p {
  color: var(--muted);
}

.account-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.account-card dl div {
  padding: 9px;
  border-radius: 8px;
  background: #f8fafc;
}

.account-card dt,
.account-card dd {
  margin: 0;
}

.account-card dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-card dd {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.customer-card {
  align-content: start;
}

.customer-list-item,
.package-list-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.customer-list-item:hover,
.package-list-item:hover,
.customer-list-item.active,
.package-list-item.active {
  border-color: rgba(37, 99, 235, 0.38);
  background: #eff6ff;
}

.customer-list-item strong,
.customer-list-item small,
.package-list-item strong,
.package-list-item small {
  display: block;
}

.customer-list-item small,
.package-list-item small,
.customer-list-meta small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.customer-list-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.customer-detail-card {
  min-height: 100%;
}

.customer-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.customer-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.flow-step {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.flow-step.done {
  border-color: rgba(5, 150, 105, 0.25);
  background: #d1fae5;
  color: var(--ok);
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.finance-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.finance-grid span,
.finance-grid strong {
  display: block;
}

.finance-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.finance-grid strong {
  margin-top: 4px;
  font-size: 15px;
}

.customer-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.customer-sections section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.customer-sections h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.mini-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-list li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.review-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.material-review-layout {
  grid-template-columns: minmax(620px, 1.08fr) minmax(340px, 0.92fr);
}

.audit-section {
  display: grid;
  gap: 14px;
}

.audit-section + .audit-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.audit-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.audit-section-title h3 {
  margin: 0;
  font-size: 17px;
}

.audit-section-title span {
  color: var(--muted);
  font-size: 13px;
}

.material-list-wrap {
  max-height: calc(100vh - 240px);
  overflow: auto;
}

.material-list-table {
  min-width: 760px;
}

.material-row {
  cursor: pointer;
}

.material-row:hover,
.material-row.active {
  background: #eff6ff;
}

.material-row.active td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

.material-detail-card {
  align-self: start;
}

.review-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
}

.review-body {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.review-body header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.review-body strong,
.review-body small {
  display: block;
}

.review-body small,
.review-meta,
.review-note {
  color: var(--muted);
}

.review-meta,
.check-list,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-detail-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.review-detail-dl div {
  padding: 9px;
  border-radius: 8px;
  background: #f8fafc;
}

.review-detail-dl dt,
.review-detail-dl dd {
  margin: 0;
}

.review-detail-dl dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.review-detail-dl dd {
  color: var(--text);
  font-size: 13px;
}

.review-meta span,
.check {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
}

.check.pass {
  background: #d1fae5;
  color: var(--ok);
}

.check.manual {
  background: #dbeafe;
  color: var(--primary-dark);
}

.check.warning {
  background: #fef3c7;
  color: var(--warn);
}

.review-note {
  min-height: 40px;
  font-size: 13px;
  line-height: 1.5;
}

.reject-reason-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.reject-reason-field textarea {
  min-height: 76px;
  resize: vertical;
}

.order-list {
  display: grid;
  gap: 12px;
}

.flow-list {
  display: grid;
  gap: 10px;
}

.flow-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.flow-list span {
  color: var(--muted);
}

.order-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-actions {
  margin-top: 10px;
}

.order-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.order-card strong {
  display: block;
}

.order-card small {
  color: var(--muted);
}

.inline-schedule-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.form-warning {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  background: #fff7ed;
  font-weight: 700;
}

.progress {
  height: 8px;
  margin: 10px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
}

@media (max-width: 1100px) {
  body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  main {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .layout,
  .metric-grid,
  .review-grid,
  .account-grid,
  .management-layout,
  .customer-sections,
  .customer-portal-grid,
  .customer-material-grid,
  .ai-video-layout,
  .storyboard-list,
  .package-grid,
  .package-detail-grid,
  .price-summary,
  .chart-grid,
  .revenue-toolbar {
    grid-template-columns: 1fr;
  }

  .map-stage-header {
    grid-template-columns: 1fr;
  }

  .dashboard-map-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .dashboard-page,
  .dashboard-page.page-section.active,
  .dashboard-map-layout {
    height: auto;
    overflow: visible;
  }

  .map-board {
    min-height: 520px;
  }

  .device-drawer {
    max-height: none;
  }

  .device-list {
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  .dashboard-map-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  main {
    padding: 14px;
  }

  .topbar,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    grid-template-columns: 1fr 1fr;
  }

  .order-form {
    grid-template-columns: 1fr;
  }

  .device-picker {
    grid-template-columns: 1fr;
  }

  .compact-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .map-board {
    min-height: 420px;
  }

  .device-detail dl div {
    grid-template-columns: 1fr;
  }

  .power-actions,
  .signal-actions,
  .power-schedule {
    grid-template-columns: 1fr;
  }

  .customer-flow,
  .finance-grid,
  .account-card dl,
  .profile-dl,
  .package-edit-form,
  .package-device-picker,
  .review-detail-dl,
  .slot-price-list,
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .pie-chart {
    justify-self: center;
  }
}
