*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --tm-primary: rgba(56, 189, 248, 0.18);
  --tm-primary-border: rgba(56, 189, 248, 0.35);
  --tm-primary-hover: rgba(56, 189, 248, 0.24);
  --tm-primary-hover-border: rgba(56, 189, 248, 0.55);

  --tm-secondary: rgba(148, 163, 184, 0.12);
  --tm-secondary-border: rgba(148, 163, 184, 0.30);

  --tm-bg-start: #101828;
  --tm-bg-end: #020617;
  --tm-card-start: #1f2937;
  --tm-card-end: #020617;
  --tm-header-bg-a: rgba(15, 23, 42, 0.9);
  --tm-header-bg-b: rgba(15, 23, 42, 0.5);

  --tm-nav-border: rgba(148, 163, 184, 0.35);
  --tm-nav-bg: rgba(2, 6, 23, 0.35);
  --tm-nav-active-border: rgba(56, 189, 248, 0.5);
  --tm-nav-active-bg: rgba(56, 189, 248, 0.15);
  --tm-nav-active-text: #e0f2fe;

  --tm-text-strong: #f9fafb;
  --tm-text: #e5e7eb;

  --tm-bg-image: none;
  --tm-bg-image-opacity: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, var(--tm-bg-start), var(--tm-bg-end));
  color: var(--tm-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--tm-bg-image);
  background-size: cover;
  background-position: center;
  opacity: var(--tm-bg-image-opacity);
  pointer-events: none;
  z-index: -1;
}

/* =========================
   Auth pages (login/register)
   Scoped to .auth-body so it
   won't affect dashboard UI.
   ========================= */

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-main {
  width: 100%;
  max-width: 980px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  background: radial-gradient(circle at top left, rgba(31, 41, 55, 0.65), rgba(2, 6, 23, 0.95));
}

.auth-panel {
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  position: relative;
  min-height: 520px;
}

.auth-panel--left {
  color: #ecfeff;
  background:
    radial-gradient(900px 520px at 15% 15%, rgba(56, 189, 248, 0.28), transparent 60%),
    linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(34, 211, 238, 0.10)),
    linear-gradient(180deg, rgba(15, 23, 42, 0.25), rgba(2, 6, 23, 0.35));
  border-right: 1px solid rgba(148, 163, 184, 0.22);
}

.auth-panel--left::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(236, 254, 255, 0.10) 0 2px, transparent 2px 100%),
    radial-gradient(circle at 70% 65%, rgba(236, 254, 255, 0.08) 0 2px, transparent 2px 100%);
  background-size: 220px 220px, 240px 240px;
  opacity: 0.65;
  pointer-events: none;
}

.auth-panel--right {
  background: radial-gradient(circle at top left, #111827, #020617);
}

.auth-kicker {
  font-size: 0.9rem;
  color: rgba(224, 242, 254, 0.85);
}

.auth-hero {
  font-size: 2.1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0;
  position: relative;
  z-index: 1;
}

.auth-hero-sub {
  margin: 0;
  color: rgba(224, 242, 254, 0.85);
  line-height: 1.5;
  max-width: 28rem;
  position: relative;
  z-index: 1;
}

.auth-side-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  position: relative;
  z-index: 1;
}

.auth-ghost-btn {
  background: rgba(2, 6, 23, 0.18);
  color: #ecfeff;
  border: 1px solid rgba(236, 254, 255, 0.45);
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.auth-ghost-btn:hover {
  background: rgba(2, 6, 23, 0.28);
  border-color: rgba(236, 254, 255, 0.62);
}

.auth-ghost-btn:active {
  transform: translateY(1px);
}

.auth-title {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0;
  color: #9ca3af;
  line-height: 1.45;
}

.auth-form {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.85rem;
}

.auth-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.auth-input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.55);
  color: #f9fafb;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.auth-input::placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.auth-input:focus {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14);
}

.auth-error {
  background: rgba(239, 68, 68, 0.13);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fecaca;
  border-radius: 0.9rem;
  padding: 0.75rem 0.85rem;
  line-height: 1.4;
}

.auth-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.auth-footer {
  margin-top: 1.15rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.auth-link {
  color: #7dd3fc;
  text-decoration: none;
  font-weight: 650;
}

.auth-link:hover {
  text-decoration: underline;
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-panel {
    min-height: unset;
  }
  .auth-panel--left {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }
}

.header {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  backdrop-filter: blur(12px);
  background: linear-gradient(to right, var(--tm-header-bg-a), var(--tm-header-bg-b));
}

.header h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--tm-text-strong);
}

.top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.top-nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #e5e7eb;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--tm-nav-border);
  background: var(--tm-nav-bg);
  font-size: 0.9rem;
  font-weight: 600;
}

.top-nav-tab-active,
.top-nav-tab:hover {
  border-color: var(--tm-nav-active-border);
  background: var(--tm-nav-active-bg);
  color: var(--tm-nav-active-text);
}

.main {
  flex: 1;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Home page: wireframe section should fill the viewport area */
.main--home {
  padding: 0;
  gap: 0;
}

.top-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1.1fr);
  gap: 1.5rem;
  align-items: stretch;
}

.top-row.top-row-detail {
  grid-template-columns: minmax(0, 2.2fr) minmax(340px, 1.4fr);
}

.card {
  background: radial-gradient(circle at top left, var(--tm-card-start), var(--tm-card-end));
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.75);
}

.card-map {
  padding: 0.5rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.card-map .card-title {
  padding: 0 0 0.5rem;
  margin: 0 0 0.25rem;
}

#map {
  width: 100%;
  height: 700px;
  border-radius: 0.75rem;
  overflow: hidden;
}

#detail-map {
  width: 100%;
  height: 440px; /* smaller map for detail page */
  border-radius: 0.75rem;
  overflow: hidden;
}

#mine-map {
  width: 100%;
  height: 560px;
  border-radius: 0.75rem;
  overflow: hidden;
}

button,
.btn {
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
}

button {
  font-family: inherit;
}

.btn-pill {
  background: var(--tm-primary);
  color: var(--tm-nav-active-text);
  border: 1px solid var(--tm-primary-border);
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-pill:hover {
  background: var(--tm-primary-hover);
  border-color: var(--tm-primary-hover-border);
}

.btn-pill:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--tm-secondary);
  color: var(--tm-text);
  border: 1px solid var(--tm-secondary-border);
}

/* Default all buttons to pill style unless overridden */
button:not(.btn-secondary) {
  background: var(--tm-primary);
  color: var(--tm-nav-active-text);
  border: 1px solid var(--tm-primary-border);
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
}

