.nav-icon img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Compact P&ID layout with larger, control-room-readable labels. */
.pid-page-tabs + .panel .detailed-pid {
  min-width: 1080px;
}

.detailed-pid .pid-label {
  font-size: 9px;
}

.detailed-pid .pid-small,
.detailed-pid .pid-filter-label,
.detailed-pid .pid-detail-caption {
  font-size: 8.5px;
}

.detailed-pid .pid-unit-title,
.detailed-pid .pid-source-text {
  font-size: 11px;
}

.detailed-pid .uf-status,
.detailed-pid .pid-service-label,
.detailed-pid .pid-pump-list-title,
.detailed-pid .pid-radar-label {
  font-size: 8.5px;
}

.detailed-pid .pid-pump-row-text,
.detailed-pid .pid-pump-row-state,
.detailed-pid .pid-unknown-device text,
.detailed-pid .pid-unverified {
  font-size: 8px;
}

.detailed-pid .pid-drawing-legend text,
.detailed-pid .pid-note,
.detailed-pid .pid-mwa-continuation {
  font-size: 9px;
}

.detailed-pid .pid-section-divider line {
  stroke: #7ea6c1;
  stroke-width: 1.5;
}

.detailed-pid .pid-section-divider text {
  fill: #315f84;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  paint-order: stroke;
  stroke: #f8fcff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.nav-icon img[src$="plc.png"] {
  transform: scale(.92);
}

nav button.active .nav-icon img {
  filter: brightness(0) invert(1);
}

.pump-status-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #bfd3e3;
  border-radius: 4px;
  background: #f5faff;
  color: #66839b;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .7px;
}

.pump-status-panel small {
  grid-column: 1 / -1;
  color: #8299ac;
  font-size: 9px;
  font-weight: normal;
  letter-spacing: 0;
}

.pump-state {
  min-width: 92px;
  padding: 7px 10px;
  border: 1px solid #c9d7e1;
  border-radius: 3px;
  background: #eef2f5;
  color: #758998;
  text-align: center;
  font-size: 11px;
}

.pump-state.running {
  border-color: #9dd8b8;
  background: #e8f7ef;
  color: #168650;
}

.pump-state.stopped {
  border-color: #d0dce5;
  background: #f1f4f7;
  color: #657b8d;
}

.master-connection small {
  display: block;
  margin-top: 4px;
  color: #7d93a7;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: .35px;
}

.status-register-table input,
.status-register-table select {
  width: 100%;
  min-width: 105px;
}

.status-register-actions {
  align-items: center;
  padding: 0 15px 15px;
}

