body[data-page="service"] {
  --surface: var(--panel);
  --surface-soft: var(--panel-alt);
  --border: var(--line);
  --radius: var(--radius-sm);
  --nav-width: clamp(118px, 10vw, 168px);
  --panel-left: clamp(320px, 21vw, 390px);
  --panel-right: clamp(330px, 21vw, 390px);
  --map-control-height: 42px;
  font-family: var(--ui);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--nav-width) var(--panel-left) minmax(420px, 1fr) var(--panel-right);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  background: var(--bg);
}

.app-shell.details-closed {
  grid-template-columns: var(--nav-width) var(--panel-left) minmax(420px, 1fr) 0;
}

.app-shell.left-panel-closed {
  grid-template-columns: var(--nav-width) 0 minmax(420px, 1fr) var(--panel-right);
}

.app-shell.left-panel-closed.details-closed {
  grid-template-columns: var(--nav-width) 0 minmax(420px, 1fr) 0;
}

.app-shell.details-closed .right-panel,
.right-panel.is-closed,
.left-panel.is-closed {
  display: none;
}

.nav-rail,
.left-panel,
.right-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-width: 0;
}

.nav-rail {
  grid-column: 1;
}

.left-panel {
  grid-column: 2;
}

.map-area {
  grid-column: 3;
}

.right-panel {
  grid-column: 4;
}

.nav-rail {
  display: flex;
  flex-direction: column;
  padding: 18px 10px;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 42px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 14px;
}

.nav-rail nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #334155;
  text-align: left;
  font-size: 14px;
}

.nav-item span {
  width: 18px;
  text-align: center;
  color: #1d4ed8;
}

.nav-item.active,
.nav-item:hover {
  background: #eaf2ff;
  color: var(--accent-strong);
}

.connection-card,
.operator-card {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.connection-card {
  display: grid;
  gap: 6px;
  color: #15803d;
}

.connection-card.offline {
  color: #b45309;
  background: #fff7ed;
}

.connection-card span,
.connection-card small,
.operator-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.operator-card {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 0;
}

.operator-card > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px 16px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

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

.button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
}

.button.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: #24324a;
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.button.ghost {
  border-color: #fecaca;
  background: #fff5f5;
  color: #b91c1c;
}

.button.search {
  height: 100%;
  min-height: 100%;
  background: #ffd447;
  color: #332500;
  border-radius: 0 7px 7px 0;
}

.search-field,
.map-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--map-control-height);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}

.search-field {
  padding: 0 12px;
}

.search-field input,
.map-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filters select {
  flex: 1 1 104px;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: #344054;
  font-size: 12px;
}

.compact-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
}

.object-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0 2px 0 0;
  list-style: none;
  overflow: auto;
}

.object-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.object-card:hover,
.object-card.selected {
  border-color: #9cc5ff;
  box-shadow: 0 8px 22px rgba(15, 107, 220, 0.12);
}

.object-card.selected {
  transform: translateY(-1px);
}

.object-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 74px;
  padding: 10px 10px 10px 36px;
  border: 0;
  background: transparent;
  text-align: left;
}

.route-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
}

.machine-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--status-color) 12%, white);
  color: var(--status-color);
  font-size: 20px;
}

.object-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.object-copy strong,
.object-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-copy strong {
  font-size: 14px;
}

.object-copy small {
  color: var(--muted);
  font-size: 12px;
}

.object-state {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-chip,
.ready-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 650;
  font-size: 11px;
}