button.btn-secondary {
  background: var(--tm-secondary);
  color: var(--tm-text);
  border: 1px solid var(--tm-secondary-border);
}

/* Collapsible cards (used in Admin) */
.card-collapsible {
  padding: 0;
}

.card-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-collapsible > summary::-webkit-details-marker {
  display: none;
}

.card-collapsible > summary .card-title {
  margin: 0;
}

.card-collapsible-body {
  padding: 0 1.5rem 1.25rem;
}

/* Dashboard customization drag/drop list */
.dc-layout-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* Use the same item styling inside the canvas */
.dc-canvas-list .dc-layout-item {
  background: rgba(2, 6, 23, 0.35);
}

.dc-layout-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.35);
}

.dc-layout-item.dc-dragging {
  opacity: 0.7;
  border-color: rgba(56, 189, 248, 0.55);
}

.dc-layout-handle {
  font-weight: 900;
  opacity: 0.75;
  cursor: grab;
  user-select: none;
}

.dc-layout-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-layout-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Dashboard customization: split view + preview */
.dc-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1020px) {
  .dc-shell {
    grid-template-columns: 1fr;
  }
}

.dc-canvas {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 420px;
}

.dc-canvas-list {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.20);
  padding: 0.9rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.dc-editor {
  flex: 1 1 auto;
  min-height: 0;
}

.dc-editor-viewport {
  position: relative;
  width: 100%;
  height: 600px;
  max-height: 72vh;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.35);
}

.dc-editor-frame {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: auto;
  opacity: 0.95;
}

.dc-editor-overlays {
  position: absolute;
  inset: 0;
  pointer-events: none; /* enable per-box pointer events only */
}

.dc-box {
  position: absolute;
  border-radius: 0.85rem;
  border: 2px solid rgba(56, 189, 248, 0.75);
  background: rgba(56, 189, 248, 0.10);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  touch-action: none;
}

.dc-box.is-selected {
  border-color: rgba(34, 197, 94, 0.85);
  background: rgba(34, 197, 94, 0.10);
}

.dc-box .dc-box-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  cursor: move;
  user-select: none;
  color: rgba(226, 232, 240, 0.95);
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(2, 6, 23, 0.55);
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.dc-box .dc-box-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dc-box .dc-rot {
  height: 30px;
  padding: 0 0.4rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.45);
  color: rgba(226, 232, 240, 0.95);
}

.dc-box .dc-box-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  right: 8px;
  bottom: 8px;
  border-radius: 4px;
  background: rgba(226, 232, 240, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  cursor: nwse-resize;
}

/* Layout editor (drop-to-swap) */
.le-editing {
  outline: 2px dashed rgba(56, 189, 248, 0.55);
  outline-offset: 4px;
}

.le-dragging {
  opacity: 0.65;
  filter: saturate(0.9);
}

/* Swapy handle: clickable; customization iframe overrides with !important in layout-edit.js */
[data-swapy-item] [data-swapy-handle] {
  pointer-events: auto;
}

/* Stronger hit-blocking when preview class is present (backup if injected style is stale) */
html[data-layout-edit="1"] body.le-customization-preview main.main [data-dash-section],
html[data-layout-edit="1"] body.le-customization-preview main.main [data-dash-section] * {
  pointer-events: none !important;
}
html[data-layout-edit="1"] body.le-customization-preview main.main [data-swapy-handle] {
  pointer-events: auto !important;
}

/* ---------------- Mine schematic page ---------------- */
.mine-card {
  overflow: hidden;
}

.mine-map-card {
  padding: 0.75rem 0.9rem 0.9rem;
}

.mine-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

@media (max-width: 980px) {
  .mine-grid {
    grid-template-columns: 1fr;
  }
}

.mine-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  margin-top: 0.75rem;
}

.mine-leg-item {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  color: rgba(226, 232, 240, 0.92);
  font-weight: 650;
  font-size: 0.92rem;
}

.mine-chip {
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.32);
}

.mine-chip-above {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
}

.mine-chip-below {
  background: rgba(148, 163, 184, 0.12);
  border-style: dashed;
}

.mine-chip-press {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.45);
}

.mine-viewport {
  margin-top: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.22);
  overflow: hidden;
}

.mine-svg {
  width: 100%;
  height: auto;
  display: block;
}

.mine-section-bg {
  fill: rgba(2, 6, 23, 0.12);
}

.mine-section-divider {
  fill: none;
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 2;
}

.mine-section-card {
  fill: rgba(2, 6, 23, 0.22);
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 2;
}

