﻿:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --dark-panel: #202020;
  --dark-panel-soft: #333333;
  --text: #171717;
  --muted: #858585;
  --border: #eeeeee;
  --border-strong: #e8e8e8;
  --primary: #a9d900;
  --primary-dark: #84be00;
  --accent: #f39a19;
  --danger: #d9534f;
  --shadow: 0 18px 42px rgba(23, 23, 23, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 292px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 12px 0 30px rgba(23, 23, 23, .04);
}

.brand {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 22px;
}

.brand img {
  width: 88px;
  height: auto;
  display: block;
}

.brand span {
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.fleet-select {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--dark-panel);
  color: #fff;
  padding: 14px;
  border-radius: 24px;
  margin-bottom: 22px;
}

.fleet-select strong,
.fleet-select small {
  display: block;
}

.fleet-select strong { font-size: 14px; }
.fleet-select small { color: rgba(255,255,255,.62); margin-top: 2px; }

.profile-panel-link {
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}

.profile-panel-link:hover,
.profile-panel-link.active {
  color: #fff;
  transform: none;
  box-shadow: 0 10px 24px rgba(23, 23, 23, .16);
}

.profile-panel-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}

.profile-panel-icon .nav-icon {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  background: transparent;
  color: var(--primary);
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(169, 217, 0, .16);
}

nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 22px;
  font-weight: 750;
}

nav a.active,
nav a:hover {
  background: var(--surface-muted);
  color: var(--text);
}

nav a.active .nav-icon {
  background: var(--primary);
  color: #fff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #f0f1f2;
  color: var(--text);
}