.equipment-icon img {
  display: block;
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.mdb-trend-panel,
.mdb-card {
  overflow: hidden;
  border: 1px solid #b3d0e6;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(48, 103, 144, .08);
}

.mdb-trend-panel {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  padding: 17px 16px 12px;
}

.mdb-trend-panel h2 {
  margin: 0 0 7px;
  color: #173f63;
  font-size: 13px;
  font-weight: 600;
}

.mdb-trend-legend {
  position: absolute;
  top: 15px;
  right: 17px;
  display: flex;
  gap: 13px;
  color: #708ca4;
  font-size: 10px;
}

.mdb-trend-legend i {
  display: inline-block;
  width: 14px;
  height: 2px;
  margin-right: 5px;
  vertical-align: middle;
  background: #24b9df;
}

.mdb-trend-legend i.slave2 {
  background: #28c7a4;
}

.mdb-trend-chart {
  width: 100%;
  min-height: 215px;
  overflow: hidden;
}

.mdb-trend-chart svg {
  display: block;
  width: 100%;
  height: 215px;
}

.mdb-chart-grid line {
  stroke: #c4dfed;
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.mdb-chart-grid text {
  fill: #557c9d;
  font: 9px Arial, sans-serif;
}

.mdb-chart-lines path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mdb-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mdb-card > header {
  padding: 12px 16px;
  border-bottom: 1px solid #b8d4e8;
  background: #f4f9fd;
  color: #174b74;
  font-size: 13px;
  font-weight: 700;
}

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

.mdb-group {
  min-height: 139px;
  padding: 17px 16px 13px;
  border-right: 1px solid #bfd7e8;
  border-bottom: 1px solid #bfd7e8;
}

.mdb-group:nth-child(2n) {
  border-right: 0;
}

.mdb-group h3 {
  margin: 0 0 12px;
  color: #4e7aa0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .3px;
}

.mdb-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 27px;
  color: #456f94;
  font-size: 11px;
}

.mdb-metric strong {
  display: flex;
  align-items: baseline;
  color: #092b4b;
  font-family: Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mdb-metric .value-pill {
  color: inherit;
  font-size: 13px;
}

.mdb-metric .word-unit {
  margin-left: 4px;
  color: #476f90;
  font-size: 12px;
  font-weight: 600;
}

.mdb-quality {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  min-height: 73px;
  border-right: 0;
  border-bottom: 0;
}

.mdb-quality h3 {
  grid-column: 1 / -1;
  margin-bottom: 7px;
}

@media (max-width: 1100px) {
  .mdb-board-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .mdb-trend-legend {
    position: static;
    margin-bottom: 7px;
  }

  .mdb-card-grid {
    grid-template-columns: 1fr;
  }

  .mdb-group,
  .mdb-group:nth-child(2n) {
    border-right: 0;
  }

  .mdb-quality {
    grid-template-columns: 1fr;
  }
}

.pid-scroll {
  overflow: auto;
  background-color: #edf6fc;
  background-image: linear-gradient(rgba(102, 144, 176, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(102, 144, 176, .08) 1px, transparent 1px);
  background-size: 20px 20px;
}

.detailed-pid {
  width: 100%;
  min-width: 1420px;
  background: rgba(250, 253, 255, .72);
}

.detailed-pid .pid-drawing-title {
  fill: #285c83;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
}

.detailed-pid .pid-drawing-legend text,
.detailed-pid .pid-note {
  fill: #6e8aa1;
  font-size: 8px;
  letter-spacing: .25px;
}

.detailed-pid .pid-shared-caption {
  display: none;
}

.pid-page-tabs {
  margin-bottom: 4px;
}

.detailed-pid .pid-mwa-continuation {
  fill: #315f84;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .35px;
  paint-order: stroke;
  stroke: #f8fcff;
  stroke-width: 3px;
}

.pid-page-tabs button {
  min-width: 180px;
  font-weight: 700;
}

.pid-legend-water { fill: #33b8d8; }
.pid-legend-backwash { fill: #a66ce0; }
.pid-legend-chemical { fill: #e0aa2d; }

.pid-train-bg {
  fill: rgba(255, 255, 255, .9);
  stroke: #aac9df;
  stroke-width: 1.2;
}

.pid-train-head {
  fill: #dcecf8;
  stroke: #aac9df;
}

.detailed-pid .pid-train-title {
  fill: #265a82;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
}

.detailed-pid .pid-train-sub {
  fill: #7590a6;
  font-size: 8px;
}

.pid-pipe {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9 8;
  animation: pid-flow 1.1s linear infinite;
}

.pid-pipe.pid-flow-stopped {
  animation-play-state: paused;
}

.pid-pipe-bridge-mask {
  fill: none;
  stroke: #fff;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pid-water { stroke: #33b8d8; }
.pid-backwash { stroke: #a66ce0; }
.pid-drain { stroke: #778d9e; }
.pid-chemical { stroke: #e0aa2d; }

.pid-junction {
  fill: #2b8fb5;
  stroke: #fff;
  stroke-width: 2;
}

.pid-junction-chemical {
  fill: #e0aa2d;
}

.pid-symbol {
  stroke: #557d99;
  stroke-width: 1.4;
  fill: #8ca8ba;
}

.pid-stem {
  fill: none;
  stroke: #557d99;
  stroke-width: 2;
}

.detailed-pid .pid-label {
  fill: #385f7d;
  font-size: 7px;
  font-weight: 600;
}

.pid-instrument {
  fill: #f7fbfe;
  stroke: #a9c7db;
}

.detailed-pid .pid-small {
  fill: #517693;
  font-size: 7px;
  font-weight: 600;
}

.detailed-pid .pid-value {
  fill: #2380a9;
  font: 700 9px Consolas, monospace;
}

.pid-tank-shell {
  stroke: #759bb6;
  stroke-width: 1.3;
}

.pid-tank-top {
  fill: #eef6fb;
  stroke: #759bb6;
}

.pid-tank-bottom {
  fill: none;
  stroke: #759bb6;
}

.pid-sensor {
  fill: #f8fcff;
  stroke: #527f9e;
}

.pid-membrane-box {
  fill: #f1f8fc;
  stroke: #7ea9c2;
}

.detailed-pid .pid-unit-title {
  fill: #285e85;
  font-size: 9px;
  font-weight: 700;
}

.pid-membrane {
  stroke: #5c91ad;
}

.pid-header-pipe {
  fill: none;
  stroke: #3b8faf;
  stroke-width: 5;
}

.detailed-pid .uf-status {
  fill: #738b9e;
  font-size: 7px;
  font-weight: 700;
}

.pid-cip-tank {
  fill: url(#tankShell);
  stroke: #7a9db7;
  stroke-width: 1.2;
}

.pid-pump-list-title,
.pid-radar-label,
.pid-service-label,
.pid-unverified {
  fill: #547690;
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: .2px;
}

.pid-unverified {
  fill: #9a7831;
  font-size: 6px;
}

.pid-pump-row {
  fill: #f7fbfe;
  stroke: #a7c4d8;
}

.pid-pump-row-text,
.pid-pump-row-state {
  fill: #496e8a;
  font-size: 6.5px;
  font-weight: 600;
}

.pid-pump-row-state {
  font-size: 5.5px;
}

.pid-ozone-box {
  fill: #f3f8fc;
  stroke: #779fba;
  stroke-width: 1.2;
}

.pid-filter {
  fill: #fff;
  stroke: #688ca5;
  stroke-width: 1.4;
}

.pid-filter-lines {
  fill: none;
  stroke: #688ca5;
  stroke-width: 1;
}

.detailed-pid .pid-filter-label {
  fill: #4f728d;
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: .2px;
}

.detailed-pid .svg-device.fault .device-indicator {
  fill: #e5a31a;
}

.pid-chemical-hopper {
  fill: url(#tankShell);
  stroke: #a98532;
  stroke-width: 1;
}

.pid-chemical-line {
  fill: none;
  stroke: #e0aa2d;
  stroke-width: 2;
}

.pid-source-box {
  fill: #f8fbfe;
  stroke: #9ebcd1;
  stroke-width: 1.2;
}

.detailed-pid .pid-source-text {
  fill: #274f70;
  font-size: 10px;
  font-weight: 700;
}

.pid-radar-waves path {
  fill: none;
  stroke: #5685a4;
  stroke-width: 1.2;
}

.pid-static-drain,
.pid-static-backwash {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 9 8;
  animation: pid-flow 1.1s linear infinite;
}

@keyframes pid-flow {
  to { stroke-dashoffset: -34; }
}

@media (prefers-reduced-motion: reduce) {
  .pid-pipe,
  .pid-static-drain,
  .pid-static-backwash { animation: none; }
}

.pid-static-drain {
  stroke: #778d9e;
}

.pid-static-backwash {
  stroke: #a66ce0;
}

.pid-unknown-device path:not(.pid-unknown-tank) {
  fill: #d7dfe5;
  stroke: #758898;
  stroke-width: 1.3;
}

.pid-unknown-device text {
  fill: #718391;
  font-size: 6px;
  font-weight: 700;
}

.pid-unknown-tank {
  fill: #cbd7df;
  stroke: #718695;
  stroke-width: 1.3;
}

.detailed-pid .pid-detail-caption {
  fill: #6d8292;
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: .2px;
}

/* P&ID subpage layout: tabs followed directly by a full-size drawing. */
.pid-page-tabs + .panel {
  width: 100%;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pid-page-tabs + .panel > .panel-title {
  display: none;
}

.pid-page-tabs + .panel + .panel {
  display: none;
}

.pid-page-tabs + .panel .pid-scroll {
  width: 100%;
  overflow: auto;
  border-right: 1px solid #aac8de;
  border-left: 1px solid #aac8de;
}

.pid-page-tabs + .panel .detailed-pid {
  display: block;
  width: 100%;
  min-width: 1180px;
  max-height: calc(100vh - 245px);
}

.detailed-pid .pid-drawing-title,
.detailed-pid .pid-train-bg,
.detailed-pid .pid-train-head,
.detailed-pid .pid-train-title,
.detailed-pid .pid-train-sub {
  display: none;
}

.pid-page-tabs + .panel .diagram-foot {
  border: 1px solid #aac8de;
  background: rgba(255, 255, 255, .84);
}

.detailed-pid .svg-device:hover .pid-symbol,
.detailed-pid .svg-device:focus .pid-symbol,
.detailed-pid .svg-device:hover .pid-instrument,
.detailed-pid .svg-device:focus .pid-instrument,
.detailed-pid .svg-device:hover .pid-tank-shell,
.detailed-pid .svg-device:focus .pid-tank-shell {
  stroke: #e2a627;
  stroke-width: 2.5;
}

.trend-panel,
.trend-panel .chart-container {
  width: 100%;
}

.trend-panel .trend-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.trend-interactive {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.trend-interactive .trend-svg.panning {
  cursor: grabbing;
}

.trend-grid line {
  stroke: #d8e5ef;
  stroke-dasharray: 3 4;
}

.trend-grid text,
.trend-time-axis text {
  fill: #7b94a8;
  font-size: 10px;
}

.trend-line {
  fill: none;
  stroke: #4397c8;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.trend-cursor-layer {
  pointer-events: none;
}

.trend-cursor-layer line {
  stroke: #e0a126;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.trend-cursor-layer circle {
  fill: #fff;
  stroke: #e0a126;
  stroke-width: 2.5;
}

.trend-cursor-layer rect {
  fill: #244b70;
  stroke: #183b5e;
  opacity: .96;
}

.trend-cursor-layer text {
  fill: #fff;
  font-size: 10px;
  font-family: Consolas, monospace;
}

#trend-cursor-toggle[aria-pressed="true"] {
  border-color: #d49a2c;
  background: #fff8e8;
  color: #9a6b14;
}

nav button .nav-count,
nav button.active .nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  min-width: 19px;
  padding: 0;
  border-radius: 50%;
  background: #d9303e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(120, 20, 30, .22);
}

.equipment-signals .status-signal {
  min-height: 29px;
  padding: 5px 10px;
  border-color: #c8d3dc;
  border-radius: 15px;
  background: #edf1f4;
  color: #4f6679;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.equipment-signals .status-signal .dot {
  width: 7px;
  height: 7px;
  flex-basis: 7px;
}

.equipment-signals .value-pill {
  min-width: 48px;
  min-height: 29px;
  padding: 5px 8px;
  font-size: 14px;
  line-height: 17px;
}

.equipment-signals .word-unit {
  align-self: center;
  margin-left: -9px;
  font-size: 12px;
  font-weight: 700;
  color: #526f86;
}

.uf-device-signals .status-signal {
  min-height: 29px;
  padding: 5px 10px;
  border-color: #c8d3dc;
  border-radius: 15px;
  background: #edf1f4;
  color: #4f6679;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.uf-device-signals .status-signal .dot {
  width: 7px;
  height: 7px;
  flex-basis: 7px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, .92), rgba(231, 243, 252, .72) 34%, transparent 64%),
    linear-gradient(145deg, #d7eaf8 0%, #edf6fc 48%, #c7e0f2 100%);
}

.login-screen[hidden],
#dashboard-shell[hidden] {
  display: none !important;
}

.login-card {
  width: min(410px, 100%);
  overflow: hidden;
  border: 1px solid #9dbbd3;
  border-radius: 8px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 54px rgba(30, 80, 120, .2);
  padding: 38px 40px 0;
  text-align: center;
}

.login-mark {
  width: 58px;
  height: 54px;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 2px solid #83b5d8;
  border-radius: 8px;
  background: linear-gradient(145deg, #4e8bd0, #2d66a7);
  color: #dff6ff;
  font-size: 58px;
  line-height: 38px;
  box-shadow: 0 5px 14px rgba(44, 102, 160, .22);
}

.login-card h1 {
  margin: 0 0 7px;
  color: #245b8b;
  font-size: 24px;
  letter-spacing: 1.2px;
}

.login-card > p {
  margin: 0 0 29px;
  color: #6f8ca4;
  font-size: 11px;
}

.login-card form {
  display: grid;
  gap: 15px;
  text-align: left;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #5e7c96;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
}

.login-card input {
  width: 100%;
  min-height: 42px;
  border-color: #b5cada;
  background: #f7fbfe;
  color: #244e70;
  font-size: 13px;
}

.login-card input:focus {
  border-color: #4d8bc5;
  box-shadow: 0 0 0 3px rgba(77, 139, 197, .13);
  outline: none;
}

.login-button {
  min-height: 42px;
  border: 1px solid #2865a5;
  border-radius: 4px;
  background: linear-gradient(#4d8bd0, #3372b6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
}

.login-button:disabled {
  opacity: .58;
}

.forgot-password-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: #2f72ad;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.forgot-password-button[hidden] {
  display: none !important;
}

.forgot-password-button:hover {
  color: #174e80;
}

.login-error {
  min-height: 17px;
  color: #c6454d;
  font-size: 10px;
  line-height: 1.5;
}

.login-error.success {
  color: #218458;
}

.login-error.lockout {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #e5ba64;
  border-radius: 3px;
  background: #fff6dc;
  color: #96650b;
  font-weight: 700;
  text-align: center;
}

.login-footer {
  margin: 30px -40px 0;
  padding: 14px;
  border-top: 1px solid #bed2e2;
  background: #e6f1fa;
  color: #66859e;
  font-size: 9px;
  letter-spacing: .7px;
}

.user-session {
  position: relative;
  white-space: nowrap;
}

.account-menu-button {
  display: grid;
  grid-template-columns: 32px minmax(58px, auto) 14px;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 5px 9px 5px 6px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 7px;
  background: rgba(14, 57, 103, .28);
  color: #fff;
  text-align: left;
  box-shadow: inset 0 1px rgba(255, 255, 255, .06);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.account-menu-button:hover,
.user-session.open .account-menu-button {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(14, 57, 103, .52);
  box-shadow: 0 4px 14px rgba(7, 34, 66, .18), inset 0 1px rgba(255, 255, 255, .09);
}

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  background: linear-gradient(145deg, #79c9f5, #e7f7ff);
  color: #174e83;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 7px rgba(0, 25, 54, .2);
}

.user-avatar.large {
  width: 38px;
  height: 38px;
  border-color: #aed1ed;
  font-size: 15px;
}

.user-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.user-identity strong {
  overflow: hidden;
  max-width: 95px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.account-chevron {
  color: #cce3f5;
  font-size: 15px;
  line-height: 1;
  transform: translateY(-2px);
  transition: transform .15s ease;
}

.user-session.open .account-chevron {
  transform: rotate(180deg) translateY(2px);
}

.account-popover {
  position: absolute;
  z-index: 60;
  top: calc(100% + 9px);
  right: 0;
  width: 172px;
  overflow: hidden;
  border: 1px solid #b6cee2;
  border-radius: 8px;
  background: #fff;
  color: #173f65;
  box-shadow: 0 12px 34px rgba(21, 63, 102, .24);
}

.account-popover::before {
  position: absolute;
  top: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  border-top: 1px solid #b6cee2;
  border-left: 1px solid #b6cee2;
  background: #edf6fd;
  content: '';
  transform: rotate(45deg);
}

.account-action {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid #e0eaf2;
  background: #fff;
  color: #254d70;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.account-action:last-child {
  border-bottom: 0;
}

.account-action:hover {
  background: #edf6fd;
}

.account-action.danger {
  color: #a13b42;
}

.account-action.danger:hover {
  background: #fff2f2;
}

.password-dialog {
  width: min(470px, 94vw);
}

.password-dialog .field {
  margin-bottom: 14px;
}

.password-dialog input {
  width: 100%;
}

@media (max-width: 900px) {
  .account-menu-button {
    grid-template-columns: 30px minmax(48px, auto) 12px;
    gap: 6px;
    min-height: 40px;
    padding: 4px 7px 4px 4px;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
  }

  .user-identity strong {
    max-width: 68px;
  }
}

@media (max-width: 650px) {
  .login-card {
    padding: 30px 24px 0;
  }

  .login-footer {
    margin-right: -24px;
    margin-left: -24px;
  }

  .account-menu-button {
    grid-template-columns: 28px minmax(45px, auto) 11px;
    min-height: 38px;
  }

  .account-menu-button .user-avatar {
    width: 28px;
    height: 28px;
  }

  .account-menu-button .user-identity strong {
    max-width: 58px;
  }

  .account-popover {
    position: fixed;
    top: 67px;
    right: 8px;
  }

  .mode-badge {
    display: none;
  }
}

/* Final P&ID typography overrides follow the base drawing rules. */
.pid-page-tabs + .panel .detailed-pid { min-width: 1080px; }
.detailed-pid .pid-label { font-size: 9px; }
.detailed-pid .pid-small,
.detailed-pid .pid-filter-label,
.detailed-pid .pid-detail-caption { font-size: 8.5px; }
.detailed-pid .pid-unit-title,
.detailed-pid .pid-source-text { font-size: 11px; }
.detailed-pid .uf-status,
.detailed-pid .pid-service-label,
.detailed-pid .pid-pump-list-title,
.detailed-pid .pid-radar-label { font-size: 8.5px; }
.detailed-pid .pid-pump-row-text,
.detailed-pid .pid-pump-row-state,
.detailed-pid .pid-unknown-device text,
.detailed-pid .pid-unverified { font-size: 8px; }
.detailed-pid .pid-drawing-legend text,
.detailed-pid .pid-note,
.detailed-pid .pid-mwa-continuation { font-size: 9px; }

/* Keep the readable drawing at its natural aspect ratio; scroll on small screens. */
.pid-page-tabs + .panel .detailed-pid.pid-readable { min-width: 1600px; max-height: none; height: auto; }
.pid-readable .pid-label, .pid-readable .pid-filter-label { font-size: 12px; }
.pid-readable .pid-small { font-size: 10px; }
.pid-readable .pid-unit-title { font-size: 14px; }
.pid-readable .uf-status, .pid-readable .pid-pump-list-title { font-size: 11px; }
.pid-readable .pid-unknown-device text, .pid-readable .pid-unverified,
.pid-readable .pid-pump-row-text, .pid-readable .pid-pump-row-state { font-size: 10px; }
.pid-readable .pid-section-divider text { font-size: 12px; }
.pid-flow-flange, .pid-flow-mark {
  fill: none;
  stroke: #527f9e;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pid-flow-body { fill: #f7fbfe; }