.mine-section-title {
  fill: rgba(226, 232, 240, 0.90);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.mine-ground {
  fill: none;
  stroke: rgba(148, 163, 184, 0.55);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 8 10;
}

.mine-pipe {
  fill: none;
  stroke: rgba(226, 232, 240, 0.65);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#mineGlow);
}

.mine-pipe-flow {
  fill: none;
  stroke: rgba(56, 189, 248, 0.92);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  filter: url(#mineGlow);
  stroke-dasharray: 16 22;
  animation: mineFlowDash 1.15s linear infinite;
  animation-play-state: paused;
  opacity: 0;
}

.mine-set[data-flow="on"] .mine-pipe-flow-b {
  animation-play-state: running;
  opacity: 0.9;
}

.mine-set[data-pump="on"] .mine-pipe-flow-a {
  animation-play-state: running;
  opacity: 0.9;
}

.mine-set:not([data-pump="on"]) .mine-pipe-flow-a {
  animation-play-state: paused;
  opacity: 0;
}

.mine-pump {
  cursor: pointer;
}

.mine-pump-body {
  fill: rgba(2, 6, 23, 0.35);
  stroke: rgba(56, 189, 248, 0.55);
  stroke-width: 2;
  filter: url(#mineGlow);
}

.mine-pump-port {
  fill: rgba(56, 189, 248, 0.35);
  stroke: rgba(56, 189, 248, 0.65);
  stroke-width: 2;
}

.mine-pump-impeller {
  fill: rgba(56, 189, 248, 0.85);
  transform-origin: 0 0; /* overridden by SVG transform-box */
  transform-box: fill-box;
}

.mine-pump-label {
  fill: rgba(226, 232, 240, 0.92);
  font-weight: 900;
  font-size: 11px;
}

.mine-set[data-pump="on"] .mine-pump-body {
  stroke: rgba(34, 197, 94, 0.85);
}

.mine-set[data-pump="on"] .mine-pump-impeller {
  animation: minePumpSpin 0.85s linear infinite;
}

@keyframes minePumpSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes mineFlowDash {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -38;
  }
}

@keyframes diagramFlowDash {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -30;
  }
}

.mine-solenoid rect {
  stroke: rgba(15, 23, 42, 0.55);
  stroke-width: 2;
}

.mine-solenoid.is-open rect {
  fill: rgba(34, 197, 94, 0.85);
}

.mine-solenoid.is-closed rect {
  fill: rgba(239, 68, 68, 0.85);
}

.mine-solenoid text {
  fill: rgba(15, 23, 42, 0.95);
  font-weight: 950;
  font-size: 12px;
}

.mine-tank rect {
  stroke-width: 3;
}

.mine-tank-link {
  cursor: pointer;
}

.mine-tank-link:hover .mine-tank rect {
  stroke-width: 4;
}

.mine-tank-link:focus {
  outline: none;
}

.mine-above rect {
  fill: rgba(56, 189, 248, 0.10);
  stroke: rgba(56, 189, 248, 0.55);
}

.mine-below rect {
  fill: rgba(148, 163, 184, 0.10);
  stroke: rgba(148, 163, 184, 0.52);
  stroke-dasharray: 10 10;
}

.mine-label {
  fill: rgba(226, 232, 240, 0.95);
  font-weight: 800;
  font-size: 16px;
}

.mine-sub {
  fill: rgba(226, 232, 240, 0.78);
  font-weight: 700;
  font-size: 14px;
}

.mine-ps circle {
  fill: rgba(34, 197, 94, 0.14);
  stroke: rgba(34, 197, 94, 0.75);
  stroke-width: 3;
}

.mine-ps-tag {
  fill: rgba(226, 232, 240, 0.95);
  font-weight: 900;
  font-size: 14px;
}

.mine-ps-val {
  fill: rgba(226, 232, 240, 0.95);
  font-weight: 800;
  font-size: 10px;
}

.mine-meta {
  margin-top: 0.85rem;
}

/* ---------------- FNB diagram page ---------------- */
.diagram-main {
  gap: 1.25rem;
}

.diagram-canvas-card {
  padding: 0.9rem;
}

.diagram-title-row {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.diagram-mode-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.diagram-mode-btn {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.35);
  background: rgba(186, 230, 253, 0.85);
  color: rgba(15, 23, 42, 0.95);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.diagram-mode-btn:hover,
.diagram-mode-btn:focus {
  outline: none;
  border-color: rgba(14, 116, 144, 0.65);
  background: rgba(125, 211, 252, 0.95);
}

.diagram-mode-btn.is-auto {
  background: rgba(250, 204, 21, 0.9);
  border-color: rgba(161, 98, 7, 0.5);
}

.diagram-mode-meta {
  font-size: 11px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.72);
}

.diagram-svg.diagram-auto-mode [data-toggle="pump"],
.diagram-svg.diagram-auto-mode [data-toggle="valve"] {
  pointer-events: none;
  cursor: default;
  opacity: 0.92;
}

.diagram-viewport {
  margin-top: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #f8fafc;
  overflow-x: auto;
  overflow-y: hidden;
}

.diagram-svg {
  display: block;
  width: 100%;
  min-width: 980px;
  height: auto;
}

.diagram-panel-bg {
  fill: #f8fafc;
}

.diagram-site-label {
  fill: rgba(15, 23, 42, 0.98);
  font-size: 16px;
  font-weight: 900;
  text-decoration: underline;
}

.diagram-component-label {
  fill: rgba(15, 23, 42, 0.96);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.diagram-pipe {
  fill: none;
  stroke: rgba(15, 23, 42, 0.92);
  stroke-width: 4;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.diagram-pipe-flow {
  fill: none;
  stroke: rgba(34, 197, 94, 0.88);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 12 18;
  animation: diagramFlowDash 0.9s linear infinite;
  animation-play-state: paused;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.diagram-pipe-flow.is-flowing {
  opacity: 0.85;
  animation-play-state: running;
}

.diagram-tank rect:not(.diagram-tank-fill) {
  fill: url(#diagramTank);
  stroke: rgba(71, 85, 105, 0.7);
  stroke-width: 2;
}

.diagram-tank ellipse {
  fill: rgba(226, 232, 240, 0.66);
  stroke: rgba(71, 85, 105, 0.55);
  stroke-width: 1.6;
}

.diagram-tank-fill {
  fill: rgba(250, 204, 21, 0.82);
  stroke: rgba(161, 98, 7, 0.45);
  stroke-width: 1;
}

.diagram-tank-volume {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(71, 85, 105, 0.35);
  stroke-width: 1;
}

.diagram-tank-nozzle {
  fill: #e2e8f0;
  stroke: rgba(71, 85, 105, 0.78);
  stroke-width: 1.4;
}

.diagram-tank-label {
  fill: rgba(15, 23, 42, 0.86);
  font-size: 10px;
  font-weight: 900;
}

.diagram-tank-value {
  fill: rgba(15, 23, 42, 0.92);
  font-size: 10px;
  font-weight: 950;
}

.diagram-readout {
  fill: rgba(186, 230, 253, 0.9);
  stroke: rgba(15, 23, 42, 0.45);
  stroke-width: 1;
}

.diagram-readout-pct {
  fill: rgba(250, 204, 21, 0.92);
  stroke: rgba(161, 98, 7, 0.45);
  stroke-width: 1;
}

.diagram-tank-readouts {
  pointer-events: none;
}

.diagram-tank-readouts .diagram-readout-text,
.diagram-tank-readouts .diagram-tank-value {
  font-size: 8.5px;
  font-weight: 850;
}

.diagram-tank .diagram-tank-id-label {
  font-size: 9px;
  pointer-events: none;
}

.diagram-readout-text {
  fill: rgba(15, 23, 42, 0.96);
  font-size: 10px;
  font-weight: 850;
}

.diagram-flow-arrow {
  fill: rgba(15, 23, 42, 0.85);
}

.diagram-valve path {
  fill: none;
  stroke: rgba(226, 232, 240, 0.95);
  stroke-width: 4;
  stroke-linecap: round;
}

.diagram-valve,
.diagram-pump {
  cursor: pointer;
  outline: none;
}

.diagram-valve:hover rect,
.diagram-pump:hover rect,
.diagram-valve:focus rect,
.diagram-pump:focus rect {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 3;
}

.diagram-valve rect {
  stroke: rgba(15, 23, 42, 0.7);
  stroke-width: 1.5;
}

.diagram-valve.is-open rect {
  fill: rgba(34, 197, 94, 0.95);
}

.diagram-valve.is-closed rect {
  fill: rgba(239, 68, 68, 0.95);
}

.diagram-pump rect {
  stroke-width: 2;
  filter: url(#diagramGlow);
}

.diagram-pump circle {
  fill: rgba(248, 113, 113, 0.9);
  stroke: rgba(127, 29, 29, 0.65);
  stroke-width: 1.5;
}

.diagram-pump text {
  fill: rgba(254, 242, 242, 0.98);
  font-size: 10px;
  font-weight: 950;
}

.diagram-pump.is-on rect {
  fill: rgba(239, 68, 68, 0.92);
  stroke: rgba(254, 202, 202, 0.75);
}

.diagram-pump.is-off rect {
  fill: rgba(100, 116, 139, 0.9);
  stroke: rgba(203, 213, 225, 0.55);
}

.diagram-pump.is-off circle {
  fill: rgba(148, 163, 184, 0.72);
  stroke: rgba(51, 65, 85, 0.8);
}

.diagram-check-valve {
  fill: rgba(234, 179, 8, 0.88);
  stroke: rgba(113, 63, 18, 0.72);
  stroke-width: 1.5;
  filter: url(#diagramGlow);
}

.diagram-nrv {
  fill: rgba(250, 204, 21, 0.9);
  stroke: rgba(113, 63, 18, 0.8);
  stroke-width: 2;
}

.diagram-nrv-arrow {
  fill: rgba(239, 68, 68, 0.92);
  stroke: rgba(127, 29, 29, 0.7);
  stroke-width: 1;
}

.diagram-nrv-stop {
  stroke: rgba(15, 23, 42, 0.9);
  stroke-width: 2;
  stroke-linecap: round;
}

.diagram-terminal {
  fill: rgba(217, 70, 239, 0.7);
  stroke: rgba(240, 171, 252, 0.9);
  stroke-width: 2;
}

.diagram-legend-readout-pct {
  display: inline-block;
  width: 22px;
  height: 12px;
  border-radius: 3px;
  background: rgba(250, 204, 21, 0.92);
  border: 1px solid rgba(161, 98, 7, 0.45);
  vertical-align: middle;
}

.diagram-legend-readout-liters {
  display: inline-block;
  width: 22px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(71, 85, 105, 0.35);
  vertical-align: middle;
}

.diagram-legend-valve,
.diagram-legend-pump {
  display: inline-flex;
  width: 22px;
  height: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.diagram-legend-valve {
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.85);
}

.diagram-legend-pump {
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.85);
}

/* Theme modal */
.dc-theme-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.25rem;
}

@media (max-width: 980px) {
  .dc-theme-grid {
    grid-template-columns: 1fr;
  }
}

.dc-theme-wireframe {
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: radial-gradient(circle at top, var(--tm-bg-start), var(--tm-bg-end));
  padding: 0.9rem;
  min-height: 360px;
  overflow: hidden;
}

.dc-wf-header {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: radial-gradient(circle at top left, var(--tm-card-start), var(--tm-card-end));
}

.dc-wf-logo {
  width: 42px;
  height: 42px;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.35);
}

.dc-wf-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.dc-wf-pill {
  width: 64px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.22);
}

.dc-wf-btn {
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--tm-primary-border);
  background: var(--tm-primary);
}

.dc-wf-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.dc-wf-card {
  height: 78px;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: radial-gradient(circle at top left, var(--tm-card-start), var(--tm-card-end));
}

/* Make preview modal larger than default .modal */
.modal.dc-preview-modal-dialog {
  width: min(1920px, 99vw);
  max-height: 98vh;
}

.dc-preview-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden; /* prevent internal scrollbars */
}

.dc-preview-modal-iframe-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.dc-preview-modal-overlay {
  padding: 0.75rem;
}

.dc-preview-modal-viewport {
  position: relative;
  width: 100%;
  height: 82vh; /* explicit height so it can fit-to-screen */
  overflow: hidden; /* no scrollbars */
  background: rgba(2, 6, 23, 0.35);
  --dc-modal-scale: 0.82;
}

.dc-preview-modal-iframe {
  border: none;
  border-radius: 0;
  width: calc(100% / var(--dc-modal-scale));
  height: calc(100% / var(--dc-modal-scale));
  transform: scale(var(--dc-modal-scale));
  transform-origin: 0 0;
  background: transparent;
  pointer-events: none; /* static preview */
}

/* Color picker rows */
.dc-color-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.dc-color-row .dc-color-inputs {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
}

.dc-color {
  width: 52px;
  height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.75rem;
  background: rgba(2, 6, 23, 0.55);
  padding: 0.2rem;
}

.dc-color-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.detail-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.card-detail-bottom {
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
}

.tank-card.tank-card-detail .tank-card-body {
  justify-content: flex-start;
  gap: 1.5rem;
}

.tank-card.tank-card-detail .summary-pie {
  width: 180px;
  height: 180px;
}

.tank-card.tank-card-detail .contamination-circle {
  width: 90px;
  height: 90px;
}

.tank-card.tank-card-detail .pie-label {
  font-size: 2.1rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 9999;
}

.modal-overlay.modal-open {
  display: flex;
}

.modal {
  width: min(980px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  background: radial-gradient(circle at top left, #111827, #020617);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 1rem 1.25rem 1.25rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.dipchart-details {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.18);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
}

.dipchart-title {
  font-weight: 900;
  color: rgba(224, 242, 254, 0.95);
}

.dipchart-body {
  margin-top: 0.85rem;
}

.dipchart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}

.dipchart-dims {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 760px) {
  .dipchart-grid {
    grid-template-columns: 1fr;
  }
  .dipchart-dims {
    grid-template-columns: 1fr;
  }
}

.history-table-wrap {
  max-height: 68vh;
  overflow: auto;
  margin-top: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th,
.history-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  white-space: nowrap;
}

.history-table th {
  position: sticky;
  top: 0;
  background: rgba(2, 6, 23, 0.9);
  z-index: 1;
  font-weight: 700;
}

/* Tank detail: usage histogram */
.usage-histogram-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.usage-histogram-caption {
  font-weight: 800;
  color: rgba(224, 242, 254, 0.95);
}

.usage-timeline-btn {
  font-size: 0.8rem;
  padding: 0.6rem 0.9rem;
}

.usage-histogram-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.usage-gran-btn {
  font-size: 0.8rem;
  padding: 0.6rem 0.9rem;
}

.usage-gran-btn-active {
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(56, 189, 248, 0.16);
  color: #e0f2fe;
}

.usage-histogram-meta {
  margin: 0 0 0.75rem;
  color: #cbd5e1;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usage-histogram {
  width: 100%;
}

.usage-histogram-plot {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 0.5rem;
  align-items: stretch;
}

.usage-histogram-y-axis {
  position: relative;
  height: 360px;
  border-right: 1px solid rgba(148, 163, 184, 0.3);
  color: rgba(226, 232, 240, 0.85);
  font-size: 0.72rem;
}

.usage-y-tick {
  position: absolute;
  right: 0.35rem;
  transform: translateY(50%);
  line-height: 1;
  white-space: nowrap;
}

.usage-histogram-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.25rem 0;
  overflow-x: auto;
  height: 360px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background-image: linear-gradient(
    to top,
    rgba(148, 163, 184, 0.14) 1px,
    transparent 1px
  );
  background-size: 100% 36px;
  background-position: bottom;
  border-radius: 0.6rem;
}

.usage-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 40px;
  height: 100%;
}