.nav-icon::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.home { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 10.8 12 3l9 7.8V21h-6v-6H9v6H3z'/%3E%3C/svg%3E"); }
.fleet { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h7V4h2v3h7v13H4zm3 3v7h3v-7zm7 0v7h3v-7z'/%3E%3C/svg%3E"); }
.charger { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2h8v8h2.5L13 22v-8h-3l2-6H7z'/%3E%3C/svg%3E"); }
.vehicle { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 11 7 5h10l2 6 1 1v7h-3v-2H7v2H4v-7zm3.4-4-1.2 4h9.6l-1.2-4zM7 14.5A1.5 1.5 0 1 0 7 17a1.5 1.5 0 0 0 0-2.5m10 0A1.5 1.5 0 1 0 17 17a1.5 1.5 0 0 0 0-2.5'/%3E%3C/svg%3E"); }
.events { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h14v18H5zm3 4v2h8V7zm0 4v2h8v-2zm0 4v2h5v-2z'/%3E%3C/svg%3E"); }
.stats { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 19h16v2H2V3h2zm2-2 4-5 3 3 5-8 2 1.2-6.6 10.5-3.2-3.2-2.7 3.5z'/%3E%3C/svg%3E"); }
.users { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8m0 2c4 0 7 2 7 5v2H2v-2c0-3 3-5 7-5m8-1a3 3 0 1 0 0-6v6m1 2c2.4.4 4 1.8 4 4v2h-4z'/%3E%3C/svg%3E"); }
.user-profile { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10m0 2c-5 0-9 2.5-9 6v2h18v-2c0-3.5-4-6-9-6'/%3E%3C/svg%3E"); }

.content {
  flex: 1;
  padding: 30px;
  max-width: 1360px;
}

h1 {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 32px;
  font-weight: 900;
}

h2 {
  margin: 30px 0 14px;
  font-size: 21px;
  font-weight: 900;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 650;
}

.card strong {
  font-size: 34px;
  color: var(--text);
  font-weight: 900;
}

.card strong::after {
  content: "";
  display: block;
  width: 38px;
  height: 5px;
  margin-top: 12px;
  background: var(--primary);
  border-radius: 999px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

th {
  color: var(--muted);
  font-weight: 800;
  background: var(--surface-muted);
}

tr:last-child td { border-bottom: 0; }
code { color: var(--primary-dark); font-weight: 800; }

input,
select {
  width: 100%;
  min-width: 110px;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(169, 217, 0, .18);
}

input[type=checkbox] {
  width: auto;
  min-width: 0;
  accent-color: var(--primary-dark);
}

button {
  background: var(--primary);
  border: 0;
  border-radius: 14px;
  padding: 11px 15px;
  font-weight: 850;
  cursor: pointer;
  color: #fff;
  min-height: 42px;
}

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

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

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.toolbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.toolbar > div {
  min-width: 220px;
}

.toolbar label,
.form-grid label {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  display: block;
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.badge {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: var(--surface-muted);
  font-weight: 750;
}

.badge.ok { color: var(--primary-dark); background: rgba(169, 217, 0, .13); }
.badge.warn { color: #9a5f00; background: rgba(243, 154, 25, .13); }
.badge.err { color: var(--danger); background: #fff0f0; }

.message {
  background: #f3f8dc;
  border: 1px solid #b9cf61;
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 18px;
  color: var(--text);
  font-weight: 650;
}

.message:not(.message-inline) {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30000;
  width: min(680px, calc(100vw - 32px));
  margin: 0;
  box-sizing: border-box;
  box-shadow: 0 16px 44px rgba(23, 23, 23, .22);
}

.message-stack {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30000;
  width: min(680px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.message-stack .message {
  position: static;
  transform: none;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  box-shadow: 0 16px 44px rgba(23, 23, 23, .22);
  pointer-events: auto;
}

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

.link-button,
.sort {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 850;
  text-align: left;
  box-shadow: none;
}

.link-button:hover,
.sort:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.icon-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
}

.action-icon {
  width: 17px;
  height: 17px;
  display: block;
  background: currentColor;
  -webkit-mask: var(--action-icon) center / contain no-repeat;
  mask: var(--action-icon) center / contain no-repeat;
}

.action-icon.edit { --action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 17.5V21h3.5L18.1 10.4l-3.5-3.5zM20.7 7.8c.4-.4.4-1 0-1.4l-3.1-3.1a1 1 0 0 0-1.4 0l-1.8 1.8 4.5 4.5z'/%3E%3C/svg%3E"); }

.detail-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.detail-header h2,
.section-header h2 {
  margin: 0;
}

.header-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
}

.header-select span {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.header-select select {
  min-width: 220px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.segmented-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  margin-bottom: 12px;
}

button.segmented {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

button.segmented.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.sub-detail-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-muted);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.legend-bar,
.legend-line,
.legend-total,
.legend-connection {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: 999px;
}

.legend-bar { background: var(--primary); }
.legend-line { height: 3px; background: var(--dark-panel); }
.legend-price { display: inline-block; width: 22px; height: 10px; border-radius: 4px; background: linear-gradient(90deg, #84cc16, #facc15, #f97316, #ef4444); }
.legend-vehicle { display: inline-block; width: 22px; height: 3px; border-radius: 999px; background: var(--primary); }
.legend-total { height: 4px; background: #dc2626; }
.legend-connection { height: 3px; border-top: 3px dashed var(--primary); }

.chart-wrap {
  position: relative;
  overflow: visible;
  min-height: 452px;
  cursor: zoom-in;
}

.chart-wrap.chart-panning {
  cursor: grabbing;
}

.chart-wrap svg {
  width: 100%;
  min-width: 100%;
  max-width: none;
  height: 380px;
  display: block;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.chart-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.chart-tooltip {
  position: absolute;
  z-index: 20;
  display: none;
  min-width: 330px;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
}

.chart-tooltip table {
  margin-top: 6px;
  width: 100%;
  border-collapse: collapse;
}

.chart-tooltip th,
.chart-tooltip td {
  padding: 3px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.chart-x-range-wrap {
  display: none;
  margin: 4px 70px 0 70px;
}

.chart-x-range {
  width: 100%;
  height: 18px;
  cursor: ew-resize;
}

.chart-wrap svg path,
.chart-wrap svg line,
.chart-wrap svg circle {
  vector-effect: non-scaling-stroke;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  column-gap: 28px;
  row-gap: 14px;
  margin-bottom: 18px;
}

.detail-grid div {
  min-width: 0;
  padding: 0;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
  font-weight: 750;
}

.detail-grid strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; }
  nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  nav a { flex: 0 0 auto; }
  .content { padding: 22px; }
  .cards, .form-grid, .detail-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

@media (max-width: 560px) {
  .cards, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  th, td { padding: 11px 12px; }
}

.connector-panel table {
  margin-bottom: 22px;
}

.connector-panel th,
.connector-panel td {
  vertical-align: top;
}

.connector-panel .form-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.connector-panel .sub-detail-card {
  margin-top: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.wide-field {
  grid-column: 1 / -1;
}

.days-grid {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.day-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.day-check input {
  width: auto;
}


.calendar-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.legend-total,
.legend-connection {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: 999px;
}

.legend-total { height: 4px; background: #dc2626; }
.legend-connection { height: 3px; border-top: 3px dashed var(--primary); }

/* Plotly chart replacement for planning statistics. */
.chart-wrap {
  min-height: 770px;
  overflow: visible;
  cursor: default;
}
.spotplanner-plotly-host {
  width: 100%;
  min-height: 770px;
}
.spotplanner-plotly-chart {
  width: 100%;
  height: 700px;
  min-height: 700px;
}
.spotplanner-plotly-empty,
.spotplanner-plotly-missing {
  padding: 24px;
  border: 1px solid var(--line, #eeeeee);
  border-radius: 18px;
  background: #fff;
  color: var(--muted, #858585);
}

/* Plotly overrides: old SVG chart CSS must not resize Plotly modebar/icons. */
.chart-wrap .spotplanner-plotly-host svg {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}
.chart-wrap .spotplanner-plotly-host .modebar svg,
.spotplanner-plotly-host .modebar svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 0 !important;
  max-width: 16px !important;
  display: inline-block !important;
}
.spotplanner-plotly-host .modebar {
  top: 8px !important;
  right: 8px !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
  background: rgba(255, 255, 255, .88) !important;
  border: 1px solid rgba(17, 24, 39, .08) !important;
  border-radius: 10px !important;
  padding: 3px !important;
}
.spotplanner-plotly-host .modebar-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
}
.spotplanner-plotly-host .modebar-btn {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  padding: 4px !important;
  margin: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  box-shadow: none !important;
}
.spotplanner-plotly-host .modebar-btn:hover {
  background: rgba(169, 217, 0, .18) !important;
}
.spotplanner-plotly-host .plotly .cursor-crosshair,
.spotplanner-plotly-host .plotly .nsewdrag,
.spotplanner-plotly-host .plotly .drag {
  cursor: crosshair;
}

/* Statistics summary and expandable charging-session details. */
.statistics-cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.metric-card .metric-label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.metric-help {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 !important;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  cursor: help;
}

.metric-help::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 100;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(310px, 70vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--dark-panel);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .12s ease, transform .12s ease;
}

.metric-help:hover::after,
.metric-help:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.charging-progress-panel {
  overflow: visible;
}

.charging-progress-table {
  min-width: 1080px;
}

.charging-progress-table td,
.charging-progress-table th {
  vertical-align: middle;
  white-space: nowrap;
}

.charging-progress-table .session-detail-row td {
  padding: 0;
  white-space: normal;
  background: var(--surface-muted);
}

.session-detail {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.detail-chart-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.detail-chart-panel h3 {
  margin: 0;
  font-size: 16px;
}

.spotplanner-session-chart-host {
  width: 100%;
  min-height: 410px;
}

.spotplanner-session-chart {
  width: 100%;
  height: 410px;
  min-height: 410px;
}

.spotplanner-session-chart-host svg {
  min-width: 0 !important;
  max-width: none !important;
}

.spotplanner-session-chart-host .modebar {
  top: 6px !important;
  right: 6px !important;
  left: auto !important;
  width: auto !important;
  height: auto !important;
  padding: 3px !important;
  border: 1px solid rgba(17, 24, 39, .10) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, .92) !important;
}

.spotplanner-session-chart-host .modebar-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
}

.spotplanner-session-chart-host .modebar-btn {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  padding: 4px !important;
  margin: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  box-shadow: none !important;
}

.spotplanner-session-chart-host .modebar svg {
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 0 !important;
  max-width: 16px !important;
}

.empty-cell {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* Authentication and operational portal additions. */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface-muted); }
.auth-panel { width: min(440px, 100%); }
.auth-panel form { display: grid; gap: 10px; }
.auth-logo { width: 150px; max-height: 54px; object-fit: contain; margin-bottom: 12px; }
.logout-form { margin: 18px; }
.logout-form button { width: 100%; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stats-grid.compact { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.stat-card span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-card strong { font-size: 20px; }
.badge.info { color: var(--primary-dark); background: rgba(169,217,0,.13); }
.badge.warning { color: #9a5f00; background: rgba(243,154,25,.13); }
.badge.error { color: var(--danger); background: #fff0f0; }
.warning-message { background: rgba(243,154,25,.13); border-color: rgba(243,154,25,.35); }
.error-message { background: #fff0f0; border-color: rgba(205,50,50,.3); color: var(--danger); }
.button-link { display: inline-flex; align-items: center; min-height: 36px; padding: 7px 12px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 800; text-decoration: none; }
.button-link.secondary { background: var(--surface-muted); color: var(--text); border: 1px solid var(--border); }
.actions-cell { display: flex; flex-wrap: wrap; gap: 7px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.sub-detail-card { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-muted); }
.chart-host { min-height: 360px; width: 100%; }
.chart-host.tall { min-height: 460px; }
.days-field { grid-column: span 2; }
.day-options, .filter-checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.day-option, .filter-checks label { display: inline-flex !important; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 7px 10px; background: var(--surface-muted); }
.day-option input, .filter-checks input { width: auto; }
textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 14px; padding: 12px; font: inherit; }
.detail-list { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; }
.detail-list dt { font-weight: 800; color: var(--muted); }
.detail-list dd { margin: 0; }
@media (max-width: 980px) { .stats-grid, .stats-grid.compact { grid-template-columns: repeat(2, minmax(140px,1fr)); } }
@media (max-width: 620px) { .stats-grid, .stats-grid.compact { grid-template-columns: 1fr; } .copy-row { flex-direction: column; } .detail-list { grid-template-columns: 1fr; } }

.account-switch-form { margin: 0 0 1rem; display: grid; gap: .35rem; }
.account-switch-form label { font-size: .78rem; opacity: .75; }
.account-switch-form select { width: 100%; }

/* Click-to-sort support for every data table. */
th.sortable-column { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable-column::after { content: "↕"; margin-left: .45rem; font-size: .78em; opacity: .38; }
th.sortable-column[data-sort-direction="asc"]::after { content: "▲"; opacity: .9; }
th.sortable-column[data-sort-direction="desc"]::after { content: "▼"; opacity: .9; }
th.sortable-column:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.location-map{height:320px;margin-top:.5rem;border-radius:8px;overflow:hidden}.location-picker{grid-column:1/-1}.error-text{color:#b42318}

.spot-price-chart-host {
  min-height: 620px;
  overflow: visible;
}
.spot-price-chart-host .spotplanner-plotly-chart {
  height: 560px;
  min-height: 560px;
}

.statistics-chart-host {
  min-height: 760px;
}
.statistics-chart-host .spotplanner-plotly-chart {
  height: 700px;
  min-height: 700px;
}

.connector-create-row { margin-bottom: 16px; }
.calendar-create-row { margin: 4px 0 18px; }

.profile-page-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-page-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.profile-page-header form {
  margin: 0;
}

/* Modern user portal layout refresh. The established ejoin green and Segoe UI font are preserved. */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-muted: #f7f8f8;
  --surface-hover: #f0f2f2;
  --dark-panel: #202020;
  --dark-panel-soft: #343434;
  --text: #171717;
  --text-soft: #424242;
  --muted: #74787d;
  --border: #e5e7e8;
  --border-strong: #d9dcde;
  --primary: #a9d900;
  --primary-dark: #79ad00;
  --primary-soft: rgba(169, 217, 0, .12);
  --accent: #f39a19;
  --danger: #c83f3b;
  --danger-soft: #fff2f1;
  --focus-ring: 0 0 0 4px rgba(169, 217, 0, .20);
  --shadow-sm: 0 1px 2px rgba(23, 23, 23, .04), 0 4px 12px rgba(23, 23, 23, .03);
  --shadow: 0 8px 24px rgba(23, 23, 23, .055);
  --shadow-lg: 0 18px 48px rgba(23, 23, 23, .10);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--text);
  text-decoration-color: rgba(121, 173, 0, .42);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-dark);
}

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  width: auto;
  min-width: 0;
  height: 100vh;
  padding: 16px;
  background: #fcfcfc;
  border-right: 1px solid var(--border);
  box-shadow: none;
  overflow: hidden;
  z-index: 30;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 2px 0 18px;
  padding: 8px 12px 12px;
  border-radius: var(--radius-lg);
  text-align: center;
  text-decoration: none;
}

.brand:hover,
.brand.active {
  color: var(--text);
  background: transparent;
}

.brand img {
  width: 72px;
  max-height: 34px;
  object-fit: contain;
}

.brand span {
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 850;
}

.fleet-select {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  gap: 11px;
  align-items: center;
  margin: 0 0 14px;
  padding: 13px;
  border: 1px solid #2c2c2c;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #252525, #1c1c1c);
  box-shadow: 0 10px 22px rgba(23, 23, 23, .13);
}

.profile-panel-link:hover,
.profile-panel-link.active {
  transform: none;
  box-shadow: 0 14px 30px rgba(23, 23, 23, .18);
}

.profile-panel-icon {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.09);
}

.profile-panel-copy {
  min-width: 0;
}

.fleet-select strong {
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-select small {
  color: rgba(255,255,255,.58);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.profile-panel-chevron {
  width: 8px;
  height: 8px;
  border-top: 2px solid rgba(255,255,255,.52);
  border-right: 2px solid rgba(255,255,255,.52);
  transform: rotate(45deg);
}

.account-switch-form {
  margin: 0 0 16px;
  padding: 12px;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.account-switch-form label,
.nav-section-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.account-switch-form select {
  min-height: 38px;
  padding: 8px 34px 8px 10px;
  background-color: var(--surface-muted);
  font-size: 13px;
}

.nav-section-label {
  margin: 4px 10px 7px;
}

nav {
  gap: 4px;
}

nav a {
  position: relative;
  min-height: 44px;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 13px;
  color: #696d71;
  font-size: 14px;
  font-weight: 690;
  transition: color .16s ease, background-color .16s ease, transform .16s ease;
}

nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

nav a.active {
  background: var(--primary-soft);
  color: #273000;
}

nav a.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 99px;
  background: var(--primary-dark);
}

.nav-icon {
  width: 29px;
  height: 29px;
  flex-basis: 29px;
  background: #eef0f0;
  color: #55595d;
  transition: color .16s ease, background-color .16s ease;
}

nav a.active .nav-icon {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 5px 13px rgba(121, 173, 0, .23);
}

.content {
  min-width: 0;
  max-width: none;
  padding: 30px clamp(24px, 3.4vw, 54px) 54px;
}

.content-inner {
  width: min(100%, 1360px);
  margin: 0 auto;
}

h1 {
  margin: 0 0 24px;
  font-size: clamp(28px, 2.5vw, 38px);
  line-height: 1.14;
  letter-spacing: -.035em;
  font-weight: 850;
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -.015em;
  font-weight: 800;
}

h3 {
  margin: 26px 0 12px;
  font-size: 16px;
  font-weight: 800;
}

p {
  color: var(--text-soft);
}

.small {
  color: var(--muted);
  line-height: 1.45;
}

.panel,
.toolbar,
.card,
.stat-card,
.calendar-add-form,
.connector-panel .form-grid {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: clamp(18px, 2vw, 26px);
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
}

.panel + .panel {
  margin-top: 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  gap: 14px;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
}

.toolbar > div {
  min-width: 0;
}

.toolbar > div:last-child:has(button) {
  flex: 0 0 auto;
}

.toolbar label,
.form-grid label {
  margin-bottom: 7px;
  color: #4b4f52;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .01em;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  align-items: end;
}

.form-grid > div {
  min-width: 0;
}

input,
select,
textarea {
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fbfbfb;
  color: var(--text);
  padding: 10px 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

select {
  cursor: pointer;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #c9cdcf;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-dark);
  background: #fff;
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  border-color: #eceeef;
  background: #f2f3f3;
  color: #777b7e;
  opacity: 1;
  cursor: not-allowed;
}

input[type="checkbox"] {
  min-height: 0;
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--primary-dark);
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 5px 13px rgba(121, 173, 0, .17);
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, border-color .14s ease;
}

button:hover,
.button-link:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  box-shadow: 0 8px 18px rgba(121, 173, 0, .22);
  transform: none;
}

button:active,
.button-link:active {
  transform: none;
}

button.secondary,
.button-link.secondary,
button.segmented {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover,
.button-link.secondary:hover,
button.segmented:hover {
  border-color: #c6cacc;
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: none;
}

button.danger {
  border-color: rgba(200, 63, 59, .22);
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
}

button.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  box-shadow: 0 7px 18px rgba(200, 63, 59, .16);
}

button:focus-visible,
.button-link:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

button:disabled {
  transform: none;
  box-shadow: none;
}

.detail-actions,
.actions-cell {
  gap: 9px;
}

.detail-actions {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

.detail-header,
.section-header,
.profile-page-header {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.detail-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-header h2,
.section-header h2 {
  margin: 0;
}

.section-header > a {
  font-size: 13px;
  font-weight: 760;
}

.detail-panel {
  border-top: 3px solid var(--primary);
}

.segmented-nav {
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
}

button.segmented {
  min-height: 36px;
  padding: 8px 14px;
  border-color: transparent;
  border-radius: 10px;
}

button.segmented.active {
  border-color: var(--primary-dark);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(121, 173, 0, .16);
}

.stats-grid,
.cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stats-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card,
.card {
  position: relative;
  min-width: 0;
  padding: 17px 18px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.stat-card::before,
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}

.stat-card span,
.card span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.stat-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.15;
  letter-spacing: -.025em;
  font-weight: 850;
}

.card strong {
  font-size: 30px;
}

.card strong::after {
  display: none;
}

.table-scroll,
.panel > table,
.content-inner > table,
.sub-detail-card > table {
  max-width: 100%;
}

table {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: none;
}

th,
td {
  padding: 13px 15px;
  border-bottom-color: var(--border);
  vertical-align: middle;
}

th {
  background: #f5f6f6;
  color: #666a6e;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .045em;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color .12s ease;
}

tbody tr:hover:not(.connector-edit-row):not(.session-detail-row) {
  background: #fafbfb;
}

td a:not(.button-link) {
  font-weight: 720;
}

.actions-cell,
td:last-child {
  white-space: nowrap;
}

.badge {
  padding: 5px 9px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.badge.info,
.badge.ok {
  border-color: rgba(121, 173, 0, .20);
  background: var(--primary-soft);
  color: #557900;
}

.badge.warning,
.badge.warn {
  border-color: rgba(243, 154, 25, .22);
}

.badge.error,
.badge.err {
  border-color: rgba(200, 63, 59, .18);
  background: var(--danger-soft);
  color: var(--danger);
}

.message,
.message-stack .message {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.sub-detail-card,
.detail-chart-panel {
  border-color: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.day-option,
.day-check,
.filter-checks label {
  min-height: 38px;
  border-radius: 11px;
  background: #fafafa;
  transition: border-color .15s ease, background-color .15s ease;
}

.day-option:hover,
.day-check:hover,
.filter-checks label:hover {
  border-color: #c8ccce;
  background: #fff;
}

.location-map {
  height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.auth-shell {
  background:
    radial-gradient(circle at 12% 8%, rgba(169, 217, 0, .13), transparent 30%),
    var(--bg);
}

.auth-panel {
  padding: 28px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  width: 118px;
  margin: 0 auto 18px;
  display: block;
}

.auth-panel h1 {
  font-size: 30px;
  text-align: center;
}

.auth-panel form {
  gap: 13px;
}

.profile-page-header h1 .nav-icon {
  width: 34px;
  height: 34px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.chart-wrap,
.spot-price-chart-host,
.statistics-chart-host {
  border-radius: var(--radius-md);
}

.spotplanner-plotly-host .modebar,
.spotplanner-session-chart-host .modebar {
  border-color: var(--border) !important;
  border-radius: 10px !important;
  box-shadow: var(--shadow-sm) !important;
}

.empty-cell,
.spotplanner-plotly-empty,
.spotplanner-plotly-missing {
  background: var(--surface-muted);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .sidebar {
    padding: 12px;
  }

  .sidebar-inner {
    min-height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .content {
    padding: 26px 24px 44px;
  }

  nav a {
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-inner {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .brand {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin: 0 0 10px;
    padding: 4px;
  }

  .brand img {
    width: 58px;
  }

  .brand span {
    font-size: 18px;
  }

  .fleet-select {
    display: inline-grid;
    width: min(100%, 360px);
    margin-bottom: 10px;
  }

  .account-switch-form {
    width: min(100%, 360px);
  }

  .nav-section-label {
    display: none;
  }

  nav {
    flex-direction: row;
    gap: 6px;
    margin: 2px -4px 0;
    padding: 4px 4px 7px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  nav a {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 6px 10px 6px 7px;
  }

  nav a:hover {
    transform: none;
  }

  nav a.active::before {
    display: none;
  }

  .content {
    padding: 24px 18px 40px;
  }

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

  .panel > table,
  .content-inner > table,
  .sub-detail-card > table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding-inline: 12px;
  }

  .fleet-select,
  .account-switch-form {
    width: 100%;
  }

  nav a span:last-child {
    display: none;
  }

  nav a {
    padding: 6px;
  }

  .content {
    padding: 20px 12px 34px;
  }

  h1 {
    margin-bottom: 18px;
    font-size: 28px;
  }

  .panel,
  .toolbar,
  .auth-panel {
    padding: 16px;
    border-radius: 16px;
  }

  .toolbar,
  .form-grid,
  .stats-grid,
  .stats-grid.compact,
  .cards,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-header,
  .section-header,
  .profile-page-header {
    align-items: flex-start;
  }

  .detail-header,
  .profile-page-header {
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions button {
    flex: 1 1 auto;
  }

  .segmented-nav {
    width: 100%;
  }

  button.segmented {
    flex: 1;
  }

  th,
  td {
    padding: 11px 12px;
  }

  .chart-wrap,
  .spotplanner-plotly-host,
  .spotplanner-plotly-chart,
  .statistics-chart-host,
  .spot-price-chart-host {
    min-height: 520px;
    height: 520px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Theme settings and transparent ejoin branding. */
.brand-logo {
  display: grid;
  place-items: center;
}

.brand-logo img {
  grid-area: 1 / 1;
}

.brand img {
  width: 96px;
  height: auto;
  max-height: none;
}

.auth-logo {
  width: 132px;
  height: auto;
}

.theme-logo-dark {
  display: none !important;
}

.settings-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-section-header h2,
.settings-section-header p {
  margin-top: 0;
}

.settings-section-header p {
  margin-bottom: 0;
}

.theme-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 280px));
  gap: 12px;
}

button.theme-option {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 14px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--text);
  box-shadow: none;
  text-align: left;
}

button.theme-option:hover {
  border-color: var(--primary-dark);
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

button.theme-option.active {
  border-color: var(--primary-dark);
  background: var(--primary-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--primary-dark);
}

.theme-option > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.theme-option strong {
  font-size: 14px;
}

.theme-option small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.theme-preview {
  position: relative;
  display: block;
  width: 70px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.theme-preview::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 19px;
  border-right: 1px solid rgba(127, 127, 127, .22);
}

.theme-preview span {
  position: absolute;
  left: 27px;
  right: 8px;
  top: 10px;
  height: 8px;
  border-radius: 4px;
  box-shadow: 0 14px 0 currentColor;
}

.theme-preview-light {
  background: #f5f6f7;
  color: #dfe2e3;
}

.theme-preview-light::before {
  background: #ffffff;
}

.theme-preview-light span {
  background: #ffffff;
}

.theme-preview-dark {
  background: #111416;
  color: #2b3033;
  border-color: #3a4145;
}

.theme-preview-dark::before {
  background: #1b1f21;
}

.theme-preview-dark span {
  background: #252a2d;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101214;
  --surface: #191c1f;
  --surface-muted: #222629;
  --surface-hover: #2a2f32;
  --dark-panel: #0c0e0f;
  --dark-panel-soft: #25292c;
  --text: #f3f5f5;
  --text-soft: #c7ccce;
  --muted: #9ba3a7;
  --border: #30363a;
  --border-strong: #3c4449;
  --primary: #a9d900;
  --primary-dark: #8fc200;
  --primary-soft: rgba(169, 217, 0, .15);
  --accent: #ffad38;
  --danger: #ff746e;
  --danger-soft: rgba(255, 116, 110, .12);
  --focus-ring: 0 0 0 4px rgba(169, 217, 0, .23);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28), 0 5px 14px rgba(0, 0, 0, .16);
  --shadow: 0 10px 28px rgba(0, 0, 0, .22);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .theme-logo-light {
  display: none !important;
}

html[data-theme="dark"] .theme-logo-dark {
  display: block !important;
}

html[data-theme="dark"] .sidebar {
  background: #141719;
}

html[data-theme="dark"] a {
  color: var(--text);
  text-decoration-color: rgba(169, 217, 0, .45);
}

html[data-theme="dark"] a:hover {
  color: var(--primary);
}

html[data-theme="dark"] nav a {
  color: var(--muted);
}

html[data-theme="dark"] nav a:hover {
  color: var(--text);
}

html[data-theme="dark"] nav a.active {
  color: #e7f6b6;
}

html[data-theme="dark"] .nav-icon {
  background: #272c2f;
  color: #b8bfc2;
}

html[data-theme="dark"] .account-switch-form,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #1d2123;
}

html[data-theme="dark"] input:hover,
html[data-theme="dark"] select:hover,
html[data-theme="dark"] textarea:hover,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  background: #23282b;
  border-color: var(--primary-dark);
}

html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled {
  border-color: #2d3336;
  background: #181b1d;
  color: #777f83;
}

html[data-theme="dark"] th {
  background: #202427;
  color: #aeb5b8;
}

html[data-theme="dark"] tbody tr:hover:not(.connector-edit-row):not(.session-detail-row) {
  background: #202427;
}

html[data-theme="dark"] .day-option,
html[data-theme="dark"] .day-check,
html[data-theme="dark"] .filter-checks label {
  background: #1d2123;
}

html[data-theme="dark"] .day-option:hover,
html[data-theme="dark"] .day-check:hover,
html[data-theme="dark"] .filter-checks label:hover {
  background: #252a2d;
  border-color: #4a5358;
}

html[data-theme="dark"] .badge.info,
html[data-theme="dark"] .badge.ok {
  color: #c9ed62;
}

html[data-theme="dark"] .badge.warning,
html[data-theme="dark"] .badge.warn {
  color: #ffc978;
}

html[data-theme="dark"] .message,
html[data-theme="dark"] .warning-message {
  background: #2b331d;
  border-color: #697b32;
  color: var(--text);
}

html[data-theme="dark"] .error-message,
html[data-theme="dark"] .badge.error,
html[data-theme="dark"] .badge.err {
  background: var(--danger-soft);
}

html[data-theme="dark"] .spotplanner-plotly-host .modebar,
html[data-theme="dark"] .spotplanner-session-chart-host .modebar {
  background: rgba(25, 28, 31, .94) !important;
  border-color: var(--border-strong) !important;
}

html[data-theme="dark"] .spotplanner-plotly-host .modebar-btn path,
html[data-theme="dark"] .spotplanner-session-chart-host .modebar-btn path {
  fill: var(--text) !important;
}

html[data-theme="dark"] .leaflet-container {
  background: #171a1c;
}

html[data-theme="dark"] .leaflet-control-zoom a,
html[data-theme="dark"] .leaflet-control-attribution {
  background: #202427;
  color: var(--text);
  border-color: var(--border);
}

@media (max-width: 900px) {
  .brand img {
    width: 78px;
  }
}

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

html[data-theme="dark"] .chart-tooltip,
html[data-theme="dark"] .spotplanner-plotly-empty,
html[data-theme="dark"] .spotplanner-plotly-missing {
  background: rgba(25, 28, 31, .97);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Stronger profile-panel contrast in dark mode. */
html[data-theme="dark"] .fleet-select {
  background: linear-gradient(145deg, #343a3e, #292e31);
  border-color: #4b5459;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .profile-panel-link:hover,
html[data-theme="dark"] .profile-panel-link.active {
  background: linear-gradient(145deg, #3d4448, #303639);
  border-color: #667177;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .42);
}

/* Interaction fixes: stable controls, profile icon and table actions. */
button,
.button-link,
.profile-panel-link {
  transform: none;
}

button:hover,
button:active,
.button-link:hover,
.button-link:active,
.profile-panel-link:hover,
.profile-panel-link:active {
  transform: none;
}

html[data-theme="dark"] .profile-panel-icon .nav-icon {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--primary);
}

html[data-theme="dark"] td .button-link:not(.secondary),
html[data-theme="dark"] td .button-link:not(.secondary):hover,
html[data-theme="dark"] tbody tr:hover .button-link:not(.secondary) {
  color: #fff !important;
}


/* Events table alignment. */
.events-table-wrap {
  width: 100%;
  margin: 0 0 20px;
  border-radius: var(--radius-md);
}

.events-table-wrap table {
  width: 100%;
  min-width: 880px;
  margin: 0;
}

/* Empty data-table state. */
.table-empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  white-space: normal !important;
}


/* Unified application messages */
.message-info {
  background: #f3f8dc;
  border-color: #b9cf61;
  color: var(--text);
}

.message-warning,
.warning-message {
  background: #fff1d9;
  border-color: #e5ad55;
  color: #805000;
}

.message-error,
.error-message {
  background: #ffeded;
  border-color: #d88b88;
  color: var(--danger);
}

html[data-theme="dark"] .message-info {
  background: #2b331d;
  border-color: #697b32;
  color: var(--text);
}

html[data-theme="dark"] .message-warning,
html[data-theme="dark"] .warning-message {
  background: #3b2d1b;
  border-color: #8f6530;
  color: #ffd596;
}

html[data-theme="dark"] .message-error,
html[data-theme="dark"] .error-message {
  background: #3a2323;
  border-color: #8f4f4d;
  color: #ffaaa6;
}

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

/* Shared loading, action and paging states. */
.loading-state { display:flex; align-items:center; justify-content:center; gap:10px; min-height:120px; color:var(--muted); }
.loading-spinner,.button-spinner { width:16px; height:16px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:sp-spin .7s linear infinite; flex:0 0 auto; }
.button-spinner { width:13px; height:13px; }
@keyframes sp-spin { to { transform:rotate(360deg); } }
button:disabled,.button-link.disabled { opacity:.62; cursor:not-allowed; pointer-events:none; }
.pager { display:flex; align-items:center; justify-content:flex-end; gap:10px; margin:14px 0 4px; }
.pager .small { min-width:120px; text-align:center; }
.event-action { white-space:nowrap; }

/* Application confirmation dialog. */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 18, 20, .62);
  backdrop-filter: blur(3px);
}
.confirm-dialog {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
}
.confirm-dialog h2 { margin: 0 0 12px; }
.confirm-dialog p { margin: 0; white-space: pre-line; line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.disabled-action { display: inline-flex; cursor: not-allowed; }
.disabled-action > button { pointer-events: none; }

.selected-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: .88rem;
  font-weight: 700;
}

.date-chip button {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 1rem;
  line-height: 1;
}

.calendar-panel { overflow: hidden; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.calendar-header h2 { margin: 0; text-transform: capitalize; }
.calendar-weekdays,
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calendar-weekdays { margin-bottom: 8px; text-align: center; color: var(--muted); }
.calendar-weekdays strong { padding: 6px; font-size: .82rem; }
.calendar-day {
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}
.calendar-day span { font-weight: 850; }
.calendar-day small { color: var(--muted); font-size: .75rem; }
.calendar-day.outside-month { opacity: .42; }
.calendar-day.has-plans { border-color: rgba(132, 190, 0, .55); }
.calendar-day.selected { outline: 2px solid var(--primary); outline-offset: -2px; background: rgba(169, 217, 0, .10); }

@media (max-width: 720px) {
  .calendar-weekdays,
  .calendar-grid { gap: 4px; }
  .calendar-day { min-height: 58px; padding: 7px; border-radius: 10px; }
  .calendar-day small { display: none; }
}

/* Compact calendar page layout for common desktop monitor heights. */
.calendar-page-title {
  margin-bottom: 12px;
}

.calendar-page-toolbar {
  padding: 12px 14px;
  margin-bottom: 10px;
  gap: 10px;
}

.calendar-page-toolbar label {
  margin-bottom: 4px;
}

.calendar-panel {
  padding: 14px;
  margin-bottom: 10px;
}

.calendar-header {
  gap: 10px;
  margin-bottom: 8px;
}

.calendar-header button {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 11px;
}

.calendar-header h2 {
  font-size: 18px;
}

.calendar-weekdays,
.calendar-grid {
  gap: 5px;
}

.calendar-weekdays {
  margin-bottom: 4px;
}

.calendar-weekdays strong {
  padding: 3px 5px;
  font-size: .78rem;
}

.calendar-day {
  min-height: 52px;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 11px;
  line-height: 1.1;
}

.calendar-day span {
  font-size: .9rem;
}

.calendar-day small {
  font-size: .68rem;
  line-height: 1.1;
}

.calendar-panel + .calendar-detail-panel {
  margin-top: 0;
}

.calendar-detail-panel {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.calendar-detail-panel .section-header {
  margin-bottom: 10px;
}

.calendar-detail-panel .connector-create-row {
  grid-template-columns: minmax(190px, 1.6fr) repeat(4, minmax(105px, 1fr)) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.calendar-detail-panel .form-grid label {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: normal;
}

.calendar-detail-panel table th,
.calendar-detail-panel table td {
  padding-top: 9px;
  padding-bottom: 9px;
}

@media (max-width: 1180px) {
  .calendar-detail-panel .connector-create-row {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 720px) {
  .calendar-page-title {
    margin-bottom: 16px;
  }

  .calendar-page-toolbar,
  .calendar-panel,
  .calendar-detail-panel {
    padding: 14px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 58px;
    padding: 7px;
    border-radius: 10px;
  }

  .calendar-detail-panel .connector-create-row {
    grid-template-columns: 1fr;
  }
}


/* Shared portal visual system: keep Admin and User Web dimensions consistent. */
:root {
  --ui-content-width: 1400px;
  --ui-sidebar-width: 272px;
  --ui-panel-radius: 16px;
  --ui-control-radius: 11px;
  --ui-panel-padding: 18px;
  --ui-section-gap: 18px;
}

body {
  min-width: 320px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.shell {
  display: grid;
  grid-template-columns: var(--ui-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  width: auto;
  min-width: 0;
  height: 100vh;
  padding: 16px;
  position: sticky;
  top: 0;
  overflow: hidden;
  background: #fcfcfc;
  border-right: 1px solid var(--border);
  box-shadow: none;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin: 2px 0 16px;
  padding: 7px 10px 10px;
  color: var(--text);
  text-align: center;
  text-decoration: none;
}

.brand:hover,
.brand.active {
  color: var(--text);
  background: transparent;
}

.brand-logo {
  display: grid;
  place-items: center;
}

.brand-logo img {
  grid-area: 1 / 1;
}

.brand img,
.brand-logo img {
  width: 84px;
  height: auto;
  max-height: none;
  object-fit: contain;
}

.brand span {
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 850;
}

.fleet-select,
.admin-profile-panel {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  gap: 11px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #2c2c2c;
  border-radius: 16px;
  background: linear-gradient(145deg, #252525, #1c1c1c);
  color: #fff;
  box-shadow: 0 10px 22px rgba(23, 23, 23, .13);
  text-decoration: none;
}

.fleet-select strong,
.admin-profile-panel strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-select small,
.admin-profile-panel small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: rgba(255, 255, 255, .64);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-panel-icon {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.profile-panel-chevron {
  width: 8px;
  height: 8px;
  justify-self: center;
  border: 0;
  border-right: 2px solid rgba(255,255,255,.55);
  border-bottom: 2px solid rgba(255,255,255,.55);
  transform: rotate(-45deg);
}

.nav-section-label {
  margin: 4px 10px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  color: #696d71;
  font-size: 13.5px;
  font-weight: 690;
  text-decoration: none;
  transition: color .16s ease, background-color .16s ease, transform .16s ease;
}

nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

nav a.active {
  background: var(--primary-soft);
  color: #273000;
}

nav a.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 99px;
  background: var(--primary-dark);
}

.nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  background: #eef0f0;
  color: #55595d;
}

nav a.active .nav-icon {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 5px 13px rgba(121, 173, 0, .23);
}

.content {
  min-width: 0;
  max-width: none;
  padding: 28px clamp(22px, 3.2vw, 48px) 48px;
}

.content-inner {
  width: min(100%, var(--ui-content-width));
  margin: 0 auto;
}

h1 {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: -.025em;
  font-weight: 850;
}

h2 {
  margin: 0 0 13px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.28;
  letter-spacing: -.01em;
  font-weight: 800;
}

h3 {
  margin: 22px 0 10px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 800;
}

.panel,
.toolbar,
.card,
.stat-card,
.calendar-add-form {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(23, 23, 23, .04));
}

.panel {
  padding: var(--ui-panel-padding);
  margin-bottom: var(--ui-section-gap);
  border-radius: var(--ui-panel-radius);
}

.panel + .panel {
  margin-top: var(--ui-section-gap);
}

.panel h2:first-child,
.panel .section-header:first-child,
.panel .detail-header:first-child {
  margin-top: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 14px;
  margin-bottom: var(--ui-section-gap);
  border-radius: var(--ui-panel-radius);
}

.toolbar > div {
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
  padding: 14px;
  margin-bottom: var(--ui-section-gap);
  border: 1px solid var(--border);
  border-radius: var(--ui-panel-radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(23, 23, 23, .04));
}

/* Forms already placed in a panel must not render another full panel inside it. */
.panel > .form-grid,
.sub-detail-card > .form-grid,
.connector-edit-row .form-grid,
.session-detail-row .form-grid {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.panel > .form-grid:last-child,
.sub-detail-card > .form-grid:last-child {
  margin-bottom: 0;
}

.toolbar label,
.form-grid label,
.field-label {
  display: block;
  margin-bottom: 6px;
  color: #4b4f52;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 760;
  letter-spacing: .005em;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--ui-control-radius);
  background: #fbfbfb;
  color: var(--text);
  padding: 9px 11px;
}

button,
.button-link {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--ui-control-radius);
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
}

.detail-header,
.section-header,
.profile-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-header {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
}

.detail-header h2,
.section-header h2,
.profile-page-header h1 {
  margin: 0;
}

.detail-actions {
  gap: 8px;
  padding-top: 14px;
  margin-top: 14px;
}

.cards,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: var(--ui-section-gap);
}

.stat-card,
.card {
  position: relative;
  min-width: 0;
  padding: 15px 16px;
  border-radius: 14px;
  overflow: hidden;
}

.stat-card::before,
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}

.stat-card span,
.card span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 720;
}

.stat-card strong,
.card strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 850;
}

.card strong::after {
  display: none;
}

table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 13px;
  border-spacing: 0;
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

th {
  background: #f5f6f6;
  color: #62666a;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: .01em;
  text-transform: none;
}

.sort {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.table-actions,
.actions,
.actions-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.table-actions button,
.actions-cell button,
td .button-link {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 12px;
}

.sub-detail-card {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-muted);
  box-shadow: none;
}

/* Calendar uses one detail panel; its form and table are integrated, not extra cards. */
.calendar-page-title {
  margin-bottom: 12px;
}

.calendar-page-toolbar {
  padding: 12px 14px;
  margin-bottom: 10px;
}

.calendar-panel,
.calendar-detail-panel {
  padding: 14px 16px;
}

.calendar-header h2 {
  font-size: 17px;
}

.calendar-detail-panel .connector-create-row {
  padding: 0;
  margin-bottom: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.calendar-detail-panel > table {
  margin: 0;
  border-radius: 12px;
  box-shadow: none;
}

.calendar-detail-panel table th,
.calendar-detail-panel table td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.admin-logout-form button {
  width: 100%;
  margin-top: 12px;
}

html[data-theme="dark"] .sidebar {
  background: #15181a;
}

html[data-theme="dark"] nav a.active {
  color: #e7f6b6;
}

html[data-theme="dark"] .toolbar label,
html[data-theme="dark"] .form-grid label,
html[data-theme="dark"] .field-label {
  color: #c5cbce;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #1d2123;
}

html[data-theme="dark"] th {
  background: #23282b;
  color: #c1c7ca;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .sidebar {
    padding: 12px;
  }

  .sidebar-inner {
    min-height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .content {
    padding: 24px 22px 42px;
  }

  nav a {
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-inner {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .brand {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin: 0 0 10px;
    padding: 4px;
  }

  .brand img,
  .brand-logo img {
    width: 58px;
  }

  .brand span {
    font-size: 17px;
  }

  .fleet-select,
  .admin-profile-panel {
    width: min(100%, 360px);
    margin-bottom: 10px;
  }

  .nav-section-label {
    display: none;
  }

  nav {
    flex-direction: row;
    gap: 6px;
    margin: 2px -4px 0;
    padding: 4px 4px 7px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  nav a {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 6px 10px 6px 7px;
  }

  nav a:hover {
    transform: none;
  }

  nav a.active::before {
    display: none;
  }

  .content {
    padding: 22px 16px 38px;
  }

  h1 {
    font-size: 26px;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding-inline: 12px;
  }

  .fleet-select,
  .admin-profile-panel {
    width: 100%;
  }

  nav a span:last-child {
    display: none;
  }

  nav a {
    padding: 6px;
  }

  .content {
    padding: 18px 12px 32px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 17px;
  }

  .panel,
  .calendar-panel,
  .calendar-detail-panel {
    padding: 14px;
  }

  th,
  td {
    padding: 10px 11px;
  }
}

/* Shared component refinements used by both portals. */
.profile-panel-copy {
  min-width: 0;
}

.account-switch-form {
  display: grid;
  gap: 5px;
  margin: 0 0 14px;
  padding: 0 2px;
}

.account-switch-form label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.detail-panel {
  border-top: 3px solid var(--primary);
}

.related-object-panel {
  background: var(--surface);
}

.segmented-nav {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-muted);
}

button.segmented {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

button.segmented:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

button.segmented.active {
  border-color: var(--primary-dark);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(121, 173, 0, .16);
}

.badge {
  display: inline-block;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.badge.info,
.badge.ok {
  border-color: rgba(121, 173, 0, .20);
  background: var(--primary-soft);
  color: #557900;
}

.badge.warning,
.badge.warn {
  border-color: rgba(243, 154, 25, .22);
  background: rgba(243, 154, 25, .13);
  color: #8a5500;
}

.badge.error,
.badge.err {
  border-color: rgba(200, 63, 59, .18);
  background: var(--danger-soft, #fff2f1);
  color: var(--danger);
}

.message,
.message-stack .message {
  border-radius: 13px;
  box-shadow: var(--shadow-lg, 0 18px 48px rgba(23, 23, 23, .10));
}

.message-warning,
.warning-message {
  background: #fff1d9;
  border-color: #e5ad55;
  color: #805000;
}

.message-error,
.error-message {
  background: #ffeded;
  border-color: #d88b88;
  color: var(--danger);
}

.checkbox-label,
.day-option,
.day-check,
.filter-checks label {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
}

.checkbox-label input,
.day-option input,
.day-check input,
.filter-checks input {
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.location-picker {
  grid-column: 1 / -1;
}

.location-map {
  height: 340px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 13px;
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 9px 18px;
  margin: 0;
}

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

.detail-list dd {
  min-width: 0;
  margin: 0;
  font-size: 13px;
}

.auth-shell {
  background:
    radial-gradient(circle at 12% 8%, rgba(169, 217, 0, .13), transparent 30%),
    var(--bg);
}

.auth-panel {
  width: min(440px, 100%);
  padding: 26px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg, 0 18px 48px rgba(23, 23, 23, .10));
}

.auth-logo {
  display: block;
  width: 112px;
  height: auto;
  margin: 0 auto 16px;
}

.auth-panel h1 {
  margin-bottom: 18px;
  font-size: 27px;
  text-align: center;
}

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

.settings-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.settings-section-header h2,
.settings-section-header p {
  margin-top: 0;
}

.settings-section-header p {
  margin-bottom: 0;
}

.theme-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 280px));
  gap: 12px;
}

button.theme-option {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 14px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--text);
  box-shadow: none;
  text-align: left;
}

button.theme-option:hover,
button.theme-option.active {
  border-color: var(--primary-dark);
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: none;
}

.chart-wrap,
.spot-price-chart-host,
.statistics-chart-host,
.spotplanner-plotly-host {
  border-radius: 13px;
}

.spotplanner-plotly-host .modebar {
  border-color: var(--border) !important;
  border-radius: 9px !important;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(23, 23, 23, .04)) !important;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.events-table-wrap {
  width: 100%;
  margin: 0 0 var(--ui-section-gap);
  border-radius: 13px;
}

.events-table-wrap table {
  width: 100%;
  min-width: 880px;
  margin: 0;
}

.table-empty {
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
  white-space: normal !important;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin: 13px 0 3px;
}

.pager .small {
  min-width: 110px;
  text-align: center;
}

.confirm-dialog {
  width: min(500px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
}

.confirm-dialog h2 {
  margin: 0 0 10px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

html[data-theme="dark"] .checkbox-label,
html[data-theme="dark"] .day-option,
html[data-theme="dark"] .day-check,
html[data-theme="dark"] .filter-checks label {
  background: #1d2123;
}

html[data-theme="dark"] .badge.info,
html[data-theme="dark"] .badge.ok {
  color: #c9ed62;
}

html[data-theme="dark"] .badge.warning,
html[data-theme="dark"] .badge.warn {
  color: #ffc978;
}

@media (max-width: 900px) {
  .panel > table,
  .content-inner > table,
  .sub-detail-card > table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
  }
}

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

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

  .segmented-nav {
    width: 100%;
  }

  button.segmented {
    flex: 1 1 auto;
  }
}
/* Final portal design audit: shared visual tokens, alignment and component behavior. */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-muted: #f7f8f8;
  --surface-hover: #f0f2f2;
  --dark-panel: #202020;
  --dark-panel-soft: #343434;
  --text: #171717;
  --text-soft: #424242;
  --muted: #74787d;
  --border: #e5e7e8;
  --border-strong: #d9dcde;
  --primary: #a9d900;
  --primary-dark: #79ad00;
  --primary-soft: rgba(169, 217, 0, .12);
  --accent: #f39a19;
  --danger: #c83f3b;
  --danger-soft: #fff2f1;
  --focus-ring: 0 0 0 4px rgba(169, 217, 0, .20);
  --shadow-sm: 0 1px 2px rgba(23, 23, 23, .04), 0 4px 12px rgba(23, 23, 23, .03);
  --shadow: 0 8px 24px rgba(23, 23, 23, .055);
  --shadow-lg: 0 18px 48px rgba(23, 23, 23, .10);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
}

.sidebar {
  z-index: 30;
}

.brand {
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
}

.brand img,
.brand-logo img {
  width: 84px;
}

.profile-panel-copy {
  display: grid;
  min-width: 0;
}

.profile-panel-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
}

.profile-panel-icon .nav-icon {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.fleet-select,
.admin-profile-panel {
  margin-bottom: 14px;
  transform: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.fleet-select small,
.admin-profile-panel small {
  letter-spacing: normal;
  text-transform: none;
}

.fleet {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h7V4h2v3h7v13H4zm3 3v7h3v-7zm7 0v7h3v-7z'/%3E%3C/svg%3E");
}

.content-inner > :first-child {
  margin-top: 0;
}

.content-inner > h1,
.profile-page-header {
  margin-bottom: 20px;
}

p {
  line-height: 1.5;
}

.small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.panel,
.toolbar,
.form-grid,
.card,
.stat-card,
.calendar-add-form {
  box-shadow: var(--shadow-sm);
}

.panel {
  overflow: visible;
}

.panel > :last-child {
  margin-bottom: 0;
}

.section-header,
.detail-header,
.profile-page-header,
.settings-section-header {
  min-width: 0;
}

.section-header > *,
.detail-header > *,
.profile-page-header > *,
.settings-section-header > * {
  min-width: 0;
}

.section-header h2,
.detail-header h2,
.profile-page-header h1 {
  overflow-wrap: anywhere;
}

.section-header > .small,
.detail-header > .small {
  flex: 0 0 auto;
  text-align: right;
}

.toolbar,
.form-grid {
  align-items: end;
}

.toolbar > div,
.form-grid > div {
  min-width: 0;
}

.toolbar > div:has(> button:only-child),
.form-grid > div:has(> button:only-child),
.form-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.toolbar label,
.form-grid label,
.calendar-detail-panel .form-grid label,
.field-label {
  margin-bottom: 6px;
  color: #4b4f52;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 760;
  letter-spacing: .005em;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--ui-control-radius);
  background: #fbfbfb;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

textarea {
  resize: vertical;
}

select {
  cursor: pointer;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #c7cbcd;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-dark);
  background: #fff;
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  border-color: var(--border);
  background: #f0f1f1;
  color: #8b8f92;
  opacity: 1;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--primary-dark);
  background: var(--primary);
  color: #fff;
  font: inherit;
  text-decoration: none;
  box-shadow: 0 5px 13px rgba(121, 173, 0, .17);
  transform: none;
  transition: box-shadow .14s ease, background-color .14s ease, border-color .14s ease, color .14s ease;
}

button:hover,
.button-link:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 8px 18px rgba(121, 173, 0, .22);
  transform: none;
}

button:focus-visible,
.button-link:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

button.secondary,
.button-link.secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover,
.button-link.secondary:hover {
  border-color: #c4c8ca;
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: none;
}

button.danger,
.button-link.danger,
.icon-btn.danger {
  border-color: rgba(200, 63, 59, .22);
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
}

button.danger:hover,
.button-link.danger:hover,
.icon-btn.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  box-shadow: none;
}

button:disabled,
.button-link.disabled {
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: .55;
}

.link-button,
.sort {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.link-button {
  color: var(--text);
}

.sort {
  color: inherit;
}

.link-button:hover,
.sort:hover {
  background: transparent;
  box-shadow: none;
  color: var(--primary-dark);
}

.checkbox-label,
.day-option,
.day-check,
.filter-checks label {
  min-height: 42px;
  margin: 0;
  padding: 8px 10px;
  vertical-align: bottom;
  transition: border-color .15s ease, background-color .15s ease;
}

.filter-checks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.related-object-panel {
  margin-top: 18px;
}

.stats-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card,
.stat-card {
  min-height: 92px;
}

.card span,
.stat-card span {
  margin-bottom: 6px;
}

.card strong,
.stat-card strong {
  font-size: 22px;
}

table {
  margin: 0;
  table-layout: auto;
}

.content-inner > table,
.toolbar + table,
.content-inner > .table-scroll {
  margin-bottom: var(--ui-section-gap);
}

.panel > table,
.sub-detail-card > table,
.table-scroll > table {
  margin-bottom: 0;
}

th,
td {
  border-bottom-color: var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  white-space: normal;
}

tbody tr:last-child > td {
  border-bottom: 0;
}

tbody tr:hover:not(.connector-edit-row):not(.session-detail-row) > td {
  background: #fafbfb;
}

.table-actions,
.actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 7px;
}

/* Keep table cells as table cells; only their inner action wrapper is flex. */
td.actions-cell {
  display: table-cell;
  width: 1%;
  white-space: nowrap;
}

td:has(> .table-actions),
td:has(> .actions) {
  width: 1%;
  white-space: nowrap;
}

.table-actions button,
.table-actions .button-link,
.actions button,
.actions .button-link,
td .button-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.sub-detail-card {
  border-color: var(--border);
}

.table-scroll {
  border-radius: 13px;
}

.table-empty {
  height: 74px;
  vertical-align: middle;
}

.pager {
  min-height: 40px;
}

.pager button {
  min-width: 86px;
}

.message,
.message-stack .message {
  line-height: 1.45;
}

.auth-logo {
  width: 112px;
  max-height: 60px;
  margin-bottom: 16px;
  object-fit: contain;
}

.account-switch-form {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.account-switch-form label {
  opacity: 1;
  letter-spacing: normal;
  text-transform: none;
}

.calendar-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
}

.calendar-header h2 {
  text-align: center;
}

.calendar-header button {
  width: 40px;
  min-width: 40px;
  height: 38px;
  padding: 0;
}

.calendar-weekdays strong {
  font-weight: 760;
}

.calendar-day {
  width: 100%;
  box-shadow: none;
}

.calendar-day:hover {
  border-color: var(--primary-dark);
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: none;
}

.calendar-day.selected:hover {
  background: var(--primary-soft);
}

.chart-wrap,
.spot-price-chart-host,
.statistics-chart-host,
.spotplanner-plotly-host {
  width: 100%;
  min-height: 620px;
  overflow: visible;
}

.spotplanner-plotly-chart {
  width: 100%;
  height: 560px;
  min-height: 560px;
}

.spotplanner-plotly-host .modebar {
  background: rgba(255, 255, 255, .92) !important;
  border: 1px solid rgba(17, 24, 39, .10) !important;
}

.spotplanner-plotly-host .modebar-btn {
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  border-radius: 7px !important;
}

.theme-preview {
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] {
  --bg: #101214;
  --surface: #191c1f;
  --surface-muted: #222629;
  --surface-hover: #2a2f32;
  --dark-panel: #0c0e0f;
  --dark-panel-soft: #25292c;
  --text: #f3f5f5;
  --text-soft: #c7ccce;
  --muted: #9ba3a7;
  --border: #30363a;
  --border-strong: #3c4449;
  --primary: #a9d900;
  --primary-dark: #8fc200;
  --primary-soft: rgba(169, 217, 0, .15);
  --accent: #ffad38;
  --danger: #ff746e;
  --danger-soft: rgba(255, 116, 110, .12);
  --focus-ring: 0 0 0 4px rgba(169, 217, 0, .23);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28), 0 5px 14px rgba(0, 0, 0, .16);
  --shadow: 0 10px 28px rgba(0, 0, 0, .22);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .sidebar {
  background: #141719;
}

html[data-theme="dark"] .toolbar label,
html[data-theme="dark"] .form-grid label,
html[data-theme="dark"] .calendar-detail-panel .form-grid label,
html[data-theme="dark"] .field-label {
  color: #c5cbce;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  border-color: var(--border-strong);
  background: #1d2123;
}

html[data-theme="dark"] input:hover,
html[data-theme="dark"] select:hover,
html[data-theme="dark"] textarea:hover,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: var(--primary-dark);
  background: #23282b;
}

html[data-theme="dark"] tbody tr:hover:not(.connector-edit-row):not(.session-detail-row) > td {
  background: #202427;
}

html[data-theme="dark"] button.secondary,
html[data-theme="dark"] .button-link.secondary {
  background: var(--surface-muted);
}

html[data-theme="dark"] .warning-message,
html[data-theme="dark"] .message-warning {
  background: #3b2d1b;
}

html[data-theme="dark"] .error-message,
html[data-theme="dark"] .message-error,
html[data-theme="dark"] .badge.error,
html[data-theme="dark"] .badge.err {
  background: var(--danger-soft);
}

@media (max-width: 900px) {
  .brand img,
  .brand-logo img {
    width: 58px;
  }

  .fleet-select,
  .admin-profile-panel {
    display: inline-grid;
  }

  nav {
    padding-bottom: 7px;
  }

  .section-header,
  .detail-header,
  .profile-page-header,
  .settings-section-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .chart-wrap,
  .spot-price-chart-host,
  .statistics-chart-host,
  .spotplanner-plotly-host {
    min-height: 540px;
  }

  .spotplanner-plotly-chart {
    height: 500px;
    min-height: 500px;
  }
}

@media (max-width: 620px) {
  h1 {
    margin-bottom: 18px;
  }

  .panel,
  .toolbar,
  .form-grid,
  .auth-panel {
    border-radius: 14px;
  }

  .section-header,
  .detail-header,
  .profile-page-header,
  .settings-section-header {
    flex-direction: column;
  }

  .section-header > .small,
  .detail-header > .small {
    text-align: left;
  }

  .detail-actions {
    justify-content: stretch;
  }

  .detail-actions button,
  .detail-actions .button-link {
    flex: 1 1 auto;
  }

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

  .calendar-header button {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .chart-wrap,
  .spot-price-chart-host,
  .statistics-chart-host,
  .spotplanner-plotly-host,
  .spotplanner-plotly-chart {
    min-height: 440px;
    height: 440px;
  }
}


/* Design-audit corrections for selectors that previously retained portal-specific values. */
html {
  scroll-behavior: smooth;
}

p {
  color: var(--text-soft);
}

input:hover,
select:hover,
textarea:hover {
  background: #fff;
}

button:focus-visible,
.button-link:focus-visible,
a:focus-visible {
  box-shadow: none;
}

button.segmented {
  border-color: transparent;
}

button.segmented:hover {
  box-shadow: none;
}

.calendar-add-form {
  padding: 16px;
  border-radius: var(--ui-panel-radius);
}

.chart-wrap {
  position: relative;
  cursor: default;
}

.content-inner > table,
.panel > table,
.sub-detail-card > table {
  max-width: 100%;
}

.profile-page-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-page-header h1 .nav-icon {
  background: var(--primary-soft);
}

.operations-addresses tbody th {
  width: 180px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.operations-addresses code {
  overflow-wrap: anywhere;
  white-space: normal;
}

.operations-addresses .small {
  margin-top: 14px;
}

.admin-profile-summary p {
  margin: 4px 0 0;
}

.admin-profile-summary h2 {
  margin-bottom: 6px;
}

.spotplanner-plotly-host .modebar-btn:hover {
  background: rgba(169, 217, 0, .18) !important;
}

@media (max-width: 620px) {
  .toolbar {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .auth-panel {
    padding: 16px;
  }

  .section-header,
  .detail-header,
  .profile-page-header {
    align-items: flex-start;
  }

  .detail-actions {
    width: 100%;
  }

  .operations-addresses tbody th {
    width: auto;
  }
}

.actions-cell {
  white-space: normal;
}

td.actions-cell {
  white-space: nowrap;
}

table {
  margin-bottom: 0;
}

/* Calendar multi-vehicle selection and grouped plan rows. */
.vehicle-multi-select {
  position: relative;
  min-width: 0;
}

.vehicle-multi-select details {
  position: relative;
}

.vehicle-multi-select summary {
  list-style: none;
}

.vehicle-multi-select summary::-webkit-details-marker {
  display: none;
}

.vehicle-multi-select-summary {
  min-height: 42px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.vehicle-multi-select-summary:hover,
.vehicle-multi-select details[open] > .vehicle-multi-select-summary {
  border-color: var(--primary);
}

.vehicle-multi-select-summary.disabled {
  color: var(--muted);
  background: var(--surface-muted);
  cursor: default;
}

.vehicle-multi-select-chevron {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
  transition: transform .16s ease;
}

.vehicle-multi-select details[open] .vehicle-multi-select-chevron {
  transform: rotate(180deg);
}

.vehicle-multi-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(420px, 85vw);
  max-height: 280px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.vehicle-multi-select-option {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.vehicle-multi-select-option:hover {
  background: var(--surface-muted);
}

.vehicle-multi-select-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary-dark);
}

.calendar-plan-vehicles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

/* Action buttons in every table stay on one line; the table scrolls when needed. */
.table-actions,
.actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}

table .detail-actions,
td.actions-cell {
  flex-wrap: nowrap;
  white-space: nowrap;
}


/* Primary create action shown directly below a list page title. */
.page-create-action {
  display: flex;
  align-items: center;
  margin: -8px 0 18px;
}

/* Modal editors. They are removed from the document flow and block the entire page. */
.calendar-detail-header > div,
.table-editor-panel-header > div {
  min-width: 0;
}

.calendar-detail-header .small {
  display: block;
  margin-top: 3px;
}

.editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19000;
  display: grid;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: rgba(15, 18, 20, .62);
  backdrop-filter: blur(4px);
}

.table-editor-panel {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  margin: 0;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 48%, var(--border));
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34);
}

.table-editor-panel.editor-dialog-wide {
  width: min(840px, 100%);
}

.table-editor-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.table-editor-panel-header h3 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 18px;
  line-height: 1.3;
}


.table-editor-panel > .detail-actions {
  margin-top: 18px;
}

.table-editor-content {
  position: relative;
  min-width: 0;
  overflow-x: auto;
}

html[data-theme="dark"] .table-editor-panel {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .56);
}

@media (max-width: 760px) {
  .editor-backdrop {
    place-items: start center;
    padding: 12px;
  }

  .table-editor-panel {
    max-height: calc(100vh - 24px);
    padding: 16px;
  }

  .table-editor-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .table-editor-panel-header > button {
    align-self: flex-start;
  }
}