.status-chip.waiting { background: #dbeafe; color: #1d4ed8; }
.status-chip.working { background: #fff2d7; color: #b45309; }
.status-chip.repair { background: #fee2e2; color: #dc2626; }
.status-chip.parts { background: #ede9fe; color: #7c3aed; }
.status-chip.defect { background: #fef3c7; color: #a16207; }
.status-chip.ready,
.ready-chip { background: #dcfce7; color: #15803d; }

.empty-list,
.empty-note {
  color: var(--muted);
  font-size: 14px;
}

.empty-list {
  display: grid;
  gap: 4px;
}

.empty-list strong,
.empty-list span {
  display: block;
}

.empty-list strong {
  color: var(--text);
}

.map-area {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.app-shell.left-panel-closed .topbar {
  left: 122px;
}

.map-search,
.top-actions,
.map-actions,
.route-panel {
  pointer-events: auto;
}

.map-search {
  width: min(520px, 52vw);
  height: var(--map-control-height);
  box-shadow: 0 8px 20px rgba(15, 35, 80, 0.12);
  padding-left: 12px;
  overflow: hidden;
}

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

.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--map-control-height);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: #344054;
  box-shadow: 0 8px 18px rgba(15, 35, 80, 0.08);
  font-size: 12px;
}

.location-status {
  display: inline-flex;
  align-items: center;
  min-height: var(--map-control-height);
  max-width: 280px;
  padding: 0 10px;
  border: 1px solid rgba(15, 107, 220, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: #344054;
  box-shadow: 0 8px 18px rgba(15, 35, 80, 0.08);
  font-size: 12px;
  line-height: 1.25;
}

.location-status[hidden] {
  display: none;
}

.location-status[data-status="ok"] {
  border-color: rgba(22, 163, 74, 0.3);
  color: #15803d;
}

.location-status[data-status="pending"] {
  border-color: rgba(15, 107, 220, 0.3);
  color: #1d4ed8;
}

.location-status[data-status="warning"],
.location-status[data-status="error"] {
  border-color: rgba(220, 38, 38, 0.34);
  color: #b91c1c;
}

.map-canvas {
  width: 100%;
  height: 100%;
  background: #d9ecf6;
}

body[data-page="service"] .map-canvas.leaflet-container {
  cursor: default;
}

body[data-page="service"] .map-canvas.leaflet-container.leaflet-dragging {
  cursor: move;
}

body[data-page="service"] .map-canvas .leaflet-interactive {
  cursor: inherit;
}

body[data-page="service"] .map-canvas .leaflet-marker-icon,
body[data-page="service"] .map-canvas .map-marker,
body[data-page="service"] .map-canvas .leaflet-control,
body[data-page="service"] .map-canvas .leaflet-control a,
body[data-page="service"] .map-canvas .leaflet-control button {
  cursor: pointer;
}

.left-panel-handle {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 560;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--map-control-height);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.95);
  color: #24324a;
  box-shadow: 0 8px 18px rgba(15, 35, 80, 0.1);
  font-weight: 700;
  font-size: 13px;
}

body[data-page="service"] .left-panel-handle svg {
  display: block;
  width: 18px;
  height: 18px;
  color: currentColor;
  transition: transform 0.2s ease;
}

body[data-page="service"] .left-panel-handle path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell.left-panel-closed .left-panel-handle svg {
  transform: rotate(180deg);
}

.left-panel-handle:hover {
  color: var(--accent-strong);
  background: #eaf2ff;
}

.left-panel-handle[hidden] {
  display: none;
}

.leaflet-control-container .leaflet-top.leaflet-left {
  top: 84px;
  left: 14px;
}

.map-actions {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  display: flex;
  gap: 8px;
}

.route-panel {
  position: absolute;
  right: 14px;
  bottom: 64px;
  z-index: 500;
  width: min(430px, calc(100% - 28px));
  max-height: min(340px, calc(100% - 112px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.route-panel.is-editing {
  width: min(500px, calc(100% - 28px));
  max-height: min(620px, calc(100% - 96px));
}

.route-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.route-head > div {
  display: grid;
  gap: 2px;
}

.route-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.route-head strong {
  font-size: 14px;
}

.route-head span,
.route-edit-tools span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.route-empty {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.route-empty strong {
  color: var(--text);
}

.saved-route-list {
  display: grid;
  gap: 8px;
}

.saved-route-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.saved-route-card > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.saved-route-card strong,
.saved-route-card span,
.saved-route-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-route-card span,
.saved-route-card small {
  color: var(--muted);
  font-size: 12px;
}

.saved-route-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.object-list.saved-route-list .saved-route-card {
  grid-template-columns: 1fr;
}

.object-list.saved-route-list .saved-route-actions {
  justify-content: flex-start;
}

.route-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.route-stats span {
  display: grid;
  gap: 3px;
  padding: 9px;
  border-radius: 7px;
  background: #eef5ff;
  color: var(--muted);
  font-size: 12px;
}

.route-stats b {
  color: var(--accent);
  font-size: 16px;
}

.route-order {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding-left: 22px;
  font-size: 13px;
}

.route-order small {
  display: block;
  color: var(--muted);
}

.route-edit-tools {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 7px;
  background: #f8fbff;
}

.route-edit-tools .button {
  justify-self: start;
}

.route-edit-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.route-edit-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.route-edit-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.route-edit-list strong,
.route-edit-list small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-edit-list small {
  color: var(--muted);
  font-size: 12px;
}

.route-edit-actions {
  display: flex;
  gap: 4px;
}

.route-edit-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #24324a;
  font-weight: 800;
}

.route-edit-actions button:disabled {
  cursor: default;
  opacity: 0.35;
}

.route-legs {
  display: grid;
  gap: 10px;
}

.route-leg {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  background: #f8fbff;
}

.route-leg h4 {
  margin: 0;
  color: #172033;
  font-size: 13px;
  line-height: 1.35;
}

.route-leg ul,
.route-option-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-leg li,
.route-option {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  gap: 2px 8px;
  padding: 7px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-size: 12px;
}

.route-option {
  cursor: pointer;
}

.route-option.selected {
  border-color: var(--accent);
  background: #eaf2ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.route-leg li span,
.route-option span {
  color: var(--accent);
  font-weight: 800;
}

.route-leg li small,
.route-option small {
  grid-column: 1 / -1;
  color: var(--muted);
}

html[data-theme="dark"] body[data-page="service"] .route-leg li {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 32, 0.94);
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .route-leg li span {
  color: var(--accent);
}

html[data-theme="dark"] body[data-page="service"] .route-leg li small {
  color: var(--muted);
}

.right-panel {
  border-right: 0;
  overflow: auto;
}

.empty-details {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100%;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.empty-details h2 {
  margin: 0;
  color: var(--text);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: #eaf2ff;
  color: var(--accent);
  font-size: 28px;
}

.detail-card {
  display: grid;
  gap: 18px;
  padding: 24px 20px;
}

.detail-header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
}

.detail-photo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: var(--radius);
  background: #edf3fb;
  overflow: hidden;
  font-size: 28px;
}

.detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.2;
}

.detail-header p {
  margin: 0;
  color: var(--muted);
}

.detail-close {
  align-self: start;
  justify-self: end;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
}

.detail-tabs button {
  position: relative;
  min-width: 0;
  padding: 0 0 12px;
  border: 0;
  background: transparent;
  text-align: center;
  color: #344054;
  font-size: 13px;
}

.detail-tabs button:hover,
.detail-tabs .active {
  color: var(--accent);
  font-weight: 700;
}

.detail-tabs .active::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.detail-tabs b {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 16px;
  margin: 0;
  font-size: 14px;
}

.info-grid dt {
  color: var(--muted);
}

.info-grid dd {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
  text-align: right;
  font-weight: 600;
}

body[data-page="service"] .service-phone-list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}

body[data-page="service"] .service-phone-list a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
  word-break: break-word;
}

body[data-page="service"] .service-phone-list a:hover {
  text-decoration: underline;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section h3 {
  margin: 0;
  font-size: 15px;
}

.detail-section p {
  margin: 0;
  color: #344054;
  line-height: 1.55;
}

.task-list,
.history-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-row,
.history-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.task-row > span,
.history-list li > span {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--warning);
}

.task-row.done > span {
  background: var(--success);
}

.task-row strong,
.history-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 14px;
}

.task-row small,
.history-list small {
  color: var(--muted);
  font-size: 12px;
}

.detail-photos,
.photo-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.detail-photos button,
.photo-open {
  border: 0;
  padding: 0;
  background: transparent;
}

.detail-photos img,
.photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
}

.detail-actions {
  display: grid;
  gap: 8px;
}

body[data-page="service"] .detail-actions > form {
  display: grid;
  margin: 0;
}

body[data-page="service"] .detail-actions .button {
  width: 100%;
}

.map-marker {
  position: relative;
  touch-action: none;
  user-select: none;
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--marker-color);
  box-shadow: 0 6px 14px rgba(15, 35, 80, 0.22);
  transform: rotate(-45deg);
}

.map-marker span {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fff;
}

.map-marker.is-selected {
  outline: 3px solid rgba(15, 107, 220, 0.32);
}

.map-marker.is-moving {
  outline: 4px solid rgba(15, 107, 220, 0.42);
  box-shadow: 0 0 0 8px rgba(15, 107, 220, 0.14), 0 10px 22px rgba(15, 35, 80, 0.28);
}

.map-marker.in-route::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.map-marker.is-temp {
  --marker-color: #111827;
}

.route-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 35, 80, 0.22);
  font-weight: 800;
  font-size: 12px;
}