.usage-bar-wrap {
  position: relative;
  width: 24px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.usage-bar {
  width: 24px;
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  height: 0%;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.usage-bar-up {
  background: linear-gradient(to top, rgba(34, 197, 94, 0.95), rgba(34, 197, 94, 0.40));
  border-color: rgba(34, 197, 94, 0.55);
}

.usage-bar-down {
  background: linear-gradient(to top, rgba(239, 68, 68, 0.95), rgba(239, 68, 68, 0.40));
  border-color: rgba(239, 68, 68, 0.55);
}

.usage-bar-flat {
  background: linear-gradient(to top, rgba(245, 158, 11, 0.95), rgba(245, 158, 11, 0.40));
  border-color: rgba(245, 158, 11, 0.55);
}

.usage-bar-empty {
  border: none;
  background: transparent;
  box-shadow: none;
}

.usage-bar-fabricated {
  opacity: 0.55;
  filter: saturate(0.85);
}

.usage-bar-point {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 4px;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #0b1220;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.usage-bar-label {
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.85);
  line-height: 1;
  user-select: none;
}

/* Tank detail bottom layout */
.detail-bottom-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.card-detail-left {
  min-width: 0;
}

.card-usage-histogram {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-usage-histogram-full {
  margin-top: 1.5rem;
}

.card-detail-empty {
  min-height: 220px;
}

.report-modal-dialog {
  width: min(760px, 96vw);
}

.monthly-fuel-modal-dialog {
  width: min(920px, 96vw);
}

@media (max-width: 860px) {
  .detail-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.monthly-fuel-card .info-line {
  font-size: 1.05rem;
}

.monthly-fuel-card .info-line strong {
  font-size: 1.25rem;
}

.monthly-day-pie-row {
  margin-top: 0.4rem;
  display: flex;
  justify-content: center;
}

.monthly-day-pie {
  width: 115px;
  height: 115px;
}

.monthly-day-pie .pie-inner {
  width: 68%;
  height: 68%;
}

.monthly-day-pie-inner {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: rgba(226, 232, 240, 0.95);
}

.info-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.info-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.info-line strong {
  font-weight: 600;
}

.info-meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1.25rem;
}

.tank-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top left, #020617, #020617);
  overflow: visible;
}

.tank-card-header {
  font-size: 0.9rem;
  font-weight: 500;
  color: #e5e7eb;
}

.tank-card-body {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.6rem;
}

/* legend removed from UI: keep rule small for backward compatibility */
.tank-card-legend {
  display: none;
}

.summary-pie {
  width: 115px;
  height: 115px;
  flex: 0 0 auto;
}

.pie-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.tank-liters {
  font-size: 1.4rem; /* similar feel to the % label */
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1;
}

.contamination-circle {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #22c55e; /* default clean */
  box-shadow: 0 0 25px rgba(15, 23, 42, 0.9);
}

.contamination-circle-alert {
  background: #ef4444;
}

.status-indicator {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #020617;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.7);
}

.status-indicator-clean {
  background: #22c55e;
}

.status-indicator-contaminated {
  background: #ef4444;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #e5e7eb;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title-row .card-title {
  margin-bottom: 0;
}

.monthly-overview .info-line {
  font-size: 1.05rem;
}

.monthly-overview .info-line strong {
  font-size: 1.25rem;
}

.tank-visual {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.pie-wrapper {
  width: 190px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pie {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#1f2937 0 0, #1f2937 0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.4s ease-out;
}

.pie-inner {
  width: 68%;
  height: 68%;
  border-radius: 50%;
  background: radial-gradient(circle at top, #020617, #020617 40%, #111827 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 25px rgba(15, 23, 42, 0.9);
}

.pie-label {
  font-size: 1.7rem;
  font-weight: 600;
  color: #f9fafb;
}

/* Monthly fuel day donuts must not inherit .pie 100% sizing */
.monthly-day-pie-row {
  min-height: 180px;
}

.pie.monthly-day-pie {
  width: 180px;
  height: 180px;
  flex: 0 0 auto;
}

/* legacy legend styles (no longer used visually) */

.status {
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.status-unknown {
  background: rgba(55, 65, 81, 0.7);
  color: #e5e7eb;
}

.status-unknown::before {
  background: #9ca3af;
}

.status-clean {
  background: rgba(22, 163, 74, 0.15);
  color: #bbf7d0;
}

.status-clean::before {
  background: #22c55e;
}

.status-contaminated {
  background: rgba(239, 68, 68, 0.15);
  color: #fecaca;
}

.status-contaminated::before {
  background: #ef4444;
}

.connection {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.connection::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 0.3rem;
}

.connection-connected {
  color: #bbf7d0;
}

.connection-connected::before {
  background: #22c55e;
}

.connection-disconnected {
  color: #fecaca;
}

.connection-disconnected::before {
  background: #ef4444;
}

.hint {
  font-size: 0.8rem;
  color: #9ca3af;
  max-width: 32rem;
}

/* Home */
.home-logo-placeholder {
  width: 100%;
  height: 260px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  color: #9ca3af;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
  background: rgba(2, 6, 23, 0.2);
}

.home-logo-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0;
}

.home-logo-img {
  max-width: 320px;
  max-height: 140px;
  width: auto;
  height: auto;
  display: block;
}

/* Home (wireframe) */
.home-home-wireframe-card {
  min-height: 720px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 1.25rem;
}

.home-home-wireframe-inner {
  width: 100%;
  height: 100%;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.home-home-wireframe-logo {
  width: clamp(220px, 32vw, 700px);
  height: clamp(220px, 32vw, 700px);
  border: 2px solid rgba(148, 163, 184, 0.55);
  border-radius: 1.05rem;
  background: rgba(2, 6, 23, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.home-home-wireframe-logo-img {
  max-width: 88%;
  max-height: 88%;
  width: auto;
  height: auto;
  display: block;
}

.home-home-wireframe-right {
  flex: 1;
  height: clamp(220px, 32vw, 700px);
  border-radius: 1.05rem;
  border: 2px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.08);
}

/* Home motto wireframe */
.home-motto-card {
  padding: 0;
}

.home-motto-outer {
  width: min(980px, 92vw);
  height: min(520px, 62vw);
  border-radius: 64px;
  border: 2px solid rgba(2, 6, 23, 0.9);
  background: rgba(148, 197, 234, 0.35);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-motto-inner {
  width: 86%;
  height: 72%;
  border-radius: 44px;
  border: 2px solid rgba(2, 6, 23, 0.9);
  background-color: rgba(205, 232, 246, 0.88);
  background-image: url("assets/logo_1.jpeg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 260px 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.home-motto-text {
  position: relative;
  z-index: 1;
  color: #0b1220;
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 800;
  max-width: 32rem;
}

.home-motto-text::after {
  content: "";
  display: block;
  height: 12px;
}

.home-motto-inner::before {
  /* Keep the logo "opaque" while still letting text stay readable */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

@media (max-width: 780px) {
  .home-motto-outer {
    padding: 18px;
    border-radius: 44px;
  }
  .home-motto-inner {
    border-radius: 34px;
    background-size: 200px 200px;
  }
  .home-motto-text {
    font-size: 1.1rem;
  }
}

/* Home landing page (legacy styles; not used by current home.html) */
.home-landing-body {
  min-height: 100vh;
  background: #f1f5f9;
  color: #0f172a;
}

.home-hero-art {
  position: relative;
  flex: 1;
  min-height: 720px;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background-color: #0b1b3a; /* fallback if images missing */
  background-image: url("assets/home_bg.png");
  background-size: cover;
  background-position: center;
}

.home-hero-art::after {
  /* Darken/neutralize so the text reads well even if background is bright */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top,
    rgba(2, 6, 23, 0.25),
    rgba(2, 6, 23, 0.75)
  );
  pointer-events: none;
  z-index: 0;
}

.home-welcome-card {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  padding: 2.25rem 2rem;
  border-radius: 1rem;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.25);
  backdrop-filter: blur(6px);
}

.home-welcome-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("assets/home_text_bg.png");
  background-size: cover;
  background-position: center;
  opacity: 0.3; /* ~30% visible */
  z-index: 0;
  pointer-events: none;
}

.home-welcome-title,
.home-welcome-subtitle,
.home-welcome-btn {
  position: relative;
  z-index: 1;
}

.home-welcome-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  letter-spacing: 0.12em;
  font-weight: 900;
  color: #f8fafc;
}

/* Home brand card (wireframe) */
.home-brand-card {
  flex: 1;
  width: 100%;
  min-height: 100%;
  border-radius: 84px;
  border: 3px solid rgba(2, 6, 23, 0.9);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;

  /* Background image for this section */
  background-image: url("assets/home_backround.webp"), url("assets/home_backround.png"), url("assets/home_backround.jpg");
  background-size: cover;
  background-position: center;
}

.home-brand-card::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Keep wireframe look (mostly white) while showing the image behind */
  background: rgba(255, 255, 255, 0.35);
  z-index: 0;
}

.home-brand-content {
  text-align: center;
  position: relative;
  z-index: 1;
}

.home-brand-title {
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #0b1220;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.home-brand-slogan {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 600;
  color: rgba(11, 18, 32, 0.92);
  line-height: 1.3;
  max-width: 42rem;
  margin: 0 auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.home-welcome-subtitle {
  margin: 1rem auto 1.5rem;
  max-width: 48rem;
  font-size: 0.95rem;
  color: rgba(229, 231, 235, 0.85);
  line-height: 1.6;
}

.home-landing-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.25rem;
}

.home-landing-nav {
  max-width: 1200px;
  margin: 0 auto;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.home-nav-logo {
  width: 170px;
  height: 44px;
  border: 1px dashed #94a3b8;
  border-radius: 0.45rem;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  display: grid;
  place-items: center;
  background: #f8fafc;
}

.home-nav-logo-img {
  max-width: 140px;
  max-height: 30px;
  width: auto;
  height: auto;
  display: block;
}

.home-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.home-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #334155;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.home-nav-link:hover,
.home-nav-link-active {
  border-color: #cbd5e1;
  color: #0f172a;
  background: #f8fafc;
}

.home-hero {
  flex: 1;
  min-height: calc(100vh - 78px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    linear-gradient(180deg, rgba(14, 116, 216, 0.25), rgba(15, 23, 42, 0.45)),
    linear-gradient(135deg, #60a5fa 0%, #2563eb 45%, #0f172a 100%);
}

.home-hero-content {
  width: min(920px, 94vw);
  text-align: center;
  color: #ffffff;
}

.home-hero-title {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3.3rem);
  letter-spacing: 0.18em;
  font-weight: 800;
}

.home-hero-subtitle {
  margin: 1rem auto 2rem;
  max-width: 760px;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
}

.home-cta-btn {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 2px;
  min-width: 190px;
  height: 48px;
  padding: 0 1.1rem;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
}

.home-cta-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 780px) {
  .home-landing-nav {
    height: auto;
    padding: 0.85rem 0;
    flex-direction: column;
  }
  .home-nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
  .home-hero {
    min-height: calc(100vh - 130px);
  }
}

/* Settings - FAQ accordion */
.faq-card {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.faq-modal-dialog {
  width: min(760px, 96vw);
}

/* Settings - Account Settings sizing */
.account-settings-card {
  max-width: 980px;
  padding: 2rem 2.25rem;
}

.help-card {
  max-width: 980px;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

/* Change Password modal sizing */
.change-password-modal-dialog {
  width: min(720px, 96vw);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.faq-item {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.18);
  border-radius: 0.85rem;
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 750;
  color: rgba(224, 242, 254, 0.95);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-weight: 900;
  color: rgba(56, 189, 248, 0.95);
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-answer {
  padding: 0 1rem 1rem 1rem;
  color: rgba(229, 231, 235, 0.92);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Report date/time picker (custom modal) */
.report-dt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.dt-picker-dialog {
  width: min(520px, 96vw);
}

.dt-picker {
  display: grid;
  gap: 0.85rem;
}

.dt-picker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dt-picker-selected {
  font-weight: 800;
  color: rgba(224, 242, 254, 0.95);
  line-height: 1.2;
}

.dt-picker-monthbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.dt-picker-month {
  text-align: center;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.dt-picker-nav {
  padding: 0.7rem 0.95rem;
  min-width: 52px;
}

.dt-picker-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  color: rgba(203, 213, 225, 0.9);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  user-select: none;
}

.dt-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.dt-day {
  height: 44px;
  border-radius: 0.85rem;
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #e5e7eb;
  font-weight: 800;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}

.dt-day:hover:not(.dt-day-out) {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
}

.dt-day-out {
  opacity: 0.25;
}

.dt-day-today {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
}

.dt-day-selected {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.65);
  color: #e0f2fe;
}

.dt-day-range-start,
.dt-day-range-end {
  background: rgba(56, 189, 248, 0.28);
  border-color: rgba(56, 189, 248, 0.85);
  color: #e0f2fe;
}

.dt-day-inrange {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}

.hist-range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}

@media (max-width: 540px) {
  .hist-range-fields {
    grid-template-columns: 1fr;
  }
}

.dt-picker-time {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.25rem;
}

.dt-picker-timeval {
  text-align: center;
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
}

.dt-picker-timehint {
  color: rgba(203, 213, 225, 0.85);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.timeline-quick {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.25rem;
}

.timeline-quick-btn,
.hist-quick-btn {
  padding: 0.65rem 0.95rem;
  font-size: 0.85rem;
}

/* Histogram x-axis label (time + small date) */
.usage-bar-label {
  display: grid;
  gap: 0.15rem;
  justify-items: center;
}

.usage-bar-label-main {
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.9);
  line-height: 1;
  user-select: none;
}

.usage-bar-label-sub {
  font-size: 0.7rem;
  color: rgba(203, 213, 225, 0.75);
  line-height: 1;
  user-select: none;
}

/* =========================
   Mpact pages
   ========================= */

.mpact-card {
  width: 100%;
  text-align: left;
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.92), rgba(2, 6, 23, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.25rem;
  padding: 1rem 1.05rem;
  color: var(--tm-text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.mpact-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(2, 6, 23, 0.92));
}

.mpact-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.mpact-name {
  font-weight: 900;
  letter-spacing: 0.01em;
  color: var(--tm-text-strong);
  font-size: 1.05rem;
}

.mpact-meta {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: rgba(203, 213, 225, 0.8);
}

.mpact-card-badges {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mpact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.10);
  color: rgba(226, 232, 240, 0.92);
  white-space: nowrap;
}

.mpact-chip--live {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
  color: rgba(187, 247, 208, 0.95);
}

.mpact-chip--inactive {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.08);
  color: rgba(203, 213, 225, 0.85);
}

.mpact-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.10);
  color: rgba(226, 232, 240, 0.92);
  white-space: nowrap;
}

.mpact-badge--ready {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.14);
  color: rgba(187, 247, 208, 0.95);
}

.mpact-badge--faulty {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: rgba(254, 243, 199, 0.95);
}

.mpact-badge--emergency {
  border-color: rgba(239, 68, 68, 0.50);
  background: rgba(239, 68, 68, 0.16);
  color: rgba(254, 202, 202, 0.95);
}

.mpact-badge--unknown {
  opacity: 0.9;
}

.mpact-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.mpact-metrics--card {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .mpact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mpact-metrics--card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mpact-metric {
  background: rgba(2, 6, 23, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  padding: 0.7rem 0.75rem;
}

.mpact-metric-label {
  font-size: 0.75rem;
  font-weight: 900;
  color: rgba(203, 213, 225, 0.8);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mpact-metric-value {
  margin-top: 0.25rem;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--tm-text-strong);
}

.mpact-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.mpact-open {
  font-weight: 900;
  color: rgba(56, 189, 248, 0.95);
}

.mpact-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: stretch;
}

.mpact-top-row--forms-only {
  grid-template-columns: 1fr;
}

.mpact-top-row--forms-only #mpact-register-panel {
  display: none !important;
}

@media (max-width: 900px) {
  .mpact-top-row {
    grid-template-columns: 1fr;
  }
}

.mpact-register-card,
.mpact-job-form-card {
  margin-bottom: 0;
  min-height: 0;
}

.mpact-register-card {
  margin-bottom: 0;
}

.mpact-register-title {
  font-size: 1.05rem;
}

.mpact-register-hint {
  margin-top: 0.35rem;
  margin-bottom: 0.65rem;
}

.mpact-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
}

.mpact-register-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.mpact-register-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: rgba(203, 213, 225, 0.85);
}

