:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --border: #dbe3ec;
  --text: #18212f;
  --muted: #64748b;
  --primary: #32c24a;
  --primary-strong: #33964b;
  --primary-soft: #e7f5f2;
  --danger: #c2410c;
  --danger-soft: #fff7ed;
  --ok: #15803d;
  --ok-soft: #ecfdf5;
  --warn: #a16207;
  --warn-soft: #fefce8;
  --shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Circe", Arial, Helvetica, sans-serif;
  font-size: 16px;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding: 14px 16px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1em;
  text-decoration: none;
}

.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pagename {
  margin-bottom: 22px;
}

.pagename-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagename-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pagename-badges.is-right {
  margin-left: auto;
}

.pagename-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  border: 1px solid #dcfce7;;
}

.pagename-badge:hover {
  background: #dcfce7;
}

.pagename-badge.is-muted {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
}

.pagename-badge.is-muted:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.pagename-badge.is-ai {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.pagename-badge.is-ai:hover {
  border-color: #60a5fa;
  background: #dbeafe;
  color: #1e40af;
}

.brand-head {
  display: grid;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  line-height: 1em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: block;
  flex: 0 0 34px;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.main-nav,
.account-nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.main-nav {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.admin-menu {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  order: 3;
}

.admin-menu-group {
  display: grid;
  gap: 5px;
}

.admin-menu-label {
  padding-left: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.admin-menu-group .main-nav {
  padding: 3px;
}

.nav-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

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

.user-pill {
  min-height: 34px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.12;
  text-decoration: none;
}

.user-pill:hover,
.user-pill[aria-current="page"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.user-pill small {
  align-self: flex-start;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.logout-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.logout-link:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.mini-button.is-danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.mini-button.is-danger:hover {
  border-color: #ef4444;
  background: #fee2e2;
  color: #991b1b;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 4px;
  font-size: 20px;
  line-height: 1.2;
}

.layout {
  display: grid;
  grid-template-columns: minmax(480px, 520px) 1fr;
  gap: 18px;
  align-items: stretch;
}

.analysis-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls,
.summary-panel,
.dashboard-filter-panel,
.chart-panel,
.events-panel,
.ai-dispatcher-panel,
.api-data-panel,
.debug-panel {
  padding: 20px;
}

.field {
  margin-bottom: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.analysis-controls {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

.analysis-controls[hidden] {
  display: none;
}

.analysis-manual-controls {
  display: grid;
  gap: 14px;
}

.analysis-controls-row {
  display: grid;
  gap: 12px;
  align-items: end;
}

.analysis-unit-row {
  grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1.45fr);
}

.analysis-controls.has-debug-unit .analysis-unit-row {
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.35fr) minmax(160px, 0.45fr);
}

.analysis-period-row {
  grid-template-columns: minmax(220px, 260px) minmax(220px, 260px) minmax(120px, 1fr);
  align-items: end;
}

.analysis-period-limit {
  min-height: 44px;
  display: flex;
  align-items: center;
  margin: 0;
  white-space: nowrap;
}

.analysis-quick-periods {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.analysis-quick-periods-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-quick-period-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.analysis-quick-periods.report-period-actions .mini-button.is-active {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.analysis-quick-periods.report-period-actions .mini-button.is-active:hover {
  border-color: #4ade80;
  background: #bbf7d0;
  color: #14532d;
}

.quick-period-settings-button {
  margin-left: auto;
}

.quick-period-settings-button[hidden] {
  display: none;
}

.analysis-controls .field {
  margin-bottom: 0;
}

.analysis-actions-row .primary-button {
  min-height: 44px;
  white-space: nowrap;
}

.analysis-actions-row {
  display: flex;
  align-items: center;
}

.ai-schedule-create {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
}

.ai-schedule-create[hidden] {
  display: none;
}

.ai-schedule-create-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ai-schedule-create-copy {
  display: grid;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.ai-schedule-create-copy > span {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.ai-schedule-create-copy > strong {
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
}

.secondary-button.ai-schedule-create-toggle {
  width: auto;
  min-width: 112px;
  flex: 0 0 auto;
  min-height: 36px;
  margin-top: 0;
  justify-content: center;
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.secondary-button.ai-schedule-create-toggle:hover {
  border-color: #60a5fa;
  background: #bfdbfe;
  color: #1e40af;
}

.ai-schedule-create-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px minmax(120px, auto);
  gap: 10px;
  align-items: end;
}

.ai-schedule-create-controls[hidden] {
  display: none;
}

.ai-schedule-time-field input {
  min-width: 0;
}

.ai-schedule-analysis-options {
  display: grid;
  grid-column: 1 / 3;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.ai-schedule-analysis-types,
.ai-schedule-analysis-limit {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.ai-schedule-analysis-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0;
}

.ai-schedule-analysis-option input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  padding: 0;
  margin: 0;
  accent-color: #2563eb;
}

.ai-schedule-event-limit {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  max-width: none;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 0;
  min-width: 0;
}

.ai-schedule-event-limit span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ai-schedule-event-limit input {
  width: 52px;
  min-height: 28px;
  height: 28px;
  flex: 0 0 52px;
  padding: 4px 7px;
  text-align: center;
}

.ai-schedule-event-limit input:disabled {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  opacity: 1;
  -webkit-text-fill-color: #1e3a8a;
}

.ai-schedule-analysis-limit p {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.secondary-button.ai-schedule-save {
  min-height: 44px;
  margin-top: 0;
  justify-content: center;
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  align-self: center;
}

.secondary-button.ai-schedule-save:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.ai-schedule-save-status {
  grid-column: 1 / -1;
  min-height: 16px;
  margin: 0;
}

.analysis-controls-note {
  margin: 0;
}

.analysis-assistant-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
}

.analysis-assistant-card .badge.is-disconnected {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #b91c1c;
}

.form-note.ai-assistant-beta-note {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.4;
}

.ai-assistant-beta-note a {
  color: #991b1b;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-assistant-beta-note a:hover {
  color: #7f1d1d;
}

.ai-schedules-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.ai-schedule-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.84);
}

.ai-schedule-item.is-paused {
  opacity: 0.66;
}

.ai-schedule-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ai-schedule-item-head strong {
  min-width: 0;
  color: #1e3a8a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.ai-schedule-item-head .badge {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
}

.ai-schedule-item-meta {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.ai-schedule-item-meta b {
  color: #334155;
}

.ai-schedule-last-run {
  flex-basis: 100%;
}

.ai-schedule-ai-mode {
  flex-basis: 100%;
  color: #1d4ed8;
}

.ai-schedule-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  flex-wrap: wrap;
}

.ai-schedule-item-actions-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-left: auto;
  flex-wrap: wrap;
}

.ai-schedule-item-actions .ai-schedule-icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  flex: 0 0 28px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 18px;
}

.ai-schedule-item-actions .ai-schedule-icon-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.ai-schedule-icon-button[data-ai-schedule-action="edit"] {
  font-size: 15px;
}

.ai-schedule-icon-button[data-ai-schedule-action="delete"] {
  font-size: 21px;
}

.ai-schedule-item-actions .ai-schedule-icon-button.is-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.ai-schedule-item-actions .ai-schedule-icon-button.is-danger:hover {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.ai-schedule-item-actions .mini-button {
  min-height: 28px;
  margin-top: 0;
  padding: 4px 7px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
}

.ai-schedule-item-actions .mini-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.ai-schedule-item-actions .mini-button.is-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.ai-schedule-item-actions .mini-button.is-primary:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.ai-schedule-item-actions .mini-button.is-danger-soft {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.ai-schedule-item-actions .mini-button.is-danger-soft:hover {
  border-color: #fca5a5;
  background: #fee2e2;
}

.analysis-assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.analysis-assistant-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analysis-assistant-head h3 {
  margin: 2px 0 0;
  color: #1d4ed8;
  font-size: 18px;
  line-height: 1.15;
}

.ai-assistant-info {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.ai-assistant-info span {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.ai-assistant-info strong {
  color: #334155;
  font-size: 13px;
  line-height: 1.25;
}

.ai-assistant-period-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.ai-assistant-info .ai-assistant-period-line > span {
  color: #475569;
  font-size: 13px;
  font-weight: 400;
}

.ai-assistant-period {
  color: #475569;
  font-size: 13px;
  line-height: 1.35;
}

.ai-assistant-period b {
  color: #1e293b;
}

.secondary-button.analysis-assistant-run {
  width: 100%;
  justify-content: center;
  margin-top: auto;
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.secondary-button.analysis-assistant-run:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.quick-period-settings-panel {
  width: min(760px, 100%);
}

.quick-period-system-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #f8fafc;
}

.quick-period-system-row > span:not(.badge) {
  color: var(--muted);
}

.quick-period-settings-form {
  display: grid;
  gap: 10px;
}

.quick-period-settings-head,
.quick-period-settings-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 130px 36px;
  gap: 8px;
  align-items: center;
}

.quick-period-settings-head {
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-period-settings-rows {
  display: grid;
  gap: 8px;
}

.quick-period-settings-row input {
  min-width: 0;
}

.icon-button.quick-period-remove {
  width: 36px;
  height: 36px;
  padding: 0;
  border-color: #fecaca;
  color: #b91c1c;
}

.icon-button.quick-period-remove:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.quick-period-add-button {
  justify-self: start;
}

.quick-period-settings-actions {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(120px, 160px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.quick-period-settings-actions .primary-button,
.quick-period-settings-actions .secondary-button {
  width: 100%;
  margin-top: 0;
}

.ai-dispatcher-panel {
  border-color: #93c5fd;
  background: #eff6ff;
}

.ai-dispatcher-panel .section-head {
  align-items: flex-start;
}

.ai-dispatcher-panel .section-head p {
  margin-bottom: 0;
}

.ai-dispatcher-panel h2 {
  color: #1d4ed8;
}

.ai-dispatcher-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.ai-dispatcher-filters {
  display: grid;
  grid-template-columns: minmax(210px, 1.4fr) minmax(145px, 0.7fr) minmax(145px, 0.7fr) minmax(150px, 0.75fr) minmax(160px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.ai-dispatcher-filters.has-client-filter {
  grid-template-columns: minmax(210px, 1.4fr) minmax(145px, 0.7fr) minmax(145px, 0.7fr) minmax(150px, 0.75fr) minmax(160px, 0.8fr) auto;
}

.ai-dispatcher-client-filter {
  grid-column: 1 / -1;
  width: min(100%, 420px);
}

.ai-admin-schedule-filter-panel {
  padding: 20px;
  margin-bottom: 14px;
}

.ai-admin-schedule-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(180px, 0.45fr) auto auto;
  gap: 10px;
  align-items: end;
}

.ai-admin-schedule-filters .field {
  min-width: 0;
  margin: 0;
}

.ai-admin-schedule-submit,
.ai-admin-schedule-reset {
  width: auto;
  min-width: 110px;
  margin: 0;
}

.ai-admin-schedules-table th {
  text-transform: none;
  white-space: nowrap;
}

.ai-admin-schedules-table td {
  vertical-align: top;
}

@media (max-width: 900px) {
  .ai-admin-schedule-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .ai-admin-schedule-filters {
    grid-template-columns: 1fr;
  }

  .ai-admin-schedule-submit,
  .ai-admin-schedule-reset {
    width: 100%;
  }
}

.form-note.ai-dispatcher-archive-note {
  margin: 0 0 20px;
  padding: 10px 12px;
  border: 1px solid #fca5a5;
  border-radius: 7px;
  background: #fff1f2;
  color: #b91c1c;
}

.ai-dispatcher-filters .field {
  min-width: 0;
  margin-bottom: 0;
}

.ai-dispatcher-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
}

.ai-dispatcher-filter-actions .mini-button {
  height: 38px;
  min-height: 38px;
  margin-top: 0;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .ai-dispatcher-filters,
  .ai-dispatcher-filters.has-client-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .ai-dispatcher-filters,
  .ai-dispatcher-filters.has-client-filter {
    grid-template-columns: 1fr;
  }

  .ai-dispatcher-filter-actions {
    width: 100%;
  }

  .ai-dispatcher-filter-actions .mini-button {
    flex: 1 1 0;
  }
}

.ai-dispatcher-last-run {
  display: grid;
  gap: 2px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-dispatcher-period {
  display: grid;
  gap: 2px;
  white-space: nowrap;
}

.ai-dispatcher-last-run b {
  color: #1e293b;
  font-size: 13px;
}

.icon-button.ai-dispatcher-refresh {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  font-size: 20px;
}

.icon-button.ai-dispatcher-refresh:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.ai-dispatcher-table {
  border-collapse: separate;
  border-spacing: 0 6px;
}

.ai-dispatcher-table {
  --ai-dispatcher-columns: minmax(150px, 1fr) minmax(145px, 0.9fr) minmax(100px, 0.8fr) minmax(80px, 0.6fr) minmax(90px, 0.65fr) minmax(90px, 0.7fr);
}

.ai-dispatcher-table th,
.ai-dispatcher-table td {
  border-bottom: 0;
  background: transparent;
}

.ai-dispatcher-table thead th {
  box-shadow: none;
}

.ai-dispatcher-table thead tr {
  display: grid;
  grid-template-columns: var(--ai-dispatcher-columns);
}

.ai-dispatcher-table thead th {
  display: block;
  padding: 11px 10px;
}

.ai-dispatcher-table thead th:last-child {
  text-align: right;
}

.ai-dispatcher-run-row > td {
  padding: 0;
  background: transparent;
}

.ai-dispatcher-run-card {
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
}

.ai-dispatcher-run-summary {
  display: grid;
  grid-template-columns: var(--ai-dispatcher-columns);
  gap: 0;
  align-items: center;
}

.ai-dispatcher-run-summary > div {
  padding: 11px 10px;
  font-size: 14px;
}

.ai-dispatcher-run-summary > div:last-child {
  text-align: right;
}

.ai-dispatcher-run-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.ai-dispatcher-run-actions .mini-button,
.ai-dispatcher-run-actions .refueling-delete-button {
  margin-top: 0;
}

.ai-dispatcher-run-delete {
  flex: 0 0 30px;
}

.ai-dispatcher-event-result {
  display: grid;
  justify-items: start;
  gap: 3px;
}

.ai-dispatcher-event-result > div {
  display: grid;
  gap: 1px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.ai-dispatcher-event-result.is-drain .is-actual,
.ai-dispatcher-event-result.is-refuel .is-false {
  color: #b91c1c;
}

.ai-dispatcher-event-result.is-drain .is-false,
.ai-dispatcher-event-result.is-refuel .is-actual {
  color: #15803d;
}

.ai-dispatcher-event-result .is-not-enough {
  color: #64748b;
}

.ai-dispatcher-run-check {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-width: 0;
}

.ai-dispatcher-run-date {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.ai-dispatcher-run-date span {
  color: #64748b;
  font-size: 12px;
}

.ai-dispatcher-run-name {
  max-width: 100%;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ai-dispatcher-run-client {
  max-width: 100%;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-dispatcher-run-mode.badge {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
}

.ai-dispatcher-run-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.ai-dispatcher-run-badges .badge {
  width: 82px;
  height: 22px;
  min-height: 22px;
  flex: 0 0 82px;
  padding: 2px 7px;
  justify-content: center;
  box-sizing: border-box;
  font-size: 10px;
  line-height: 1;
}

.ai-dispatcher-run-mode.is-scheduled {
  border-color: #bfdbfe;
  background: #dbeafe;
  color: #1d4ed8;
}

.ai-dispatcher-run-mode.is-manual {
  border-color: #dbe2ea;
  background: #f1f5f9;
  color: #475569;
}

.ai-dispatcher-run-badges .ai-dispatcher-run-new {
  min-height: 22px;
  padding: 2px 7px;
  border-color: #fca5a5;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 800;
}

.ai-dispatcher-units {
  padding: 0 10px 10px;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.ai-dispatcher-run-card.is-open .ai-dispatcher-run-summary {
  border-bottom: 1px solid #e2e8f0;
}

.ai-dispatcher-load-more-row {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.ai-dispatcher-load-more {
  min-width: 150px;
  justify-content: center;
  text-align: center;
}

.ai-dispatcher-units-grid {
  display: grid;
  gap: 6px;
  --ai-dispatcher-unit-columns: var(--ai-dispatcher-columns);
}

.ai-dispatcher-units-head,
.ai-dispatcher-unit-row {
  display: grid;
  grid-template-columns: var(--ai-dispatcher-unit-columns);
  align-items: center;
}

.ai-dispatcher-units-head > div {
  padding: 8px 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.ai-dispatcher-units-head > div:last-child,
.ai-dispatcher-unit-row > div:last-child {
  text-align: right;
}

.ai-dispatcher-unit-row {
  margin-bottom: 2px;
  border-radius: 7px;
  background: #f8fafc;
  transition: background-color 0.15s ease;
}

.ai-dispatcher-unit-row:hover {
  background: #eff6ff;
}

.ai-dispatcher-unit-row > div {
  min-width: 0;
  padding: 11px 10px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.ai-dispatcher-unit-analysis {
  display: grid;
  gap: 2px;
  margin-top: 4px;
  color: #2563eb;
  font-size: 11px;
  line-height: 1.3;
}

.ai-dispatcher-unit-analysis.is-completed {
  color: #15803d;
}

.ai-dispatcher-unit-analysis.is-warning {
  color: #b91c1c;
}

.ai-dispatcher-unit-analysis small {
  color: inherit;
  font-size: 11px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
  cursor: pointer;
  font-size: 14px;
}

.mode-option input {
  width: auto;
  min-height: 0;
}

.advanced-fields {
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.advanced-fields summary {
  cursor: pointer;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.advanced-fields .field-grid {
  margin-top: 12px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.combobox {
  position: relative;
}

.combobox input {
  padding-right: 42px;
}

.combobox-clear {
  position: absolute;
  right: 8px;
  top: 7px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.combobox-clear:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.combobox-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 310px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.combobox-option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.combobox-option:hover,
.combobox-option.is-active {
  background: var(--primary-soft);
}

.combobox-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.combobox-option small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.combobox-option mark {
  border-radius: 4px;
  background: #fef3c7;
  color: inherit;
}

.combobox-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary-button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--primary-strong);
  cursor: pointer;
  font-weight: 800;
}

.secondary-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.secondary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-top: 10px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.mini-button.is-repeat {
  border: 1px solid #d0d5dd;
  background: #f2f4f7;
  color: #475467;
}

.mini-button.is-repeat:hover {
  background: #eaecf0;
  color: #344054;
}

button.event-ai-button {
  min-height: 34px;
  margin-top: 0;
  border: 1px solid rgba(37, 99, 235, 0.5);
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

button.event-ai-button.is-drain {
  border-color: rgba(37, 99, 235, 0.5);
  background: #eff6ff;
  color: #1d4ed8;
}

button.event-ai-button.is-refuel {
  border-color: rgba(37, 99, 235, 0.5);
  background: #eff6ff;
  color: #1d4ed8;
}

button.event-ai-button:hover {
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.1);
}

button.event-ai-button.is-drain:hover {
  border-color: rgba(29, 78, 216, 0.68);
  background: #dbeafe;
}

button.event-ai-button.is-refuel:hover {
  border-color: rgba(29, 78, 216, 0.68);
  background: #dbeafe;
}

button.event-ai-button.is-repeat {
  border-color: rgba(37, 99, 235, 0.32);
  background: #f8fbff;
  color: #1e40af;
}

button.event-ai-button.is-repeat:hover {
  border-color: rgba(29, 78, 216, 0.52);
  background: #eff6ff;
  color: #1d4ed8;
}

.event-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.event-filter-button {
  min-height: 32px;
  margin-top: 0;
  border: 1px solid transparent;
}

.event-filter-button.is-all {
  background: #f2f4f7;
  color: #475467;
}

.event-filter-button.is-drain {
  border-color: rgba(180, 35, 24, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.event-filter-button.is-refuel {
  border-color: rgba(6, 118, 71, 0.28);
  background: var(--ok-soft);
  color: var(--ok);
}

.event-filter-button.is-active {
  border-color: currentColor;
}

.mini-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.icon-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--primary-strong);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-stack .mini-button {
  margin-top: 0;
}

.sync-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.form-note,
.muted,
.section-head p,
.empty-state p {
  color: var(--muted);
}

.form-note {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.4;
}

.error {
  margin-top: 12px;
  color: #b91c1c;
  font-weight: 700;
}

.success-note {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 800;
}

.inline-link {
  color: var(--primary-strong);
  font-weight: 800;
}

.status-pill,
.badge,
.type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  font-weight: 800;
}

.status-pill {
  min-height: 34px;
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.status-pill.is-ok {
  background: var(--ok-soft);
  border-color: #bbf7d0;
  color: var(--ok);
}

.status-pill.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.empty-state {
  min-height: 206px;
  display: flex;
  flex-direction: column;
  justify-content: top;
}

.module-unavailable {
  padding: 20px;
}

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

.summary-title {
  margin-bottom: 16px;
}

.summary-title span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-title h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 24px;
}

.kpi {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.kpi span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.kpi strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.dashboard-kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-kpi-grid .kpi {
  min-height: 72px;
  padding: 10px 12px;
}

.dashboard-kpi-grid .kpi span {
  margin-bottom: 6px;
  font-size: 12px;
}

.dashboard-kpi-grid .kpi strong {
  font-size: 22px;
}

.dashboard-kpi-meta {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-list-actions,
.dashboard-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-list-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.dashboard-page-size select {
  width: auto;
  min-width: 60px;
  height: 32px;
  min-height: 32px;
  padding: 4px 24px 4px 8px;
  font-size: 13px;
}

#units-panel .dashboard-list-actions .mini-button,
#units-panel .dashboard-list-actions .badge,
#units-panel .dashboard-list-actions select {
  box-sizing: border-box;
  height: 32px;
  min-height: 32px;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
}

.dashboard-modules-section {
  margin-top: 18px;
}

.dashboard-modules-head {
  margin-bottom: 12px;
}

.dashboard-modules-head h2,
.dashboard-module-card h2 {
  margin: 0;
}

.dashboard-modules-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.dashboard-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-module-card {
  min-width: 0;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: var(--text);
  box-shadow: 0 8px 24px rgb(15 23 42 / 6%);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.dashboard-module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgb(15 23 42 / 10%);
}

.dashboard-module-card h2 {
  color: var(--text);
}

.dashboard-module-card-head,
.dashboard-module-card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-module-card-head .badge {
  flex: 0 0 auto;
  border: 1px solid #bbf7d0;
  background: #ffffff;
  color: var(--text);
}

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

.dashboard-module-card-head .badge.is-connected {
  border-color: #16a34a;
  background: #16a34a;
  color: #ffffff;
}

.dashboard-module-card-head .badge.is-free {
  border-color: #eab308;
  background: #facc15;
  color: #422006;
}

.dashboard-module-card-head .badge.is-ai-enabled {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.dashboard-module-card-head .badge.is-ai-disabled {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
}

.dashboard-module-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-module-description {
  flex: 1;
  margin: 14px 0 18px;
  color: var(--text);
  line-height: 1.25;
}

.dashboard-module-card-footer {
  align-items: flex-end;
  padding-top: 14px;
  border-top: 1px solid #bbf7d0;
}

.dashboard-module-count span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-module-count strong {
  font-size: 26px;
  line-height: 1;
}

.dashboard-module-count strong small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.dashboard-module-link {
  margin-top: 0;
  border-color: #86efac;
  background: #ffffff;
  color: #166534;
  text-decoration: none;
}

.dashboard-module-link:hover {
  color: #166534;
  filter: brightness(0.92);
}

.dashboard-module-card.is-disabled {
  border-color: var(--border);
  background: #ffffff;
  color: var(--text);
  opacity: 0.5;
}

.dashboard-module-card.is-disabled h2,
.dashboard-module-card.is-disabled .dashboard-module-eyebrow,
.dashboard-module-card.is-disabled .dashboard-module-description,
.dashboard-module-card.is-disabled .dashboard-module-count span,
.dashboard-module-card.is-disabled .dashboard-module-count strong {
  color: var(--text);
}

.dashboard-module-card.is-disabled .dashboard-module-card-footer {
  border-top-color: var(--border);
}

.dashboard-module-card.is-disabled .dashboard-module-card-head .badge {
  border-color: var(--border);
  background: #f1f5f9;
  color: var(--text);
}

.dashboard-module-card.is-disabled .dashboard-module-link,
.dashboard-module-card.is-disabled .dashboard-module-link:hover {
  background: #f1f5f9;
  color: var(--text);
}

.module-access-table th {
  vertical-align: top;
}

.module-access-table input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.module-access-price {
  margin-top: 5px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.module-access-price > span {
  display: block;
  margin-top: 1px;
}

.module-access-price > .module-access-free {
  color: #15803d;
}

.module-access-cell {
  display: grid;
  min-width: 100px;
  gap: 5px;
}

.module-access-option {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.module-access-option.is-ai {
  color: #7c3aed;
}

.module-access-option.is-planned {
  color: var(--muted);
  font-weight: 600;
}

.ai-quota-admin-panel {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
}

.ai-quota-admin-head {
  margin-bottom: 12px;
}

.ai-quota-admin-head h2,
.ai-quota-admin-head p {
  margin: 0;
}

.ai-quota-admin-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.ai-quota-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-quota-summary > div {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff;
}

.ai-quota-summary span,
.ai-quota-summary strong {
  display: block;
}

.ai-quota-summary span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ai-quota-summary strong {
  font-size: 18px;
}

.ai-quota-pack-form {
  display: grid;
  grid-template-columns: 130px 160px minmax(220px, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.ai-quota-pack-form .field,
.ai-quota-pack-form .mini-button {
  margin: 0;
}

.ai-quota-pack-form .mini-button {
  min-height: 42px;
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.ai-quota-pack-list {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.ai-quota-pack-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, .7fr) minmax(100px, .6fr) minmax(150px, .8fr);
  gap: 12px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
}

.ai-quota-pack-row small {
  color: var(--muted);
  text-align: right;
}

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

  .dashboard-module-card-head,
  .dashboard-module-card-footer {
    gap: 12px;
  }

  .ai-quota-pack-form,
  .ai-quota-summary,
  .ai-quota-pack-row {
    grid-template-columns: 1fr;
  }

  .ai-quota-pack-row small {
    text-align: left;
  }
}

.dashboard-report-kpi-grid {
  grid-template-columns: minmax(280px, 420px);
}

.kpi-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-split > div + div {
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.kpi-split span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}

.kpi-split strong {
  font-size: 22px;
}

.kpi-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14);
}

.kpi-status-dot.is-online {
  background: var(--ok);
}

.kpi-status-dot.is-offline {
  background: #98a2b3;
}

.kpi-status-dot.is-danger {
  background: var(--danger);
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.badge {
  min-height: 30px;
  padding: 5px 10px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
}

.badge.is-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.chart-panel,
.dashboard-filter-panel,
.events-panel,
.api-data-panel,
.debug-panel {
  margin-top: 18px;
}

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

.activation-modal[hidden] {
  display: none;
}

body.has-update-announcement {
  overflow: hidden;
}

.update-announcement-modal {
  z-index: 1000;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}

.update-announcement-card {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
  border-color: #bfdbfe;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.update-announcement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.update-announcement-label {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.update-announcement-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
}

.update-announcement-body {
  margin-top: 20px;
  color: #334155;
  font-size: 16px;
  line-height: 1.6;
}

.update-announcement-body > :first-child {
  margin-top: 0;
}

.update-announcement-body > :last-child {
  margin-bottom: 0;
}

.update-announcement-body h3,
.update-announcement-body h4 {
  margin: 20px 0 8px;
  color: var(--ink);
  line-height: 1.25;
}

.update-announcement-body p {
  margin: 0 0 12px;
}

.update-announcement-body ul,
.update-announcement-body ol {
  margin: 10px 0 14px;
  padding-left: 24px;
}

.update-announcement-body li + li {
  margin-top: 5px;
}

.update-announcement-body blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 4px solid #93c5fd;
  background: #eff6ff;
  color: #1e3a5f;
}

.update-announcement-body a {
  color: #1d4ed8;
  font-weight: 700;
}

.update-announcement-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

.update-announcement-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.update-announcement-actions .primary-button {
  min-width: 150px;
  margin: 0;
}

.announcement-form textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
}

.announcement-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.announcement-form-actions .primary-button,
.announcement-form-actions .secondary-button {
  margin: 0;
}

.announcement-form-actions #announcement-cancel {
  grid-column: 1 / -1;
}

.announcement-html-note code {
  color: #334155;
  font-size: 12px;
}

.announcement-admin-layout .summary-panel > p:not(.form-note) {
  margin: 14px 0 0;
  color: #334155;
  line-height: 1.5;
}

.announcement-table-excerpt {
  max-width: 560px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.announcements-table td:last-child {
  min-width: 220px;
}

@media (max-width: 620px) {
  .update-announcement-modal {
    align-items: end;
    padding: 12px;
  }

  .update-announcement-card {
    max-height: calc(100vh - 24px);
    padding: 22px;
  }

  .update-announcement-actions .primary-button {
    width: 100%;
  }

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

  .announcement-form-actions #announcement-cancel {
    grid-column: auto;
  }
}

.activation-panel {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
}

.ai-analysis-confirm-panel {
  width: min(460px, 100%);
}

.ai-analysis-confirm-panel .section-head {
  margin-bottom: 14px;
}

.ai-analysis-confirm-panel .section-head h2,
.ai-analysis-confirm-panel .section-head p,
.ai-analysis-confirm-note {
  margin: 0;
}

.ai-analysis-confirm-panel .section-head p {
  margin-top: 5px;
  color: #b42318;
  font-weight: 700;
}

.ai-analysis-confirm-note {
  color: var(--muted);
}

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

.ai-analysis-confirm-actions .primary-button,
.ai-analysis-confirm-actions .secondary-button {
  min-height: 40px;
  margin: 0;
}

.modal-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

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

.activation-form .field {
  margin-bottom: 0;
}

.activation-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(140px, 180px);
  gap: 10px;
  align-items: center;
}

.activation-actions .primary-button,
.activation-actions .secondary-button {
  width: 100%;
  margin-top: 0;
}

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

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

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

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pager .mini-button {
  margin-top: 0;
}

.line,
.dot {
  display: inline-block;
}

.line {
  width: 22px;
  height: 3px;
  border-radius: 99px;
  background: var(--primary);
}

.line.processed-fuel {
  background: #dc2626;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

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

.dot.drain {
  background: var(--danger);
}

.fuel-chart {
  width: 100%;
  min-height: 260px;
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(#fff, #fbfdff);
}

.wialon-chart-frame {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.wialon-chart-image {
  width: 100%;
  min-width: 820px;
  display: block;
}

.axis {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.axis-label {
  fill: var(--muted);
  font-size: 13px;
}

.axis-label.end {
  text-anchor: end;
}

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

.processed-fuel-line {
  fill: none;
  stroke: #dc2626;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 7 5;
}

.processed-fuel-point {
  fill: #dc2626;
  stroke: #fff;
  stroke-width: 1;
}

.event-marker {
  stroke: #fff;
  stroke-width: 2;
}

.event-marker.refuel {
  fill: var(--ok);
}

.event-marker.drain {
  fill: var(--danger);
}

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

.dashboard-table-wrap {
  overflow: visible;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(240px, 1fr);
  gap: 12px;
  align-items: end;
}

.dashboard-filters .field {
  margin-bottom: 0;
}

.dashboard-report-period {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) 1fr;
  align-items: end;
  gap: 12px;
  padding-top: 4px;
}

.report-selected-unit-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.selected-units-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: min(100%, 480px);
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #e2e8f0;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: left;
}

.selected-units-button:hover {
  border-color: #94a3b8;
  background: #cbd5e1;
}

.selected-units-button.is-empty {
  border-color: #fda29b;
  background: #fee4e2;
  color: #b42318;
}

.selected-units-button.is-empty:hover {
  border-color: #f04438;
  background: #fecdca;
}

.report-selected-unit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border-radius: 7px;
  overflow-wrap: anywhere;
  background: #e2e8f0;
  color: var(--text);
}

.report-selected-unit-remove {
  display: inline-grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.report-selected-unit-remove:hover {
  background: #cbd5e1;
  color: var(--text);
}

.report-selected-units {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.report-period-actions .mini-button {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.report-period-actions .mini-button:hover {
  background: #e2e8f0;
  color: #334155;
}

.report-period-actions .mini-button.is-active {
  border-color: #94a3b8;
  background: #e2e8f0;
  color: #1f2937;
}

.report-build-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.report-result-title {
  margin: 0;
}

.report-summary-table th,
.report-summary-table td {
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.report-summary-table {
  border-collapse: separate;
  border-spacing: 0 1px;
}

.report-summary-table th {
  text-transform: none;
}

.report-value-marker {
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 999px;
  vertical-align: 1px;
}

.report-value-marker.is-engine {
  background: #f6b756;
}

.report-value-marker.is-idle {
  background: #ee7b73;
}

.report-value-marker.is-useful {
  background: #63c985;
}

.report-value-marker.is-rest {
  background: #cbd5e1;
}

.engine-hours-chart {
  display: grid;
  gap: 8px;
}

.engine-hours-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.engine-hours-chart-head strong {
  color: var(--text);
}

.engine-hours-bar {
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.engine-hours-segment {
  min-width: 0;
  height: 100%;
}

.engine-hours-segment.is-idle,
.engine-hours-legend i.is-idle {
  background: #ee7b73;
}

.engine-hours-segment.is-useful,
.engine-hours-legend i.is-useful {
  background: #63c985;
}

.engine-hours-legend i.is-engine {
  background: #f6b756;
}

.engine-hours-segment.is-rest,
.engine-hours-legend i.is-rest {
  background: #cbd5e1;
}

.engine-hours-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 13px;
}

.engine-hours-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.engine-hours-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 9px;
}

.engine-hours-details {
  display: grid;
  gap: 8px;
}

.engine-hours-details summary {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  list-style: none;
  border-bottom: 1px dotted currentColor;
}

.engine-hours-details summary::-webkit-details-marker {
  display: none;
}

.engine-hours-details summary::before {
  content: "›";
  font-size: 18px;
  line-height: 1;
}

.engine-hours-details[open] summary::before {
  content: "⌄";
}

.report-details-table th,
.report-details-table td {
  padding: 7px 8px;
  font-size: 14px;
}

.engine-timeline {
  display: grid;
  gap: 4px;
}

.engine-timeline-note {
  color: #64748b;
  font-size: 12px;
}

.engine-timeline-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.engine-timeline-scale strong {
  color: var(--text);
}

.engine-timeline-row {
  display: block;
}

.engine-timeline-stack {
  position: relative;
  margin-top: 16px;
  overflow: visible;
  border-radius: 3px;
  background: #e5e7eb;
}

.engine-timeline-labels {
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
}

.engine-timeline-start-label {
  position: absolute;
  top: 0;
  transform: translateX(-2px);
  color: #64748b;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.engine-timeline-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  background: transparent;
}

.engine-timeline-track.is-engine {
  height: 9px;
  background: transparent;
}

.engine-timeline-interval {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  min-width: 4px;
  overflow: hidden;
  border-left: 1px solid #fff;
  border-right: 1px solid #fff;
}

.engine-timeline-run-interval {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 4px;
  border-left: 1px solid #fff;
  border-right: 1px solid #fff;
  background: #f6b756;
}

.dashboard-report-units-table > tbody > tr.is-selected > td {
  background: #e8f6ee;
}

.dashboard-inline-report {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-inline-report[hidden] {
  display: none;
}

.dashboard-inline-report .empty-state {
  min-height: 0;
}

.trips-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.trips-kpis > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f1f5f9;
}

.trips-kpis span { color: var(--muted); font-size: 12px; }
.trips-kpis strong { font-size: 17px; }

.ttn-route-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
}

.ttn-route-summary > div { display: grid; gap: 3px; }
.ttn-route-summary span { color: #64748b; font-size: 11px; }
.ttn-route-summary strong { font-size: 14px; }

.ttn-comparison {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  background: #f0fdf4;
}

.ttn-comparison.is-violation { border-color: #fecaca; background: #fef2f2; }
.ttn-comparison.is-attention { border-color: #fde68a; background: #fffbeb; }
.ttn-comparison.is-insufficient_data { border-color: #fde68a; background: #fffbeb; }
.ttn-comparison-head { display: flex; justify-content: space-between; gap: 12px; }
.ttn-comparison-head span { color: var(--muted); font-size: 12px; }
.ttn-comparison-metrics { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; }
.ttn-comparison ul { margin: 10px 0 0; padding-left: 18px; }
.ttn-comparison li + li { margin-top: 4px; }
.ttn-comparison p { margin: 10px 0 0; }
.ttn-comparison .ttn-check-error {
  color: #dc2626;
  font-weight: 800;
}
.trip-parking-number {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  border-radius: 5px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}
.trip-parking-number.is-exceeded {
  background: #dc2626;
  color: #ffffff;
}

.trips-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.trips-map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.trips-map-legend i { width: 18px; height: 4px; border-radius: 2px; }
.trips-map-legend .is-planned { background: #3b82f6; }
.trips-map-legend .is-actual { background: #22a455; }
.trips-map-legend .is-parking { width: 9px; height: 9px; background: #94a3b8; }

.trips-timeline {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.trips-timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

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

.trips-timeline-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.trips-timeline-legend .is-trip { background: #86c99d; }
.trips-timeline-legend .is-parking { background: #94a3b8; }

.trips-timeline-stack {
  position: relative;
  margin-top: 16px;
  margin-bottom: 16px;
  overflow: visible;
}

.trips-timeline-labels {
  position: absolute;
  top: -15px;
  right: 0;
  left: 0;
  height: 14px;
  pointer-events: none;
}

.trips-timeline-label {
  position: absolute;
  top: 0;
  transform: translateX(-2px);
  color: #64748b;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.trips-timeline-duration-labels {
  position: absolute;
  right: 0;
  bottom: -15px;
  left: 0;
  height: 14px;
  pointer-events: none;
}

.trips-timeline-duration {
  position: absolute;
  bottom: 0;
  transform: translateX(2px);
  color: #64748b;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.trips-timeline-track {
  position: relative;
  height: 20px;
  overflow: hidden;
  border-radius: 3px;
  background: #e5e7eb;
}

.trips-timeline-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 3px;
  border-right: 1px solid #fff;
  border-left: 1px solid #fff;
}

.trips-timeline-segment.is-trip { background: #86c99d; }
.trips-timeline-segment.is-parking { background: #94a3b8; }
.trips-timeline-segment.is-trip.is-highlighted {
  background: #22a455;
  box-shadow: inset 0 0 0 2px #15803d;
}

.trips-map {
  width: 100%;
  height: 420px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
}

.trips-map .empty-note { padding: 18px; }

.trips-map-popup {
  display: grid;
  max-width: 280px;
  gap: 4px;
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 12px;
  line-height: 1.35;
}

.trips-map-popup strong { font-size: 14px; }
.trips-map-popup span,
.trips-map-popup small { color: #64748b; }
.trips-map-popup a { margin-top: 3px; color: #2563eb; }

.trips-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.trips-columns section { min-width: 0; }
.trips-columns h3 { margin: 0 0 8px; font-size: 15px; }
.ttn-check-result {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.trips-data-table {
  border-collapse: separate;
  border-spacing: 0 1px;
}

.trips-data-table th {
  border-bottom: 0;
  box-shadow: none;
  text-transform: none;
}
.trips-data-table td { vertical-align: top; }
.trips-data-table > tbody > .trips-trip-row > td {
  border-bottom: 0;
  background: #f1f5f9;
}
.trips-data-table tbody td:first-child { border-radius: 7px 0 0 7px; }
.trips-data-table tbody td:last-child { border-radius: 0 7px 7px 0; }
.trips-data-table > tbody > .trips-trip-row:hover > td { background: #e8f6ee; }
.trips-trip-row { cursor: pointer; }
.trips-data-table > tbody > .trips-trip-row.is-map-highlighted > td { background: #e8f6ee; }
.trips-data-table > tbody > .trips-trip-row.is-selected-trip > td { background: #dcfce7; }
.trips-trip-row:focus { outline: none; }

.trips-trip-row.has-parking td:first-child { border-radius: 7px 0 0; }
.trips-trip-row.has-parking td:last-child { border-radius: 0 7px 0 0; }
.trips-data-table > tbody > .trips-parking-row > td {
  border-bottom: 3px solid #ffffff;
  background: #eff6ff;
  vertical-align: middle;
}
.trips-parking-row {
  cursor: pointer;
  outline: none;
}
.trips-parking-row td:first-child {
  border-radius: 0 0 0 7px;
}
.trips-parking-row td:last-child { border-radius: 0 0 7px; }
.trips-parking-row-content {
  display: flex;
  align-items: center;
  gap: 8px;
}
.trips-parking-label {
  color: var(--muted);
  font-size: 12px;
}
.trips-parking-place { color: #334155; }
.trips-trip-row:hover + .trips-parking-row td,
.trips-trip-row.is-map-highlighted + .trips-parking-row td { background: #dbeafe; }
.trips-trip-row.is-selected-trip + .trips-parking-row td { background: #dbeafe; }
.trips-data-table > tbody > .trips-parking-row:hover > td,
.trips-data-table > tbody > .trips-parking-row:focus > td,
.trips-data-table > tbody > .trips-parking-row.is-map-selected > td { background: #bfdbfe; }
.trips-data-table > tbody > .trips-parking-row.is-exceeded > td {
  background: #fef2f2;
}
.trips-data-table > tbody > .trips-parking-row.is-exceeded:hover > td,
.trips-data-table > tbody > .trips-parking-row.is-exceeded:focus > td,
.trips-data-table > tbody > .trips-parking-row.is-exceeded.is-map-selected > td {
  background: #fee2e2;
}

.ttn-editor {
  grid-column: 3;
  grid-row: 2;
  align-self: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
}

.ttn-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.ttn-form .field { grid-column: span 3; margin-bottom: 0; }
.ttn-form .ttn-address-field { grid-column: span 6; }
.ttn-form .ttn-parameter-field { grid-column: span 2; }

.ttn-address-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ttn-address-control .mini-button {
  align-self: stretch;
  white-space: nowrap;
}

.ttn-point-status {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.ttn-period-date-time {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
}

.ttn-field-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ttn-point-status.is-manual {
  color: var(--primary-strong);
  font-weight: 700;
}

.ttn-point-status.is-error {
  color: #b91c1c;
  font-weight: 700;
}

.ttn-address-control input.is-error {
  border-color: #dc2626;
  outline-color: #dc2626;
}

.ttn-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ttn-selection-status {
  overflow-wrap: anywhere;
}

.ttn-selection-status.is-selected {
  color: var(--text);
  font-weight: 800;
}

.ttn-form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ttn-form-actions > .primary-button {
  flex: 0 0 50%;
  width: 50%;
}

.ttn-new-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.dashboard-report-period.is-ttn {
  grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr);
  align-items: start;
}

.dashboard-report-period.is-ttn .ttn-editor { grid-column: 1; }
.ttn-period-fields {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  align-self: start;
  gap: 10px;
}

.ttn-period-help {
  padding: 12px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.ttn-period-help ol {
  margin: 0;
  padding-left: 20px;
}

.ttn-period-help li + li { margin-top: 4px; }
.ttn-period-help p {
  margin: 10px 0 0;
  color: var(--text);
  font-weight: 700;
}
.ttn-results { margin-top: 14px; }

.ttn-build-actions {
  margin-top: 14px;
}

.ttn-build-actions .primary-button {
  width: 100%;
}

.ttn-checks-register {
  min-width: 0;
}

.ttn-checks-table {
  min-width: 1080px;
}

.ttn-check-grid {
  display: grid;
  grid-template-columns:
    minmax(100px, 0.75fr)
    minmax(150px, 1.25fr)
    minmax(145px, 1fr)
    minmax(130px, 1fr)
    minmax(230px, 1.5fr)
    170px;
  gap: 12px;
  align-items: center;
}

.ttn-checks-head {
  padding: 11px 10px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.ttn-checks-body {
  display: grid;
  gap: 10px;
}

.ttn-check-card {
  padding: 11px 10px;
  border-radius: 8px;
  background: #f8fafc;
  transition: background-color 0.15s ease;
}

.ttn-check-card:hover {
  background: #f1f5f9;
}

.ttn-check-card.is-selected,
.ttn-check-card.is-selected:hover {
  background: #e8f6ee;
}

.ttn-check-card .dashboard-inline-report {
  margin-top: 14px;
}

.ttn-check-summary > div {
  min-width: 0;
}

.ttn-check-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.ttn-check-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.ttn-check-status.is-ok {
  background: #dcfce7;
  color: #166534;
}

.ttn-check-status.is-warning {
  background: #fee2e2;
  color: #b91c1c;
}

.ttn-check-status.is-muted {
  background: #e2e8f0;
  color: #64748b;
}

.ttn-check-select-button.is-selected {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
}

.ttn-check-select-button.is-selected:hover {
  border-color: #4ade80;
  background: #bbf7d0;
}

.ttn-check-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.ttn-saved-check-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.ttn-saved-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
}

.ttn-saved-card[hidden] { display: none; }
.ttn-saved-card h3 { margin: 3px 0 0; font-size: 16px; }
.ttn-saved-card dl { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.ttn-saved-card dl div { min-width: 0; }
.ttn-saved-card dt { color: var(--muted); font-size: 11px; }
.ttn-saved-card dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.ttn-documents-modal-panel {
  width: min(1040px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
}

.units-modal-panel {
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
}

.units-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ttn-documents { min-width: 0; }
.ttn-documents .empty-note { margin: 0; }
.ttn-documents-table th { text-transform: none; }
.ttn-documents-table td { vertical-align: top; }
.ttn-documents-table tr.is-selected td { background: #ecfdf3; }

.ttn-point-modal-panel {
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
}

.ttn-point-name-field {
  margin-bottom: 12px;
}

.ttn-point-name-field small {
  display: block;
  margin-top: 4px;
}

.ttn-point-map {
  width: 100%;
  height: min(58vh, 520px);
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: #e2e8f0;
}

.ttn-point-modal-footer,
.ttn-point-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ttn-point-modal-footer {
  justify-content: space-between;
  margin-top: 12px;
}

.ttn-point-modal-actions .primary-button {
  width: auto;
  margin-top: 0;
}

@media (max-width: 800px) {
  .ttn-form { grid-template-columns: 1fr; }
  .ttn-form .field,
  .ttn-form .ttn-address-field,
  .ttn-form .ttn-parameter-field { grid-column: auto; }
  .ttn-saved-card dl { grid-template-columns: 1fr; }
  .ttn-form-actions { align-items: stretch; flex-direction: column; }
  .ttn-form-actions > .primary-button { flex-basis: auto; width: 100%; }
  .ttn-top-actions {
    margin-left: 0;
  }
  .ttn-address-control { grid-template-columns: 1fr; }
  .ttn-point-map { min-height: 300px; }
  .ttn-point-modal-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .ttn-point-modal-actions { justify-content: flex-end; }
}

@media (max-width: 1100px) {
  .dashboard-report-period.is-ttn { grid-template-columns: 1fr; }
  .dashboard-report-period.is-ttn .ttn-editor { grid-column: 1 / -1; grid-row: auto; }
  .dashboard-report-period.is-ttn .ttn-period-fields { grid-column: 1 / -1; grid-row: auto; }
}
.trips-table-section { margin-top: 16px; }
.trips-table-section h3 { margin: 0 0 8px; font-size: 15px; }

@media (max-width: 900px) {
  .trips-columns { grid-template-columns: 1fr; }
  .trips-map { height: 340px; }
}

@media (max-width: 560px) {
  .trips-kpis { grid-template-columns: 1fr; }
  .ttn-route-summary { grid-template-columns: 1fr 1fr; }
  .trips-map { height: 300px; }
}

.refueling-time,
.refueling-fuel {
  display: grid;
  gap: 4px;
}

.refuelings-table {
  table-layout: fixed;
  width: 100%;
}

.refuelings-time-column {
  width: 14%;
}

.refuelings-data-column {
  width: 28%;
}

.refuelings-ai-column {
  width: 25%;
}

.refuelings-actions-column {
  width: 5%;
}

.refueling-time span,
.refueling-fuel span,
.refueling-fuel small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.refueling-time span {
  font-weight: 700;
}

.refueling-fuel-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.refueling-fuel .badge {
  background: #fff;
  color: var(--ok);
  font-size: 14px;
  font-weight: 900;
}

.refueling-location {
  max-width: 760px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.refueling-gps {
  display: grid;
  gap: 4px;
  line-height: 1.45;
}

.refueling-gps > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.refueling-gps .refueling-gps-warning {
  color: var(--danger);
  font-weight: 700;
}

.refueling-gps-coordinates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.refueling-map-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.refueling-map-link:hover {
  background: #f1f5f9;
}

.refueling-ai-result {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.refueling-ai-result p {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.refueling-ai-status {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.refueling-ai-result.is-matched .refueling-ai-status {
  background: #dcfce7;
  color: #166534;
}

.refueling-ai-result.is-mismatch .refueling-ai-status {
  background: #fee2e2;
  color: #991b1b;
}

.refueling-ai-result.is-insufficient_data .refueling-ai-status {
  background: #fef3c7;
  color: #92400e;
}

.refueling-ai-progress {
  font-size: 12px;
}

.refueling-ai-distance {
  font-size: 12px;
}

.refueling-delete-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border-color: #fed7aa;
  border-style: solid;
  border-width: 1px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.refueling-delete-button:hover {
  background: #ffedd5;
}

.refueling-actions-cell {
  text-align: center;
  vertical-align: middle;
}

.refueling-unit-heading,
.refueling-unit-heading-main,
.refueling-unit-heading-total {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refueling-total-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.refueling-total-badge {
  background: #fff;
  color: var(--text);
}

.refueling-unit-heading {
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
}

.refueling-unit-heading-main {
  min-width: 0;
  flex-wrap: wrap;
}

.refueling-unit-heading-total {
  margin-left: auto;
  white-space: nowrap;
}

.unit-report-select-state {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.unit-report-select-state.is-added {
  color: var(--ok);
}

.refueling-add-button {
  margin-top: 0;
  margin-left: 10px;
}

.refueling-toggle-button {
  display: inline-flex;
  width: auto;
  min-height: 30px;
  padding: 4px 9px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.refueling-toggle-button:hover,
.refueling-toggle-button.is-expanded {
  background: #f1f5f9;
  color: var(--text);
}

.refueling-manual-panel {
  margin-top: 12px;
  padding: 14px;
  border-radius: 6px;
  background: #f8fafc;
}

.refueling-manual-panel[hidden] {
  display: none;
}

.refuelings-list-filters {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 420px);
  gap: 12px;
  align-items: end;
  margin: 12px 0 14px;
}

.refuelings-list-filters .field {
  margin-bottom: 0;
}

@media (max-width: 700px) {
  .refuelings-list-filters {
    grid-template-columns: 1fr;
  }
}

.refueling-manual-create-form {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(180px, 220px) minmax(260px, 1fr);
  align-items: end;
  gap: 12px;
}

.refueling-manual-create-form .field {
  margin-bottom: 0;
}

.refueling-manual-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.refueling-manual-status {
  font-size: 12px;
}

.refueling-actual-cell {
  width: 260px;
}

.refueling-actual-form {
  display: grid;
  grid-template-columns: minmax(100px, 130px) auto;
  align-items: center;
  gap: 6px 8px;
}

.refueling-actual-form .mini-button {
  width: auto;
  margin-top: 0;
  justify-self: start;
}

.refueling-actual-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.refueling-actual-input input {
  width: 100%;
  min-width: 0;
}

.refueling-actual-input span,
.refueling-actual-status {
  font-size: 12px;
}

.refueling-actual-status {
  grid-column: 1 / -1;
  min-height: 15px;
}

.refueling-actual-status.is-saved {
  color: var(--ok);
  font-weight: 700;
}

.refueling-actual-status.is-saved::before {
  margin-right: 4px;
  content: "\2713";
  font-size: 11px;
}

.refueling-actual-form.is-saved .refueling-actual-input input {
  color: var(--ok);
  font-weight: 700;
}

.refueling-actual-form:not(.is-saved) .refueling-actual-input input {
  border-color: var(--danger);
  outline: 2px solid color-mix(in srgb, var(--danger) 22%, transparent);
  outline-offset: 1px;
}

.refueling-actual-form:not(.is-saved) .refueling-actual-input input:focus {
  outline-color: color-mix(in srgb, var(--danger) 38%, transparent);
}

.analysis-liters-cell {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.analysis-actual-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-debug-panel {
  display: grid;
  gap: 14px;
}

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

.report-template-picker {
  grid-column: 1 / -1;
}

.report-template-select-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.report-debug-result {
  display: grid;
  gap: 14px;
}

.report-debug-tables {
  display: grid;
  gap: 14px;
}

.report-debug-table {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.report-debug-table h3 {
  margin: 0;
  font-size: 18px;
}

.debug-details pre {
  max-width: 100%;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.dashboard-quick-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.dashboard-check-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-check-filter,
.dashboard-offline-filter,
.dashboard-filter-reset {
  width: auto;
}

.dashboard-offline-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dashboard-offline-filter select {
  width: auto;
  min-height: 32px;
  padding: 5px 28px 5px 8px;
  border-color: transparent;
  background-color: var(--panel-soft);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-offline-filter select:focus {
  border-color: var(--border);
  outline: none;
}

.dashboard-check-filter input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.dashboard-filter-panel {
  padding-top: 18px;
  padding-bottom: 18px;
}

.dashboard-search-field {
  min-width: 0;
}

.dashboard-filter-reset {
  min-height: 44px;
  margin-top: 0;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--border);
}

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

tbody tr:hover {
  background: #f8fafc;
}

tbody tr.is-filtered-out {
  display: none;
}

.events-table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

.events-table th,
.events-table td {
  border-bottom: 0;
}

.events-table thead th {
  box-shadow: none;
}

.events-table tbody td {
  background: #f8fafc;
  transition: background-color 0.15s ease;
}

.events-table tbody td:first-child {
  border-radius: 8px 0 0 8px;
}

.events-table tbody td:last-child {
  border-radius: 0 8px 8px 0;
}

.events-table tbody tr:hover {
  background: transparent;
}

.events-table tbody tr:hover td {
  background: #f1f5f9;
}

.events-table .event-openai-preview-row td {
  padding-top: 0;
  border-radius: 8px;
  background: transparent;
}

.events-table .event-openai-preview-row:hover td {
  background: transparent;
}

.dashboard-units-table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

.dashboard-units-table > thead > tr > th,
.dashboard-units-table > tbody > tr > td {
  border-bottom: 0;
}

.dashboard-units-table > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--panel);
  box-shadow: none;
}

.dashboard-units-table > tbody > tr > td {
  background: #f8fafc;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-units-table > tbody > tr > td:first-child {
  border-radius: 8px 0 0 8px;
}

.dashboard-units-table > tbody > tr > td:last-child {
  border-radius: 0 8px 8px 0;
}

.dashboard-units-table > tbody > tr > td:only-child {
  border-radius: 8px;
  overflow: hidden;
}

.dashboard-units-table > tbody > tr:hover {
  background: transparent;
}

.dashboard-units-table > tbody > tr:hover > td {
  background: #f1f5f9;
}

.dashboard-report-units-table > tbody > tr.is-selected > td,
.dashboard-report-units-table > tbody > tr.is-selected:hover > td {
  background: #e8f6ee;
}

.unit-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.unit-check-warning {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fee4e2;
  color: #b42318;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.unit-check-empty {
  color: var(--muted);
  font-size: 13px;
}

.unit-location {
  display: grid;
  align-items: center;
  justify-items: start;
  gap: 7px;
  max-width: 320px;
  color: #667085;
  font-size: 13px;
  line-height: 1.35;
}

.unit-location-empty {
  color: var(--muted);
}

.unit-map-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.unit-map-link:hover {
  border-color: var(--brand);
}

.param-list {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 4px 10px;
  margin: 0;
  white-space: nowrap;
}

.param-list div {
  display: contents;
}

.param-list dt {
  color: var(--muted);
}

.param-list dd {
  margin: 0;
  font-weight: 800;
}

.ai-result {
  min-width: 360px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.ai-result.is-actual_drain,
.ai-result.is-false_refuel {
  border-color: #fecdca;
  background: #fffbfa;
}

.ai-result.is-false_drain,
.ai-result.is-actual_refuel {
  border-color: #abefc6;
  background: #f6fef9;
}

.ai-result.is-not_enough_data {
  border-color: #fedf89;
  background: #fffcf5;
}

.ai-result.is-needs_ai_review,
.ai-result.is-needs_review {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.ai-answer {
  color: #1f2937;
  line-height: 1.45;
}

.preview-code {
  max-height: 420px;
  margin: 8px 0 14px;
  white-space: pre-wrap;
}

th {
  color: #475569;
  background: #f8fafc;
  font-size: 13px;
  text-transform: uppercase;
}

tr.is-long-offline,
tr.is-no-last-message {
  opacity: 0.45;
}

tr.is-long-offline:hover,
tr.is-no-last-message:hover {
  opacity: 0.65;
}

.event-location-col {
  width: 20%;
  max-width: 260px;
  overflow-wrap: anywhere;
}

.event-gps-col {
  width: 30%;
  max-width: 420px;
  overflow-wrap: anywhere;
}

td.event-gps-col,
td.event-gps-col b,
td.event-gps-col strong {
  color: var(--muted);
}

.event-result-col {
  width: 30%;
  max-width: 30%;
  overflow-wrap: anywhere;
}

.event-gps-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  line-height: 1.45;
}

.event-gps-location {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.event-gps-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 400;
}

.event-date,
.event-time {
  display: block;
  white-space: nowrap;
}

.event-duration {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.event-time {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.event-openai-preview-row td {
  max-width: 0;
  padding-top: 0;
  background: #fbfdff;
}

.event-openai-preview {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.event-openai-preview summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 800;
}

.openai-preview-section {
  margin-top: 12px;
}

.openai-preview-title {
  margin-bottom: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.event-openai-preview pre {
  width: 100%;
  max-width: 100%;
  max-height: 440px;
  margin-top: 10px;
  overflow: auto;
  white-space: pre;
}

.event-openai-preview .openai-prompt-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.event-moment-card {
  padding: 14px 0 18px;
  border-top: 1px solid var(--border);
}

.event-moment-card:first-child {
  padding-top: 0;
  border-top: 0;
}

.event-moment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.event-moment-head h3 {
  margin: 0;
  font-size: 18px;
}

.event-moment-card h4 {
  margin: 16px 0 8px;
  color: #334155;
  font-size: 14px;
  text-transform: uppercase;
}

.kv-table td:first-child {
  width: 32%;
  color: var(--muted);
  font-weight: 800;
}

.kv-table td:last-child {
  overflow-wrap: anywhere;
}

.event-json {
  margin-top: 14px;
}

.event-json summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-weight: 800;
}

.type {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 13px;
}

.type.refuel {
  background: var(--ok-soft);
  color: var(--ok);
}

.type.drain {
  background: var(--danger-soft);
  color: var(--danger);
}

.event-status {
  display: inline-flex;
  align-items: center;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.event-status.actual_drain,
.event-status.false_refuel {
  background: #fee4e2;
  color: #b42318;
}

.event-status.false_drain,
.event-status.actual_refuel {
  background: #dcfae6;
  color: #067647;
}

.event-status.not_enough_data {
  background: #fef0c7;
  color: #b54708;
}

.event-status.needs_ai_review,
.event-status.needs_review {
  background: #e0f2fe;
  color: #026aa2;
}

.event-review-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.fuel-checks-filter-panel {
  margin-bottom: 0;
  padding: 20px;
}

.fuel-checks-filter {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 8px;
}

.fuel-checks-filter .field,
.fuel-checks-filter .mini-button {
  margin: 0;
}

.fuel-checks-filter .mini-button {
  min-height: 42px;
}

.fuel-check-history-table {
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.fuel-check-history-table > thead > tr > th,
.fuel-check-history-table > tbody > tr > td {
  border: 0;
}

.fuel-check-history-table > thead > tr > th {
  padding: 0 12px;
}

.fuel-check-history-table > tbody > tr > td {
  padding: 12px;
  background: #f8fafc;
  border-radius: 7px;
  transition: background-color 160ms ease;
}

.fuel-check-history-table > tbody > tr.is-expanded > td {
  background: #f0f7f2;
}

.fuel-check-history-table .mini-button {
  display: inline-flex;
  text-decoration: none;
}

.fuel-check-history-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(165px, .9fr) minmax(230px, 1.25fr) minmax(170px, .85fr) minmax(105px, .55fr);
  align-items: center;
  gap: 16px;
}

.fuel-check-history-head {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.fuel-check-history-main > div > strong,
.fuel-check-history-main > div > .muted {
  display: block;
}

.fuel-check-history-main > div > .muted {
  margin-top: 3px;
  font-size: 12px;
}

.fuel-check-history-action {
  text-align: right;
}

.fuel-check-report {
  display: block;
  margin-top: 12px;
  padding: 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  overflow: hidden;
}

.fuel-check-report[hidden] {
  display: none;
}

.fuel-check-report-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.fuel-check-report-summary .kpi-grid {
  width: min(390px, 100%);
  margin: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fuel-check-report-summary .summary-title {
  margin: 0;
}

.fuel-check-report-summary .summary-title span {
  margin-bottom: 3px;
  font-size: 11px;
}

.fuel-check-report-summary .summary-title h2 {
  font-size: 20px;
}

.fuel-check-report-summary .kpi {
  min-height: 64px;
  padding: 9px 11px;
}

.fuel-check-report-summary .kpi span {
  margin-bottom: 4px;
  font-size: 12px;
}

.fuel-check-report-summary .kpi strong {
  font-size: 22px;
}

.fuel-check-report-head {
  align-items: baseline;
  margin: 12px 0 8px;
}

.fuel-check-report-head > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.fuel-check-report-head h3,
.fuel-check-report-head p {
  margin: 0;
}

.fuel-check-events-table td {
  vertical-align: top;
}

.fuel-check-events-table th:first-child,
.fuel-check-events-table td:first-child,
.fuel-check-events-table th:last-child,
.fuel-check-events-table tbody td:last-child {
  text-align: left;
}

.fuel-check-events-table .ai-result {
  max-width: 420px;
  margin-top: 8px;
  white-space: normal;
}

.fuel-check-gps {
  color: #64748b;
  line-height: 1.55;
}

.fuel-check-gps b {
  color: #334155;
}

.fuel-events-inline-report {
  gap: 10px;
}

.fuel-report-units-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.fuel-report-units-heading .mini-button {
  flex: 0 0 auto;
  text-transform: none;
}

.fuel-report-heading-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.dashboard-report-units-table .refueling-unit-heading-total {
  flex-wrap: wrap;
  justify-content: flex-end;
  white-space: normal;
}

.fuel-report-heading-stat {
  display: grid;
  gap: 2px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  line-height: 1.25;
  white-space: nowrap;
}

.fuel-report-heading-stat b {
  color: var(--text);
  font-size: 12px;
}

.fuel-report-heading-stat small {
  color: inherit;
  font-size: 11px;
}

.fuel-report-heading-stat .fuel-report-stat-value {
  color: var(--text);
  font-weight: 800;
}

.fuel-report-heading-stats .is-unreviewed {
  border-color: #fed7aa;
  color: #b45309;
}

.fuel-report-heading-stats .is-unreviewed b {
  color: #b45309;
}

.fuel-report-heading-stats .is-unreviewed .fuel-report-stat-value {
  color: #b45309;
}

.fuel-report-controls-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

.fuel-report-filters-column {
  min-width: 0;
}

.fuel-report-exports {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8fafc;
}

.fuel-report-exports-head,
.fuel-report-export-item,
.fuel-report-export-progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fuel-report-exports-head {
  margin-bottom: 8px;
}

.fuel-report-exports-head h3,
.fuel-report-exports-head p {
  margin: 0;
}

.fuel-report-exports-head p {
  color: var(--muted);
  font-size: 12px;
}

.fuel-report-export-list {
  display: grid;
  gap: 7px;
}

.fuel-report-export-item {
  align-items: stretch;
  flex-direction: column;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.fuel-report-export-main {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.fuel-report-export-main span,
.fuel-report-export-main small,
.fuel-report-export-progress small {
  color: var(--muted);
  font-size: 11px;
}

.fuel-report-export-progress {
  width: 100%;
  display: grid;
  gap: 5px;
}

.fuel-report-exports-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.fuel-report-export-progress span,
.fuel-report-export-progress strong {
  font-size: 12px;
}

.fuel-report-export-track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #e2e8f0;
}

.fuel-report-export-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.fuel-report-export-item.is-completed .fuel-report-export-track i {
  background: var(--ok);
}

.fuel-report-export-progress .is-error {
  color: var(--danger);
}

@media (max-width: 960px) {
  .fuel-report-controls-layout {
    grid-template-columns: 1fr;
  }

  .fuel-report-exports {
    order: 2;
  }
}

.fuel-events-report-table {
  width: 100%;
  table-layout: fixed;
}

.fuel-events-report-table th:nth-child(1) {
  width: 12%;
}

.fuel-events-report-table th:nth-child(2) {
  width: 16%;
}

.fuel-events-report-table th:nth-child(3) {
  width: 31%;
}

.fuel-events-report-table th:nth-child(4) {
  width: 14%;
}

.fuel-events-report-table th:nth-child(5) {
  width: 27%;
}

.fuel-events-report-table.has-delete-column th:nth-child(1) {
  width: 11%;
}

.fuel-events-report-table.has-delete-column th:nth-child(2) {
  width: 15%;
}

.fuel-events-report-table.has-delete-column th:nth-child(3) {
  width: 29%;
}

.fuel-events-report-table.has-delete-column th:nth-child(4) {
  width: 13%;
}

.fuel-events-report-table.has-delete-column th:nth-child(5) {
  width: 27%;
}

.fuel-events-report-table.has-delete-column .fuel-report-delete-column {
  width: 5%;
  padding-right: 8px;
  text-align: right;
}

.fuel-events-report-table td {
  vertical-align: top;
}

.fuel-events-report-table .event-status {
  margin-bottom: 3px;
}

.fuel-report-status-source {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.fuel-report-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fuel-report-kpis > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.fuel-report-kpis b {
  color: var(--text);
}

.fuel-report-sync-warning {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
}

.fuel-report-sync-state {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 12px;
}

.fuel-events-report-table tr.is-wialon-missing td {
  background: #fffaf0;
}

.fuel-report-wialon-state {
  display: block;
  margin-top: 5px;
  color: #a16207;
  font-size: 11px;
  line-height: 1.3;
}

@media (max-width: 820px) {
  .fuel-events-report-table {
    min-width: 820px;
  }
}

@media (max-width: 900px) {
  .fuel-check-report-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .fuel-check-report-head > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 620px) {
  .fuel-checks-filter-panel {
    padding: 16px;
  }

  .fuel-checks-filter {
    grid-template-columns: 1fr;
  }

  .fuel-checks-filter .mini-button {
    width: 100%;
  }
}

.event-review-controls .event-status {
  margin-bottom: 0;
}

button.manual-review-action {
  border: 1px solid #d0d5dd;
  background: #f2f4f7;
  color: #475467;
  cursor: pointer;
  font-family: inherit;
}

button.manual-review-action:hover {
  border-color: #98a2b3;
  background: #e4e7ec;
}

.manual-review-select {
  width: auto;
  min-width: 150px;
  min-height: 30px;
  padding: 3px 28px 3px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.manual-review-save-status {
  color: var(--muted);
  font-size: 12px;
}

.unit-net-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.unit-net-status.is-online {
  background: var(--ok-soft);
  color: var(--ok);
}

.unit-net-status.is-offline {
  background: #f2f4f7;
  color: #475467;
}

.unit-net-status.is-loading,
.unit-net-status.is-unknown {
  background: var(--warn-soft);
  color: var(--warn);
}

.unit-status-stack {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.unit-status-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unit-satellites,
.unit-gsm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.unit-satellites-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  opacity: 0.6;
}

.unit-gsm-label {
  font-weight: 400;
}

.unit-gsm-value {
  font-weight: 600;
}

.unit-satellites[hidden],
.unit-gsm[hidden] {
  display: none;
}

.unit-last-message {
  color: #98a2b3;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.unit-fuel {
  min-width: 150px;
}

.unit-fuel-total {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.unit-fuel-total-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.unit-fuel-fault {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fee4e2;
  color: #b42318;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.unit-fuel-fault-note {
  margin-top: 4px;
  max-width: 360px;
  color: #667085;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.unit-fuel-details {
  margin-top: 4px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.unit-fuel-empty {
  color: #98a2b3;
  font-weight: 700;
}

.unit-name-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ignition-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  display: inline-block;
  border-radius: 50%;
  background: #d0d5dd;
}

.ignition-dot.is-on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

.ignition-dot.is-off,
.ignition-dot.is-unknown {
  background: #d0d5dd;
}

.empty-note {
  margin: 0;
  color: var(--muted);
}

.debug-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.live-toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 180px minmax(220px, max-content);
  gap: 14px;
  align-items: end;
  padding: 18px;
  margin-bottom: 18px;
}

.live-toolbar .field {
  margin-bottom: 0;
}

.live-refresh-button {
  width: auto;
  margin-top: 0;
}

.live-update-note {
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 13px;
}

.live-update-note strong {
  color: var(--text);
  font-size: 15px;
}

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

.live-status-grid .kpi.is-ok {
  border-color: #bbf7d0;
  background: var(--ok-soft);
}

.live-status-grid .kpi.is-warn {
  border-color: #fde68a;
  background: var(--warn-soft);
}

.live-status-grid .kpi.is-error {
  border-color: #fed7aa;
  background: var(--danger-soft);
}

.live-status-grid .kpi strong {
  font-size: 20px;
}

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

.live-card {
  padding: 20px;
  margin-bottom: 18px;
}

.live-grid .live-card {
  margin-bottom: 0;
}

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

.live-dl div {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.live-dl dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.live-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.live-json-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.live-json-block summary {
  cursor: pointer;
  color: #334155;
  font-weight: 800;
}

pre {
  max-height: 360px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  font-size: 13px;
}

.tariffs-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(50, 194, 74, 0.1), transparent 32%),
    var(--bg);
}

.tariffs-shell {
  width: min(1120px, calc(100% - 32px));
}

.tariffs-public-header {
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
}

.tariffs-public-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tariffs-public-nav .logout-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tariffs-public-nav .logout-link:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

.tariffs-hero {
  max-width: 780px;
  padding: 62px 8px 34px;
}

.tariffs-hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.05;
}

.tariffs-hero > p:last-child {
  max-width: 700px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.5;
}

.tariffs-panel {
  padding: 24px;
}

.tariffs-table-wrap {
  margin-top: 18px;
}

.tariffs-table {
  min-width: 780px;
}

.tariffs-table th {
  padding-top: 14px;
  padding-bottom: 14px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.tariffs-table th:first-child {
  width: 52%;
}

.tariffs-table th:nth-child(2),
.tariffs-table th:nth-child(3) {
  width: 24%;
}

.tariffs-table td {
  padding-top: 20px;
  padding-bottom: 20px;
  vertical-align: middle;
}

.tariffs-module-cell strong {
  color: var(--text);
  font-size: 19px;
}

.tariffs-module-cell p {
  max-width: 560px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.tariffs-price-cell small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tariffs-price,
.tariffs-ai-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 900;
  white-space: nowrap;
}

.tariffs-price.is-free {
  background: #dcfce7;
  color: #166534;
}

.tariffs-price.is-ai {
  background: #dbeafe;
  color: #1d4ed8;
}

.tariffs-ai-status {
  background: #fef3c7;
  color: #92400e;
}

.tariffs-ai-status.is-disabled {
  background: #f1f5f9;
  color: #64748b;
}

.tariffs-error-state {
  margin-top: 18px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(440px, calc(100% - 32px));
  padding: 28px 0;
}

.auth-card {
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.auth-brand-icon {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  object-fit: contain;
}

.auth-brand span,
.auth-brand strong {
  display: block;
}

.auth-brand span {
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.05;
}

.auth-brand strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.auth-card h1 {
  margin-bottom: 10px;
  font-size: 30px;
}

.auth-form {
  margin-top: 22px;
}

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

  .analysis-unit-row,
  .analysis-period-row {
    grid-template-columns: 1fr;
  }

  .analysis-controls {
    grid-template-columns: 1fr;
  }

  .analysis-actions-row .primary-button {
    width: 100%;
  }

  .ai-schedule-create-controls {
    grid-template-columns: minmax(0, 1fr) 140px;
  }

  .ai-schedule-create-controls .ai-schedule-save {
    grid-column: 1 / -1;
  }

  .ai-schedule-analysis-options {
    grid-column: 1 / -1;
  }

  .dashboard-filters {
    grid-template-columns: 1fr;
  }

  .dashboard-report-period {
    grid-template-columns: 1fr;
  }

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

  .refueling-manual-create-form {
    grid-template-columns: 1fr;
  }

  .report-template-select-row {
    grid-template-columns: 1fr;
  }

  .dashboard-filter-reset {
    margin-top: 0;
    width: 100%;
  }

  .dashboard-check-filter {
    margin-top: 0;
  }

  .dashboard-offline-filter {
    margin-top: 0;
  }

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

  .live-toolbar,
  .live-status-grid,
  .live-grid {
    grid-template-columns: 1fr;
  }

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

  .dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .app-footer,
  .section-head {
    display: block;
  }

  .tariffs-public-header {
    display: grid;
  }

  .tariffs-public-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tariffs-hero {
    padding: 42px 4px 26px;
  }

  .tariffs-panel {
    padding: 16px;
  }

  .footer-meta {
    margin-top: 12px;
  }

  .status-pill,
  .topbar-actions,
  .legend {
    margin-top: 12px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .main-nav,
  .account-nav {
    width: 100%;
  }

  .admin-menu {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .admin-menu-group,
  .admin-menu-group .main-nav {
    width: 100%;
  }

  .admin-menu-label {
    padding-left: 4px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand-row {
    flex-wrap: wrap;
  }

  .nav-link {
    justify-content: center;
  }

  .field-grid,
  .kpi-grid,
  .activation-form,
  .activation-actions,
  .quick-period-settings-actions {
    grid-template-columns: 1fr;
  }

  .analysis-quick-periods {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-schedule-create-controls {
    grid-template-columns: 1fr;
  }

  .ai-schedule-create-controls .ai-schedule-save {
    grid-column: auto;
  }

  .ai-schedule-analysis-options {
    grid-column: auto;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ai-schedule-analysis-limit p {
    max-width: 420px;
  }

  .quick-period-settings-button {
    margin-left: 0;
  }

  .quick-period-system-row {
    grid-template-columns: 1fr auto;
  }

  .quick-period-system-row .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .quick-period-settings-head {
    display: none;
  }

  .quick-period-settings-row {
    grid-template-columns: minmax(0, 1fr) minmax(105px, 0.6fr) 36px;
  }

  .quick-period-settings-row [data-quick-period-name] {
    grid-column: 1 / -1;
  }

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

  h1 {
    font-size: 28px;
  }

  .pagename-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagename-badges.is-right {
    margin-left: 0;
  }
}