.user-location-marker {
  position: relative;
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px rgba(15, 107, 220, 0.18), 0 8px 18px rgba(15, 35, 80, 0.28);
}

.user-location-marker span {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
}

.route-panel .route-head strong {
  line-height: 1.25;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

body[data-page="service"].is-service-picking-point .modal-backdrop {
  display: none;
}

body[data-page="service"].is-service-picking-point .service-map-area {
  cursor: crosshair;
}

body[data-page="service"].is-service-picking-point .map-canvas.leaflet-container,
body[data-page="service"].is-service-picking-point .map-canvas .leaflet-interactive {
  cursor: crosshair;
}

.modal {
  width: min(760px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font-size: 20px;
}

.equipment-form,
.settings-grid,
.confirm-modal {
  display: grid;
  gap: 16px;
  padding: 20px;
}

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

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

.equipment-form label,
.settings-grid label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.equipment-form input,
.equipment-form select,
.equipment-form textarea,
.settings-grid input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-weight: 500;
}

.equipment-form textarea {
  resize: vertical;
}

.address-field,
.form-wide,
.equipment-form label:has(textarea),
.equipment-form label:has(input[type="file"]) {
  grid-column: 1 / -1;
}

.inline-field {
  display: flex;
  gap: 8px;
}

.inline-field input {
  flex: 1;
}

.phone-fieldset {
  display: grid;
  gap: 10px;
}

.phone-fieldset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.service-phone-fields {
  display: grid;
  gap: 10px;
}

.equipment-form .phone-field {
  gap: 6px;
}

.phone-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.phone-input-row .button {
  min-height: 38px;
  white-space: nowrap;
}

.photo-thumb {
  position: relative;
  margin: 0;
  min-width: 0;
}

.photo-thumb figcaption {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
}

.modal-actions,
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-actions {
  grid-column: 1 / -1;
}

.toggle-row {
  display: flex !important;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px !important;
}

.toggle-row input {
  width: auto;
}

.toast-host {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 1200;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast-success { background: #15803d; }
.toast-warning { background: #b45309; }
.toast-error { background: #b91c1c; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 30px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
}

.lightbox .icon-button {
  position: absolute;
  top: 20px;
  right: 20px;
}

.lightbox img {
  max-width: min(100%, 1080px);
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.settings-hint {
  position: fixed;
  left: 184px;
  bottom: 8px;
  z-index: 600;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 74px 320px minmax(420px, 1fr);
  }

  .app-shell.left-panel-closed {
    grid-template-columns: 74px 0 minmax(420px, 1fr);
  }

  .nav-rail {
    align-items: center;
  }

  .brand strong,
  .nav-item:not(.active),
  .nav-item.active {
    font-size: 0;
  }

  .nav-item {
    justify-content: center;
    width: 46px;
    padding: 0;
  }

  .nav-item span {
    font-size: 16px;
  }

  .connection-card,
  .operator-card {
    display: none;
  }

  .right-panel {
    position: fixed;
    right: 0;
    top: auto;
    bottom: 0;
    left: 394px;
    z-index: 700;
    width: auto;
    height: min(42vh, 320px);
    box-shadow: var(--shadow);
  }

  .app-shell.left-panel-closed .right-panel {
    left: 74px;
  }

  .route-panel {
    bottom: calc(min(42vh, 320px) + 62px);
  }

  .map-actions {
    bottom: calc(min(42vh, 320px) + 14px);
  }

  .app-shell.details-closed .route-panel,
  .app-shell.details-closed .map-actions {
    bottom: 14px;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(560px, 72vh) auto auto;
    height: auto;
    min-height: 100vh;
  }

  .app-shell.left-panel-closed,
  .app-shell.left-panel-closed.details-closed {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(560px, 72vh) auto;
  }

  .nav-rail {
    position: sticky;
    top: 0;
    z-index: 800;
    flex-direction: row;
    justify-content: space-between;
    padding: 10px;
    overflow: auto;
    scrollbar-width: none;
  }

  .nav-rail::-webkit-scrollbar {
    display: none;
  }

  .brand {
    border-bottom: 0;
    padding: 0;
  }

  .brand strong,
  .nav-item {
    font-size: 13px;
  }

  .nav-rail nav {
    display: flex;
  }

  .left-panel,
  .right-panel {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-rail {
    order: 1;
    grid-column: auto;
  }

  .map-area {
    order: 2;
    grid-column: auto;
  }

  .left-panel {
    order: 3;
    grid-column: auto;
  }

  .right-panel {
    order: 4;
    grid-column: auto;
  }

  .map-area {
    min-height: 72vh;
  }

  .topbar {
    flex-direction: column;
  }

  .app-shell.left-panel-closed .topbar {
    left: 114px;
  }

  .leaflet-control-container .leaflet-top.leaflet-left {
    top: 122px;
  }

  .leaflet-control-container .leaflet-bottom.leaflet-right {
    top: 176px;
    bottom: auto;
  }

  .map-search {
    width: 100%;
  }

  .route-panel {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-height: 230px;
  }

  .route-panel.is-editing {
    max-height: min(390px, calc(100% - 96px));
  }

  .map-actions {
    bottom: 108px;
  }

  .settings-hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-rows: auto minmax(520px, 66vh) auto auto;
  }

  .map-area {
    min-height: 66vh;
  }

  .left-panel {
    padding: 14px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .object-main {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .object-state {
    grid-column: 2;
    grid-template-columns: repeat(2, max-content);
    justify-content: start;
  }

  .top-actions {
    display: flex;
    width: 100%;
  }

  .top-actions .chip-button {
    flex: 1;
  }

  .form-grid,
  .settings-grid,
  .form-grid.two,
  .detail-photos,
  .photo-preview {
    grid-template-columns: 1fr;
  }

  .inline-field,
  .modal-actions,
  .settings-actions {
    flex-direction: column;
  }
}

/* RTOS Tracker integration layer. Keep this page visually aligned with the
   main project without leaking the standalone map CSS into other pages. */
body[data-page="service"] {
  font-family: var(--ui, Inter, "Segoe UI", Roboto, Arial, sans-serif);
  color: var(--text);
}

body[data-page="service"] .service-module {
  color: var(--text);
  background: var(--bg);
}

body[data-page="service"] .nav-rail,
body[data-page="service"] .left-panel,
body[data-page="service"] .right-panel,
body[data-page="service"] .panel-header,
body[data-page="service"] .filters,
body[data-page="service"] .object-list,
body[data-page="service"] .map-area {
  color: var(--text);
}

body[data-page="service"] .nav-rail {
  padding-bottom: 88px;
}

body[data-page="service"] .left-panel {
  min-height: 0;
}

body[data-page="service"] .object-list {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
}

body[data-page="service"] .brand-mark,
body[data-page="service"] .button.primary {
  background: var(--accent);
  color: #041015;
}

body[data-page="service"] .nav-item.active,
body[data-page="service"] .nav-item:hover {
  background: rgba(67, 215, 196, 0.14);
  color: var(--accent-strong);
}

html[data-theme="dark"] body[data-page="service"] .nav-item {
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .nav-item span {
  color: var(--accent-strong);
}

html[data-theme="dark"] body[data-page="service"] .search-field,
html[data-theme="dark"] body[data-page="service"] .map-search,
html[data-theme="dark"] body[data-page="service"] .filters select,
html[data-theme="dark"] body[data-page="service"] .object-card,
html[data-theme="dark"] body[data-page="service"] .button.secondary,
html[data-theme="dark"] body[data-page="service"] .chip-button,
html[data-theme="dark"] body[data-page="service"] .location-status,
html[data-theme="dark"] body[data-page="service"] .left-panel-handle,
html[data-theme="dark"] body[data-page="service"] .route-panel,
html[data-theme="dark"] body[data-page="service"] .modal-card,
html[data-theme="dark"] body[data-page="service"] .form-card,
html[data-theme="dark"] body[data-page="service"] .settings-card,
html[data-theme="dark"] body[data-page="service"] .saved-route-card {
  border-color: var(--border);
  background: rgba(17, 25, 34, 0.94);
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .location-status[data-status="ok"] {
  color: #7ee2a8;
}

html[data-theme="dark"] body[data-page="service"] .location-status[data-status="pending"] {
  color: #8fb8ff;
}

html[data-theme="dark"] body[data-page="service"] .location-status[data-status="warning"],
html[data-theme="dark"] body[data-page="service"] .location-status[data-status="error"] {
  color: #ff9f9f;
}

html[data-theme="dark"] body[data-page="service"] input,
html[data-theme="dark"] body[data-page="service"] select,
html[data-theme="dark"] body[data-page="service"] textarea,
html[data-theme="dark"] body[data-page="service"] .search-field input,
html[data-theme="dark"] body[data-page="service"] .map-search input {
  background: transparent;
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] input::placeholder {
  color: rgba(158, 176, 196, 0.82);
}

html[data-theme="dark"] body[data-page="service"] .object-copy strong,
html[data-theme="dark"] body[data-page="service"] .empty-list strong,
html[data-theme="dark"] body[data-page="service"] .modal-card h2,
html[data-theme="dark"] body[data-page="service"] .right-panel h2,
html[data-theme="dark"] body[data-page="service"] .right-panel h3,
html[data-theme="dark"] body[data-page="service"] .panel-header h1 {
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .object-copy small,
html[data-theme="dark"] body[data-page="service"] .panel-header span,
html[data-theme="dark"] body[data-page="service"] .compact-toggle,
html[data-theme="dark"] body[data-page="service"] .empty-list,
html[data-theme="dark"] body[data-page="service"] .empty-note,
html[data-theme="dark"] body[data-page="service"] .right-panel small,
html[data-theme="dark"] body[data-page="service"] .meta-line {
  color: var(--muted);
}

html[data-theme="dark"] body[data-page="service"] .button.ghost {
  border-color: rgba(248, 113, 113, 0.46);
  background: rgba(127, 29, 29, 0.34);
  color: #fecaca;
}

html[data-theme="dark"] body[data-page="service"] .button.search {
  border-color: rgba(67, 215, 196, 0.36);
  background: #31c7b5;
  color: #061217;
}

html[data-theme="dark"] body[data-page="service"] .object-card:hover,
html[data-theme="dark"] body[data-page="service"] .object-card.selected {
  border-color: rgba(67, 215, 196, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] body[data-page="service"] .machine-icon {
  background: color-mix(in srgb, var(--status-color) 22%, #111922);
}

body[data-page="service"] .service-project-nav {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 1400;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: rgba(10, 16, 22, 0.88);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

html[data-theme="light"] body[data-page="service"] .service-project-nav {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.12);
}

body[data-page="service"] .theme-switcher,
body[data-page="service"] .sidebar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

body[data-page="service"] .theme-button,
body[data-page="service"] .quick-link {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  line-height: 1;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 13px;
  background: rgba(17, 24, 34, 0.78);
  color: #dce8f7;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

body[data-page="service"] .theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  padding: 0;
  overflow: hidden;
}

body[data-page="service"] .theme-toggle .theme-icon {
  position: relative;
  z-index: 1;
  display: none;
  width: 18px;
  height: 18px;
  opacity: 1;
  transition: color 0.18s ease, transform 0.18s ease;
}

body[data-page="service"] .theme-toggle[data-theme-current="dark"] [data-theme-icon="dark"],
body[data-page="service"] .theme-toggle[data-theme-current="light"] [data-theme-icon="light"] {
  display: block;
}

body[data-page="service"] .theme-toggle:hover .theme-icon {
  transform: scale(1.04);
}

html[data-theme="light"] body[data-page="service"] .theme-button,
html[data-theme="light"] body[data-page="service"] .quick-link {
  background: #f6f8fb;
  color: #172033;
}

body[data-page="service"] .theme-button:hover,
body[data-page="service"] .quick-link:hover,
body[data-page="service"] .theme-button.is-active,
body[data-page="service"] .quick-link.is-current {
  border-color: rgba(67, 215, 196, 0.74);
  background: rgba(20, 83, 78, 0.72);
  color: #ffffff;
  transform: translateY(-1px);
}

body[data-page="service"] .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

body[data-page="service"] .service-filter-form {
  display: grid;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 0;
}

body[data-page="service"] .detail-pane {
  display: grid;
  gap: 16px;
}

body[data-page="service"] .detail-pane[hidden] {
  display: none;
}

body[data-page="service"] .service-map-tooltip {
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="service"] .service-map-tooltip::before {
  display: none;
}

body[data-page="service"] .service-map-label {
  color: #111827;
  font-weight: 800;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
}

body[data-page="service"] .map-marker-wrapper,
body[data-page="service"] .route-number-wrapper,
body[data-page="service"] .user-location-wrapper {
  border: 0;
  background: transparent;
}

body[data-page="service"] .equipment-form small {
  color: var(--muted);
  font-weight: 500;
}

html[data-theme="dark"] body[data-page="service"] .modal,
html[data-theme="dark"] body[data-page="service"] .modal-header {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .equipment-form input,
html[data-theme="dark"] body[data-page="service"] .equipment-form select,
html[data-theme="dark"] body[data-page="service"] .equipment-form textarea,
html[data-theme="dark"] body[data-page="service"] .settings-grid input {
  border-color: var(--border);
  background: rgba(7, 11, 15, 0.55);
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .phone-fieldset-head {
  color: var(--text);
}

body[data-page="service"].go-ssr .app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

body[data-page="service"].go-ssr .app-shell.left-panel-closed {
  grid-template-columns: 0 minmax(0, 1fr);
}

body[data-page="service"].go-ssr.is-sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body[data-page="service"].go-ssr .app-shell.left-panel-closed .sidebar {
  display: none;
}

body[data-page="service"].go-ssr.is-sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  opacity: 0;
  pointer-events: none;
}

body[data-page="service"].go-ssr.is-sidebar-collapsed .service-left-panel {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

body[data-page="service"].go-ssr .sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
}

body[data-page="service"] .service-left-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 18px 16px 12px;
  overflow: hidden;
}

body[data-page="service"] .service-panel-header {
  flex: 0 0 auto;
}

body[data-page="service"] .service-panel-header .panel-actions {
  justify-content: flex-end;
}

body[data-page="service"] .service-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body[data-page="service"] .service-view-tabs .mini-tag {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 24, 33, 0.72);
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

body[data-page="service"] .service-view-tabs .mini-tag.is-active {
  border-color: rgba(67, 215, 196, 0.62);
  background: rgba(67, 215, 196, 0.16);
  color: var(--text);
}

body[data-page="service"] .service-left-panel .object-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
  scroll-padding-top: 8px;
}

body[data-page="service"] .service-workspace {
  position: relative;
  display: grid;
  grid-column: 2;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 20vw, 390px);
  gap: 0;
  padding: 0;
  overflow: hidden;
}

body[data-page="service"] .app-shell.details-closed .service-workspace {
  grid-template-columns: minmax(0, 1fr) 0;
}

body[data-page="service"] .app-shell.details-closed .service-right-panel {
  display: none;
}

body[data-page="service"] .service-map-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

body[data-page="service"] .service-right-panel {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 18, 25, 0.96), rgba(10, 14, 20, 0.98));
}

body[data-page="service"] .detail-card {
  position: relative;
}

html[data-theme="dark"] body[data-page="service"] .service-right-panel .task-row,
html[data-theme="dark"] body[data-page="service"] .service-right-panel .history-list li {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 32, 0.86);
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .service-right-panel .detail-section p,
html[data-theme="dark"] body[data-page="service"] .service-right-panel .task-row strong,
html[data-theme="dark"] body[data-page="service"] .service-right-panel .history-list strong {
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .service-right-panel .task-row small,
html[data-theme="dark"] body[data-page="service"] .service-right-panel .history-list small {
  color: var(--muted);
}

body[data-page="service"] .service-right-panel .detail-header {
  grid-template-columns: 58px minmax(0, 1fr);
  padding-right: 52px;
}

body[data-page="service"] .service-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  line-height: 0;
}

body[data-page="service"] .service-detail-close-icon {
  display: block;
  width: 16px;
  height: 16px;
}

body[data-page="service"] .service-detail-close-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-page="service"] .service-modal-close {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  line-height: 0;
  text-decoration: none;
}

body[data-page="service"] .service-modal-close-icon {
  display: block;
  width: 16px;
  height: 16px;
}

body[data-page="service"] .service-modal-close-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-page="service"] .service-object-popup .leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 23, 32, 0.96);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body[data-page="service"] .service-object-popup .leaflet-popup-content {
  width: 300px !important;
  margin: 0;
}

body[data-page="service"] .service-object-popup .leaflet-popup-tip {
  background: rgba(15, 23, 32, 0.96);
}

body[data-page="service"] .service-marker-popup,
body[data-page="service"] .service-map-object-sheet-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

body[data-page="service"] .service-marker-popup-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

body[data-page="service"] .service-marker-popup-head strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.18;
}

body[data-page="service"] .service-marker-popup-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.25;
}

body[data-page="service"] .service-marker-popup-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 12px;
  font-size: 18px;
}

body[data-page="service"] .service-marker-popup-grid {
  display: grid;
  grid-template-columns: minmax(88px, auto) minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 13px;
}

body[data-page="service"] .service-marker-popup-grid dt {
  color: var(--muted);
}

body[data-page="service"] .service-marker-popup-grid dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

body[data-page="service"] .service-marker-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

body[data-page="service"] .service-marker-popup-actions .button {
  min-height: 38px;
  padding: 8px 10px;
  justify-content: center;
  text-align: center;
}

body[data-page="service"] .service-marker-popup-actions .button:first-child {
  grid-column: 1 / -1;
}

body[data-page="service"] .service-map-object-sheet {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 70px;
  z-index: 1240;
  pointer-events: auto;
}

body[data-page="service"] .service-map-object-sheet[hidden] {
  display: none;
}

body[data-page="service"] .service-map-object-sheet-card {
  max-height: min(52vh, 430px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 23, 32, 0.97);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

html[data-theme="light"] body[data-page="service"] .service-object-popup .leaflet-popup-content-wrapper,
html[data-theme="light"] body[data-page="service"] .service-map-object-sheet-card {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

html[data-theme="light"] body[data-page="service"] .service-object-popup .leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.98);
}

body[data-page="service"] .service-map-area .topbar {
  left: 66px;
}

body[data-page="service"] .service-map-area .map-canvas {
  min-height: 100%;
}

body[data-page="service"] .sidebar-footer {
  flex: 0 0 auto;
}

body[data-page="service"] .service-menu-burger {
  display: none;
}

body[data-page="service"] .settings-hint {
  display: none !important;
}

html[data-theme="light"] body[data-page="service"] .service-right-panel {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="light"] body[data-page="service"] .service-view-tabs .mini-tag {
  border-color: #d8e1ec;
  background: #f7fafd;
  color: #42526b;
}

html[data-theme="light"] body[data-page="service"] .service-view-tabs .mini-tag:hover {
  border-color: #9ccfc8;
  background: #edf8f6;
  color: #0f5d56;
}

html[data-theme="light"] body[data-page="service"] .service-view-tabs .mini-tag.is-active {
  border-color: #2bbbad;
  background: #dff8f4;
  color: #075e57;
  box-shadow: inset 0 0 0 1px rgba(43, 187, 173, 0.2);
}

html[data-theme="light"] body[data-page="service"] .service-right-panel h2,
html[data-theme="light"] body[data-page="service"] .service-right-panel h3,
html[data-theme="light"] body[data-page="service"] .service-right-panel .info-grid dd,
html[data-theme="light"] body[data-page="service"] .service-right-panel .task-row strong,
html[data-theme="light"] body[data-page="service"] .service-right-panel .history-list strong {
  color: var(--text);
}

html[data-theme="light"] body[data-page="service"] .service-right-panel p,
html[data-theme="light"] body[data-page="service"] .service-right-panel small,
html[data-theme="light"] body[data-page="service"] .service-right-panel .info-grid dt {
  color: var(--muted);
}

html[data-theme="light"] body[data-page="service"] .service-right-panel .button.secondary {
  background: #ffffff;
  color: #24324a;
}

html[data-theme="light"] body[data-page="service"] .service-right-panel .task-row,
html[data-theme="light"] body[data-page="service"] .service-right-panel .history-list li {
  background: #ffffff;
  border-color: var(--border);
}

@media (max-width: 1120px) {
  body[data-page="service"].go-ssr .app-shell,
  body[data-page="service"].go-ssr .app-shell.left-panel-closed,
  body[data-page="service"].go-ssr.is-sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body[data-page="service"].go-ssr .app-shell.left-panel-closed .sidebar {
    display: flex;
  }

  body[data-page="service"].go-ssr.is-sidebar-collapsed .sidebar {
    transform: translateX(-105%);
  }

  body[data-page="service"] .service-workspace,
  body[data-page="service"] .app-shell.details-closed .service-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
    overflow: visible;
  }

  body[data-page="service"] .service-map-area {
    min-height: 68vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body[data-page="service"] .service-right-panel {
    height: auto;
    min-height: 0;
    border-left: 0;
  }

  body[data-page="service"] .service-left-panel {
    max-height: none;
  }
}

html[data-theme="light"] body[data-page="service"] .theme-button:hover,
html[data-theme="light"] body[data-page="service"] .quick-link:hover,
html[data-theme="light"] body[data-page="service"] .theme-button.is-active,
html[data-theme="light"] body[data-page="service"] .quick-link.is-current {
  background: #dff8f4;
  color: #075e57;
}

body[data-page="service"] .quick-link.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

body[data-page="service"] .quick-link-icon,
body[data-page="service"] .theme-icon {
  width: 20px;
  height: 20px;
}

body[data-page="service"] .quick-link-icon path,
body[data-page="service"] .quick-link-icon circle,
body[data-page="service"] .theme-icon path,
body[data-page="service"] .theme-icon circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-page="service"] .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  body[data-page="service"].go-ssr {
    overflow: hidden;
  }

  body[data-page="service"].go-ssr .app-shell,
  body[data-page="service"].go-ssr .app-shell.left-panel-closed,
  body[data-page="service"].go-ssr.is-sidebar-collapsed .app-shell {
    display: block;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    overflow: hidden;
  }

  body[data-page="service"] .sidebar {
    display: contents;
  }

  body[data-page="service"] .service-left-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 58px;
    z-index: 1180;
    width: min(88vw, 360px);
    max-height: none;
    padding: 18px 14px 14px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 18px 0 42px rgba(0, 0, 0, 0.34);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }

  body[data-page="service"] .app-shell.service-menu-open .service-left-panel {
    transform: translateX(0);
  }

  body[data-page="service"].go-ssr.is-sidebar-collapsed .service-left-panel {
    transform: translateX(-100%);
  }

  body[data-page="service"] .service-menu-burger {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1300;
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 14px;
    font-size: 22px;
    line-height: 1;
  }

  body[data-page="service"] .app-shell.service-menu-open .service-menu-burger {
    left: calc(min(88vw, 360px) - 56px);
  }

  body[data-page="service"] .left-panel-handle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1300;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 14px;
  }

  body[data-page="service"] .app-shell.service-menu-open .left-panel-handle {
    left: min(calc(88vw + 8px), calc(var(--sidebar-w) + 8px), calc(100vw - 54px));
  }

  body[data-page="service"] .service-workspace,
  body[data-page="service"] .app-shell.details-closed .service-workspace {
    display: block;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 0 0 calc(68px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  body[data-page="service"] .service-map-area {
    height: 100%;
    min-height: 100%;
    border: 0;
  }

  body[data-page="service"] .service-map-area .map-canvas {
    height: 100%;
    min-height: 100%;
  }

  body[data-page="service"] .service-right-panel {
    display: none;
  }

  body[data-page="service"] .service-map-area .topbar {
    top: 12px;
    left: 66px;
    right: 10px;
    gap: 8px;
    align-items: stretch;
  }

  body[data-page="service"] .map-search {
    width: 100%;
    max-width: none;
  }

  body[data-page="service"] .top-actions {
    display: flex;
    width: 100%;
    gap: 6px;
  }

  body[data-page="service"] .top-actions .chip-button {
    min-height: 36px;
    padding: 0 9px;
    font-size: 11px;
  }

  body[data-page="service"] .location-status {
    flex: 1 1 138px;
    min-width: 0;
    min-height: 36px;
    padding: 0 9px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body[data-page="service"] .route-panel.is-empty {
    display: none;
  }

  body[data-page="service"] .service-object-popup {
    width: min(340px, calc(100vw - 28px));
  }

  body[data-page="service"] .service-object-popup .leaflet-popup-content,
  body[data-page="service"] .service-object-popup .leaflet-popup-content-wrapper {
    width: min(340px, calc(100vw - 28px)) !important;
  }

  body[data-page="service"] .service-map-object-sheet {
    left: 10px;
    right: 10px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  body[data-page="service"] .route-panel {
    left: 10px;
    right: 10px;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 34vh;
  }

  body[data-page="service"] .map-actions {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    z-index: 1050;
    justify-content: center;
  }

  body[data-page="service"] .map-actions .button {
    flex: 1;
  }

  body[data-page="service"] .sidebar-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1250;
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: rgba(10, 14, 20, 0.96);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.26);
  }

  html[data-theme="light"] body[data-page="service"] .sidebar-footer {
    background: rgba(255, 255, 255, 0.96);
  }

  body[data-page="service"] .sidebar-footer-row {
    width: 100%;
    max-width: min(100%, 520px);
    margin: 0 auto;
    justify-content: space-between;
    gap: 8px;
  }

  body[data-page="service"] .theme-switcher {
    flex: 0 0 auto;
  }

  body[data-page="service"] .sidebar-nav {
    flex: 1;
    min-width: 0;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  body[data-page="service"] .service-project-nav {
    width: calc(100% - 20px);
    justify-content: space-between;
  }

  body[data-page="service"] .theme-button,
  body[data-page="service"] .quick-link {
    width: 40px;
    height: 40px;
  }

  body[data-page="service"] .theme-toggle {
    width: 40px;
    min-width: 40px;
  }
}

/* Shared RTOS palette. Keep this block last so the integrated service module
   follows the same dark/light scheme as the main map, detail and reports. */
body[data-page="service"] .service-module,
body[data-page="service"] .app-shell {
  background: var(--bg);
  color: var(--text);
}

body[data-page="service"] .service-right-panel,
body[data-page="service"] .modal,
body[data-page="service"] .modal-header,
body[data-page="service"] .modal-card,
body[data-page="service"] .form-card,
body[data-page="service"] .settings-card,
body[data-page="service"] .route-panel,
body[data-page="service"] .service-map-object-sheet-card,
body[data-page="service"] .service-object-popup .leaflet-popup-content-wrapper {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

body[data-page="service"] .search-field,
body[data-page="service"] .map-search,
body[data-page="service"] .filters select,
body[data-page="service"] .object-card,
body[data-page="service"] .saved-route-card,
body[data-page="service"] .button.secondary,
body[data-page="service"] .chip-button,
body[data-page="service"] .location-status,
body[data-page="service"] .left-panel-handle,
body[data-page="service"] .service-right-panel .task-row,
body[data-page="service"] .service-right-panel .history-list li,
body[data-page="service"] .equipment-form input,
body[data-page="service"] .equipment-form select,
body[data-page="service"] .equipment-form textarea,
body[data-page="service"] .settings-grid input {
  border-color: var(--line);
  background: var(--panel-alt);
  color: var(--text);
}

body[data-page="service"] .service-map-area {
  border-color: var(--line);
  background: var(--bg);
}

body[data-page="service"] .service-project-nav,
body[data-page="service"] .sidebar-footer {
  border-color: var(--line);
  background: var(--map-overlay-bg);
  color: var(--text);
  box-shadow: var(--map-overlay-shadow);
}

body[data-page="service"] .theme-button,
body[data-page="service"] .quick-link,
body[data-page="service"] .service-view-tabs .mini-tag {
  border-color: var(--line);
  background: var(--panel-alt);
  color: var(--muted);
}

body[data-page="service"] .theme-button:hover,
body[data-page="service"] .quick-link:hover,
body[data-page="service"] .theme-button.is-active,
body[data-page="service"] .quick-link.is-current,
body[data-page="service"] .service-view-tabs .mini-tag:hover,
body[data-page="service"] .service-view-tabs .mini-tag.is-active {
  border-color: rgba(84, 199, 176, 0.58);
  background: rgba(84, 199, 176, 0.16);
  color: var(--text);
}

body[data-page="service"] .button.primary,
body[data-page="service"] .button.search {
  border-color: rgba(84, 199, 176, 0.64);
  background: var(--accent);
  color: #061217;
}

body[data-page="service"] .button.ghost {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

body[data-page="service"] input,
body[data-page="service"] select,
body[data-page="service"] textarea,
body[data-page="service"] .search-field input,
body[data-page="service"] .map-search input {
  color: var(--text);
}

body[data-page="service"] input::placeholder,
body[data-page="service"] .object-copy small,
body[data-page="service"] .panel-header span,
body[data-page="service"] .compact-toggle,
body[data-page="service"] .empty-list,
body[data-page="service"] .empty-note,
body[data-page="service"] .right-panel small,
body[data-page="service"] .meta-line,
body[data-page="service"] .service-right-panel p,
body[data-page="service"] .service-right-panel small,
body[data-page="service"] .service-right-panel .info-grid dt,
body[data-page="service"] .service-right-panel .task-row small,
body[data-page="service"] .service-right-panel .history-list small,
body[data-page="service"] .service-marker-popup-grid dt {
  color: var(--muted);
}

body[data-page="service"] .object-copy strong,
body[data-page="service"] .empty-list strong,
body[data-page="service"] .modal-card h2,
body[data-page="service"] .right-panel h2,
body[data-page="service"] .right-panel h3,
body[data-page="service"] .panel-header h1,
body[data-page="service"] .service-marker-popup-head strong,
body[data-page="service"] .service-marker-popup-grid dd {
  color: var(--text);
}

body[data-page="service"] .service-object-popup .leaflet-popup-tip {
  background: var(--panel);
}

html[data-theme="dark"] body[data-page="service"] .service-right-panel,
html[data-theme="dark"] body[data-page="service"] .modal,
html[data-theme="dark"] body[data-page="service"] .modal-header,
html[data-theme="dark"] body[data-page="service"] .modal-card,
html[data-theme="dark"] body[data-page="service"] .form-card,
html[data-theme="dark"] body[data-page="service"] .settings-card,
html[data-theme="dark"] body[data-page="service"] .route-panel,
html[data-theme="dark"] body[data-page="service"] .service-map-object-sheet-card,
html[data-theme="dark"] body[data-page="service"] .service-object-popup .leaflet-popup-content-wrapper,
html[data-theme="light"] body[data-page="service"] .service-right-panel,
html[data-theme="light"] body[data-page="service"] .modal,
html[data-theme="light"] body[data-page="service"] .modal-header,
html[data-theme="light"] body[data-page="service"] .modal-card,
html[data-theme="light"] body[data-page="service"] .form-card,
html[data-theme="light"] body[data-page="service"] .settings-card,
html[data-theme="light"] body[data-page="service"] .route-panel,
html[data-theme="light"] body[data-page="service"] .service-map-object-sheet-card,
html[data-theme="light"] body[data-page="service"] .service-object-popup .leaflet-popup-content-wrapper {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

html[data-theme="dark"] body[data-page="service"] .search-field,
html[data-theme="dark"] body[data-page="service"] .map-search,
html[data-theme="dark"] body[data-page="service"] .filters select,
html[data-theme="dark"] body[data-page="service"] .object-card,
html[data-theme="dark"] body[data-page="service"] .saved-route-card,
html[data-theme="dark"] body[data-page="service"] .button.secondary,
html[data-theme="dark"] body[data-page="service"] .chip-button,
html[data-theme="dark"] body[data-page="service"] .location-status,
html[data-theme="dark"] body[data-page="service"] .left-panel-handle,
html[data-theme="dark"] body[data-page="service"] .service-right-panel .task-row,
html[data-theme="dark"] body[data-page="service"] .service-right-panel .history-list li,
html[data-theme="dark"] body[data-page="service"] .equipment-form input,
html[data-theme="dark"] body[data-page="service"] .equipment-form select,
html[data-theme="dark"] body[data-page="service"] .equipment-form textarea,
html[data-theme="dark"] body[data-page="service"] .settings-grid input,
html[data-theme="light"] body[data-page="service"] .search-field,
html[data-theme="light"] body[data-page="service"] .map-search,
html[data-theme="light"] body[data-page="service"] .filters select,
html[data-theme="light"] body[data-page="service"] .object-card,
html[data-theme="light"] body[data-page="service"] .saved-route-card,
html[data-theme="light"] body[data-page="service"] .button.secondary,
html[data-theme="light"] body[data-page="service"] .chip-button,
html[data-theme="light"] body[data-page="service"] .location-status,
html[data-theme="light"] body[data-page="service"] .left-panel-handle,
html[data-theme="light"] body[data-page="service"] .service-right-panel .task-row,
html[data-theme="light"] body[data-page="service"] .service-right-panel .history-list li,
html[data-theme="light"] body[data-page="service"] .equipment-form input,
html[data-theme="light"] body[data-page="service"] .equipment-form select,
html[data-theme="light"] body[data-page="service"] .equipment-form textarea,
html[data-theme="light"] body[data-page="service"] .settings-grid input {
  border-color: var(--line);
  background: var(--panel-alt);
  color: var(--text);
}