.mpact-register-input {
  flex: 1 1 180px;
  min-width: 0;
  max-width: 420px;
}

.mpact-register-submit {
  flex-shrink: 0;
}

.mpact-register-msg {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: rgba(125, 211, 252, 0.95);
  min-height: 1.25rem;
}

.mpact-job-form-hint {
  margin-top: 0.35rem;
  margin-bottom: 0.65rem;
}

.mpact-job-form-hint a {
  color: rgba(56, 189, 248, 0.95);
  text-decoration: underline;
}

.mpact-job-form-root {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.mpact-job-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mpact-job-form-field label.auth-label {
  margin: 0;
}

.mpact-job-form-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.mpact-job-form-checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.92);
  cursor: pointer;
}

.mpact-job-form-radio-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.mpact-job-form-radio-row label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.mpact-job-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.mpact-job-form-msg {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: rgba(125, 211, 252, 0.95);
  min-height: 1.25rem;
}

.mpact-job-form-msg--error {
  color: rgba(248, 113, 113, 0.95);
}

.mpact-forms-config-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.mpact-forms-list-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mpact-forms-list-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.mpact-forms-list-row .auth-input {
  flex: 1;
  min-width: 0;
}

.mpact-forms-history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.mpact-forms-history-table th,
.mpact-forms-history-table td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  vertical-align: top;
}

.mpact-forms-history-table th {
  color: rgba(203, 213, 225, 0.85);
  font-weight: 800;
}

.mpact-form-status {
  display: inline-flex;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.mpact-form-status--hold {
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.15);
  color: rgba(253, 230, 138, 0.95);
}

.mpact-form-status--completed {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
  color: rgba(187, 247, 208, 0.95);
}

.email-pipeline-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.email-pipeline-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  cursor: pointer;
  list-style: none;
}

.email-pipeline-summary::-webkit-details-marker {
  display: none;
}

.email-pipeline-status {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.email-pipeline-status--ok {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
  color: rgba(187, 247, 208, 0.95);
}

.email-pipeline-status--skip {
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.15);
  color: rgba(253, 230, 138, 0.95);
}

.email-pipeline-status--fail {
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: rgba(254, 202, 202, 0.95);
}

.email-pipeline-steps {
  margin: 0.35rem 0 0 1.1rem;
  padding: 0;
  list-style: decimal;
}

.email-pipeline-step {
  margin: 0.35rem 0;
  font-size: 0.88rem;
}

.email-pipeline-step-badge {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
  margin-left: 0.25rem;
}

.email-pipeline-step-detail {
  display: block;
  margin-top: 0.15rem;
  color: rgba(148, 163, 184, 0.95);
  font-size: 0.82rem;
}

.email-pipeline-step-at {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
}

.email-pipeline-error {
  color: rgba(254, 202, 202, 0.95);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.mpact-forms-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 140px;
}

.mpact-card-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-shrink: 0;
}

.mpact-card-delete {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.mpact-card:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.mpact-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 980px) {
  .mpact-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .mpact-detail-grid {
    grid-template-columns: 1fr;
  }
}

.mpact-detail-item {
  background: rgba(2, 6, 23, 0.26);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1.05rem;
  padding: 0.85rem 0.9rem;
}

.mpact-detail-value {
  margin-top: 0.25rem;
  font-size: 1.25rem;
  font-weight: 950;
  color: var(--tm-text-strong);
}

.mpact-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem 0.15rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.75rem;
  min-width: 130px;
}

.mpact-gauge-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.92);
  margin-bottom: 0.1rem;
}

.mpact-gauge-svg {
  width: 100%;
  max-width: 140px;
  height: auto;
  display: block;
}

.mpact-gauge-track,
.mpact-gauge-fill {
  fill: none;
}

.mpact-gauge-scale {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  width: 100%;
  max-width: 140px;
  margin-top: 0.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.88);
}

.mpact-gauge-scale span:first-child {
  text-align: left;
}

.mpact-gauge-scale span:last-child {
  text-align: right;
}

.mpact-gauge-value {
  font-size: 0.95rem;
  font-weight: 900;
  color: #f8fafc;
  text-align: center;
  padding: 0 0.25rem;
}

.mpact-metric--gauge {
  grid-column: span 1;
}

.mpact-metric--gauge-only {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.mpact-device-name-row {
  flex: 1;
  min-width: 0;
}

.mpact-history-dialog {
  border: none;
  border-radius: 1rem;
  padding: 0;
  max-width: min(960px, 96vw);
  width: 96vw;
  background: var(--tm-card-bg, #0f172a);
  color: var(--tm-text, #e2e8f0);
}

.mpact-history-dialog::backdrop {
  background: rgba(2, 6, 23, 0.65);
}

.mpact-history-dialog-inner {
  padding: 1.25rem;
}

.mpact-detail-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .mpact-detail-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mpact geofence editor */
.mpact-geofence-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  align-items: start;
}

/* Mpact map device filter sidebar */
.mpact-map-device-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  max-height: 420px;
  overflow: auto;
  padding-right: 0.25rem;
}

.mpact-map-device-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0.25rem;
  border-radius: 0.5rem;
}

.mpact-map-device-item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.mpact-map-device-item input[type="checkbox"] {
  flex: 0 0 auto;
}

.mpact-map-legend {
  display: grid;
  gap: 0.25rem;
}

.mpact-map-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  margin-right: 0.5rem;
  vertical-align: middle;
}

.mpact-map-legend-dot--inside {
  background: #22c55e;
}

.mpact-map-legend-dot--outside {
  background: #ef4444;
}

/* Company geofence assignment panel (geofence.html) */
.geofence-company-panel {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.85rem;
  background: rgba(2, 6, 23, 0.18);
  overflow: hidden;
}

.geofence-company-list {
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
}

.geofence-company-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.45);
  flex-wrap: nowrap;
}

.geofence-company-row-title {
  font-weight: 900;
  color: rgba(248, 250, 252, 0.95);
}

.geofence-company-row-meta {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.78);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geofence-company-editor {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding: 0.85rem;
  background: rgba(2, 6, 23, 0.22);
}

.geofence-company-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.geofence-company-device-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem 0.75rem;
  padding: 0.25rem 0;
}

.geofence-company-device-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  padding: 0.25rem 0.25rem;
  border-radius: 0.5rem;
}

.geofence-company-device-item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.geofence-company-panel--retracted .geofence-company-editor {
  display: none !important;
}


@media (max-width: 900px) {
  .mpact-geofence-layout {
    grid-template-columns: 1fr;
  }
}

.mpact-geofence-map {
  height: 480px;
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--tm-card-border, rgba(148, 163, 184, 0.35));
  z-index: 0;
}

.mpact-geofence-draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.mpact-geofence-hint {
  margin-top: 0.5rem;
}

.mpact-geofence-zone-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mpact-geofence-zone-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.35rem 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--tm-card-border, rgba(148, 163, 184, 0.2));
}

.mpact-geofence-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  grid-row: span 2;
  align-self: center;
}

.mpact-geofence-zone-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.mpact-geofence-zone-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mpact-geofence-zone-actions .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.mpact-geofence-save-panel {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--tm-card-border, rgba(148, 163, 184, 0.25));
}

.mpact-geofence-msg {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.mpact-geofence-msg--err {
  color: #f87171;
}

.mpact-geofence-pin-label {
  background: rgba(15, 23, 42, 0.85);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 5px;
}

.mpact-geofence-status-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.mpact-geofence-status-list li.inside {
  color: #4ade80;
}

.mpact-geofence-status-list li.outside {
  color: #f87171;
}

.runtime-buckets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.runtime-bucket-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) 2fr minmax(4rem, auto);
  gap: 0.5rem;
  align-items: center;
}

.runtime-bucket-label {
  font-size: 0.85rem;
  color: var(--tm-text-muted, #94a3b8);
}

.runtime-bucket-bar-wrap {
  height: 0.55rem;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.runtime-bucket-bar {
  height: 100%;
  background: rgba(56, 189, 248, 0.85);
  border-radius: 999px;
  min-width: 2px;
}

.runtime-bucket-value {
  font-weight: 700;
  font-size: 0.9rem;
  text-align: right;
}

.runtime-events-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.runtime-events-grid th,
.runtime-events-grid td {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.runtime-period-btn--active,
.runtime-gran-btn--active {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.55);
}

