.ev-maintenance-calculator-container,
.ev-maintenance-calculator-container *,
.ev-maintenance-calculator-container *::before,
.ev-maintenance-calculator-container *::after {
  box-sizing: border-box;
}

.ev-maintenance-calculator-container {
  --ev-paper: #faf2e8;
  --ev-paper-soft: #fff7e8;
  --ev-panel: #fffdf7;
  --ev-panel-alt: #f4dfba;
  --ev-unit-bg: #faecd4;
  --ev-line: #6b5745;
  --ev-line-soft: rgba(107, 87, 69, 0.28);
  --ev-grid: rgba(107, 87, 69, 0.055);
  --ev-text: #2b2119;
  --ev-muted: #6b5745;
  --ev-green: #2f7d50;
  --ev-green-deep: #235d3d;
  --ev-green-soft: #e3efd2;
  --ev-yellow: #f7df9d;
  --ev-yellow-soft: #f2e3d3;
  --ev-yellow-hover: #ead2bd;
  --ev-body-surface: rgba(255, 247, 232, 0.72);
  --ev-panel-surface: rgba(255, 253, 247, 0.92);
  --ev-card-surface: rgba(255, 247, 232, 0.78);
  --ev-card-alt-surface: rgba(244, 223, 186, 0.2);
  --ev-note-surface: rgba(244, 223, 186, 0.34);
  --ev-empty-surface: rgba(255, 247, 232, 0.62);
  --ev-red: #9b3d2e;
  --ev-blue: #406d88;
  --ev-home: #2f7d50;
  --ev-public: #476f96;
  --ev-fast: #a65337;
  --ev-shadow: 5px 5px 0 rgba(107, 87, 69, 0.18);
  --ev-shadow-sm: 3px 3px 0 rgba(107, 87, 69, 0.16);
  position: relative;
  width: min(100%, 980px);
  margin: 10px auto 18px;
  padding: 0;
  border: 2px solid var(--ev-line);
  border-radius: 0;
  background:
    linear-gradient(90deg, var(--ev-grid) 1px, transparent 1px),
    linear-gradient(180deg, var(--ev-grid) 1px, transparent 1px),
    linear-gradient(135deg, #fffaf0 0%, var(--ev-paper) 100%);
  background-size: 22px 22px, 22px 22px, auto;
  color: var(--ev-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  box-shadow: var(--ev-shadow);
  overflow: visible;
}

.ev-maintenance-calculator-container [hidden] {
  display: none !important;
}

.ev-maintenance-tool {
  display: block;
  width: 100%;
  min-width: 0;
}

.ev-maintenance-title {
  display: block;
  padding: 14px 16px 13px;
  border-bottom: 2px solid var(--ev-line);
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 0.99), rgba(255, 249, 238, 0.98) 64%, rgba(247, 223, 157, 0.3)),
    var(--ev-paper-soft);
  color: var(--ev-text);
}

.ev-maintenance-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1.5px solid var(--ev-line);
  border-radius: 0;
  background: var(--ev-panel-alt);
  color: var(--ev-muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.ev-maintenance-title h2 {
  margin: 8px 0 4px;
  color: var(--ev-text);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.16;
}

.ev-maintenance-title p {
  max-width: 760px;
  margin: 0;
  color: var(--ev-muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.ev-maintenance-body {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border-top: 0;
  background: var(--ev-body-surface);
}

.ev-maintenance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 10px;
  align-items: stretch;
  min-width: 0;
}

.ev-maintenance-panel {
  min-width: 0;
  padding: 12px;
  border: 2px solid var(--ev-line);
  border-radius: 0;
  background: var(--ev-panel-surface);
  box-shadow: var(--ev-shadow-sm);
}

.ev-maintenance-panel--conditions {
  grid-row: 1 / span 2;
}

.ev-maintenance-panel--results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ev-maintenance-breakdown {
  margin-top: 0;
}

.ev-maintenance-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1.5px dashed var(--ev-line-soft);
}

.ev-maintenance-panel-head--inline {
  justify-content: flex-start;
}

.ev-maintenance-panel-kicker {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 3px 7px;
  border: 1.5px solid var(--ev-line);
  background: var(--ev-panel-alt);
  color: var(--ev-muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.ev-maintenance-panel h3 {
  margin: 0;
  color: var(--ev-text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
}

.ev-maintenance-group {
  padding: 11px 0;
  border-top: 1.5px dashed var(--ev-line-soft);
}

.ev-maintenance-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.ev-maintenance-group-title {
  margin-bottom: 8px;
  color: var(--ev-line);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.ev-maintenance-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.ev-maintenance-field,
.ev-maintenance-mini-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--ev-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.ev-maintenance-field > span:first-child,
.ev-maintenance-mini-field > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ev-maintenance-control {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 2px solid var(--ev-line);
  border-radius: 0;
  background: var(--ev-panel);
  overflow: hidden;
  box-shadow: 2px 2px 0 rgba(107, 87, 69, 0.1);
}

.ev-maintenance-calculator-container input,
.ev-maintenance-calculator-container select {
  width: 100%;
  min-width: 0;
  height: 38px;
  margin: 0;
  border: 2px solid var(--ev-line);
  border-radius: 0;
  background: var(--ev-panel);
  color: var(--ev-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  box-shadow: none;
  outline: none;
}

.ev-maintenance-control input {
  flex: 1 1 auto;
  height: auto;
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ev-maintenance-calculator-container select {
  padding: 0 30px 0 9px;
  appearance: auto;
}

.ev-maintenance-control input:focus,
.ev-maintenance-calculator-container select:focus {
  background: #fff2c4;
}

.ev-maintenance-field:focus-within .ev-maintenance-control,
.ev-maintenance-mini-field:focus-within .ev-maintenance-control,
.ev-maintenance-calculator-container select:focus {
  outline: 2px solid rgba(47, 125, 80, 0.22);
  outline-offset: 1px;
}

.ev-maintenance-unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 38px;
  padding: 0 6px;
  border-left: 2px solid var(--ev-line);
  background: var(--ev-unit-bg);
  color: var(--ev-muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.ev-maintenance-charge-grid {
  display: grid;
  gap: 7px;
}

.ev-maintenance-charge-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  align-items: end;
  min-width: 0;
}

.ev-maintenance-charge-type {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 7px;
  border: 2px solid var(--ev-line);
  background: var(--ev-panel-alt);
  color: var(--ev-text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

.ev-maintenance-charge-type--home {
  background: #e3efd2;
}

.ev-maintenance-charge-type--public {
  background: #dfeef8;
}

.ev-maintenance-charge-type--fast {
  background: #f1dccb;
}

.ev-maintenance-charge-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.ev-maintenance-charge-bar {
  display: flex;
  min-width: 0;
  height: 14px;
  border: 2px solid var(--ev-line);
  background: var(--ev-panel);
  overflow: hidden;
}

.ev-maintenance-charge-segment {
  display: block;
  width: 0;
  height: 100%;
  transition: width 0.2s ease;
}

.ev-maintenance-charge-segment--home {
  background: var(--ev-home);
}

.ev-maintenance-charge-segment--public {
  background: var(--ev-public);
}

.ev-maintenance-charge-segment--fast {
  background: var(--ev-fast);
}

.ev-maintenance-charge-total {
  color: var(--ev-red);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.ev-maintenance-charge-total.is-valid {
  color: var(--ev-green);
}

.ev-maintenance-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  align-items: stretch;
}

.ev-maintenance-action-row--single {
  grid-template-columns: 1fr;
  margin-top: auto;
}

.ev-maintenance-calculator-container button.ev-maintenance-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  border: 2px solid var(--ev-line) !important;
  border-radius: 0 !important;
  background: var(--ev-yellow-soft) !important;
  color: var(--ev-line) !important;
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  text-decoration: none !important;
  box-shadow: var(--ev-shadow-sm) !important;
  cursor: pointer;
  appearance: none;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ev-maintenance-calculator-container button.ev-maintenance-action:hover {
  background: var(--ev-yellow-hover) !important;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(107, 87, 69, 0.18) !important;
}

.ev-maintenance-calculator-container button.ev-maintenance-action:active {
  transform: translate(3px, 3px);
  box-shadow: none !important;
}

.ev-maintenance-calculator-container button.ev-maintenance-action:focus-visible {
  outline: 3px solid rgba(47, 125, 80, 0.35);
  outline-offset: 2px;
}

.ev-maintenance-calculator-container button.ev-maintenance-action--reset {
  background: #f7eddc !important;
}

.ev-maintenance-calculator-container button.ev-maintenance-action--copy {
  background: var(--ev-green-soft) !important;
}

.ev-maintenance-compat-action {
  display: none !important;
}

.ev-maintenance-result-hero {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 2px solid var(--ev-line);
  border-radius: 0;
  background: var(--ev-green-soft);
  color: var(--ev-text);
  box-shadow: var(--ev-shadow-sm);
}

.ev-maintenance-result-label {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ev-muted);
}

.ev-maintenance-result-value {
  display: block;
  min-width: 0;
  color: var(--ev-text);
  font-size: 29px;
  font-weight: 950;
  line-height: 1.08;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.ev-maintenance-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ev-maintenance-summary-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 70px;
  padding: 10px;
  border: 2px solid var(--ev-line);
  background: var(--ev-card-surface);
  box-shadow: 2px 2px 0 rgba(107, 87, 69, 0.1);
}

.ev-maintenance-summary-card span,
.ev-maintenance-cost-row span,
.ev-maintenance-bar-label {
  color: var(--ev-muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
}

.ev-maintenance-summary-card strong,
.ev-maintenance-cost-row strong,
.ev-maintenance-bar-value {
  color: var(--ev-text);
  font-size: 16px;
  font-weight: 950;
  line-height: 1.2;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.ev-maintenance-result-note {
  min-height: 38px;
  padding: 9px 10px;
  border: 1.5px dashed var(--ev-line-soft);
  background: var(--ev-note-surface);
  color: var(--ev-muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.ev-maintenance-result-note.is-ready {
  border-color: rgba(47, 125, 80, 0.35);
  color: var(--ev-green-deep);
}

.ev-maintenance-breakdown-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  align-items: start;
}

.ev-maintenance-bars,
.ev-maintenance-cost-list {
  min-width: 0;
}

.ev-maintenance-empty {
  min-height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--ev-line-soft);
  background: var(--ev-empty-surface);
  color: var(--ev-muted);
  font-size: 14px;
  font-weight: 800;
}

.ev-maintenance-bar-row {
  display: grid;
  grid-template-columns: 46px minmax(28px, 1fr) 88px;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 7px 0;
  border-bottom: 1.5px dashed var(--ev-line-soft);
}

.ev-maintenance-bar-row:last-child {
  border-bottom: 0;
}

.ev-maintenance-bar-track {
  display: block;
  min-width: 0;
  height: 16px;
  border: 2px solid var(--ev-line);
  background: var(--ev-panel);
  overflow: hidden;
}

.ev-maintenance-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  background: var(--ev-green);
}

.ev-maintenance-bar-fill--tax {
  background: #c79d3e;
}

.ev-maintenance-bar-fill--insurance {
  background: var(--ev-public);
}

.ev-maintenance-bar-fill--maintenance {
  background: #688a50;
}

.ev-maintenance-bar-fill--other {
  background: var(--ev-fast);
}

.ev-maintenance-bar-value {
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

.ev-maintenance-cost-list {
  display: grid;
  border: 2px solid var(--ev-line);
  background: var(--ev-panel);
  box-shadow: 2px 2px 0 rgba(107, 87, 69, 0.1);
}

.ev-maintenance-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border-bottom: 1.5px dashed var(--ev-line-soft);
  background: var(--ev-empty-surface);
}

.ev-maintenance-cost-row:nth-child(even) {
  background: var(--ev-card-alt-surface);
}

.ev-maintenance-cost-row:last-child {
  border-bottom: 0;
}

.ev-maintenance-battery {
  margin-top: 10px;
  padding: 10px;
  border: 2px solid var(--ev-line);
  background: var(--ev-green-soft);
  box-shadow: 2px 2px 0 rgba(107, 87, 69, 0.1);
}

.ev-maintenance-battery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ev-text);
  font-size: 14px;
  font-weight: 900;
}

.ev-maintenance-battery-gauge {
  height: 18px;
  margin-top: 8px;
  border: 2px solid var(--ev-line);
  background: var(--ev-panel);
  overflow: hidden;
}

.ev-maintenance-battery-level {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ev-green);
}

.ev-maintenance-battery p {
  margin: 8px 0 0;
  color: var(--ev-muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.ev-maintenance-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: grid;
  gap: 2px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 2px solid var(--ev-line);
  background: var(--ev-panel);
  color: var(--ev-text);
  box-shadow: var(--ev-shadow-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ev-maintenance-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ev-maintenance-toast-title {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.ev-maintenance-toast-value {
  color: var(--ev-muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
}

.ev-maintenance-toast.is-error {
  background: #fff0e8;
}

@media (prefers-color-scheme: dark) {
  .ev-maintenance-calculator-container {
    --ev-paper: #201d18;
    --ev-paper-soft: #2b261f;
    --ev-panel: #2b261f;
    --ev-panel-alt: #3a3024;
    --ev-unit-bg: #3a3024;
    --ev-line: #e2c98d;
    --ev-line-soft: rgba(226, 201, 141, 0.28);
    --ev-grid: rgba(226, 201, 141, 0.085);
    --ev-text: #f6ecd9;
    --ev-muted: #d0bfa5;
    --ev-green: #5fa36e;
    --ev-green-deep: #3f7d55;
    --ev-green-soft: #304127;
    --ev-yellow: #f0d4a6;
    --ev-yellow-soft: #e4c492;
    --ev-yellow-hover: #f0d4a6;
    --ev-body-surface: rgba(32, 29, 24, 0.86);
    --ev-panel-surface: rgba(43, 38, 31, 0.88);
    --ev-card-surface: rgba(43, 38, 31, 0.88);
    --ev-card-alt-surface: rgba(58, 48, 36, 0.52);
    --ev-note-surface: rgba(58, 48, 35, 0.88);
    --ev-empty-surface: rgba(43, 38, 31, 0.62);
    --ev-red: #e18b74;
    --ev-blue: #88abc0;
    --ev-home: #5fa36e;
    --ev-public: #7fa5bd;
    --ev-fast: #ca7657;
    --ev-shadow: 5px 5px 0 rgba(0, 0, 0, 0.34);
    --ev-shadow-sm: 3px 3px 0 rgba(0, 0, 0, 0.3);
  }

  .ev-maintenance-title {
    background:
      linear-gradient(90deg, rgba(43, 38, 31, 0.96), rgba(32, 29, 24, 0.96) 64%, rgba(226, 201, 141, 0.16)),
      var(--ev-panel);
  }

  .ev-maintenance-badge,
  .ev-maintenance-panel-kicker {
    color: var(--ev-text);
  }

  .ev-maintenance-charge-type--home,
  .ev-maintenance-charge-type--public,
  .ev-maintenance-charge-type--fast,
  .ev-maintenance-battery {
    background: var(--ev-panel-alt);
  }

  .ev-maintenance-control input:focus,
  .ev-maintenance-calculator-container select:focus {
    background: #41351f;
  }

  .ev-maintenance-calculator-container button.ev-maintenance-action,
  .ev-maintenance-calculator-container button.ev-maintenance-action--reset,
  .ev-maintenance-calculator-container button.ev-maintenance-action--copy {
    background: var(--ev-yellow-soft) !important;
    color: #2b2119 !important;
  }

  .ev-maintenance-calculator-container button.ev-maintenance-action--copy {
    background: #37462f !important;
    color: var(--ev-text) !important;
  }
}

@media (max-width: 780px) {
  .ev-maintenance-calculator-container {
    width: 100%;
    margin: 8px auto 12px;
  }

  .ev-maintenance-calculator-container .ev-maintenance-layout,
  .ev-maintenance-calculator-container .ev-maintenance-breakdown-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ev-maintenance-calculator-container .ev-maintenance-panel--conditions {
    grid-row: auto !important;
  }

  .ev-maintenance-calculator-container .ev-maintenance-panel {
    width: 100%;
  }

  .ev-maintenance-calculator-container .ev-maintenance-action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 480px) {
  .ev-maintenance-calculator-container {
    font-size: 15px;
    box-shadow: 4px 4px 0 rgba(107, 87, 69, 0.18);
  }

  .ev-maintenance-title {
    padding: 14px 12px 12px;
  }

  .ev-maintenance-title h2 {
    font-size: 22px;
  }

  .ev-maintenance-title p {
    font-size: 14px;
  }

  .ev-maintenance-body {
    padding: 8px;
  }

  .ev-maintenance-panel {
    padding: 10px;
  }

  .ev-maintenance-calculator-container .ev-maintenance-field-grid,
  .ev-maintenance-calculator-container .ev-maintenance-summary-grid,
  .ev-maintenance-calculator-container .ev-maintenance-action-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ev-maintenance-calculator-container .ev-maintenance-charge-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ev-maintenance-calculator-container .ev-maintenance-charge-type {
    grid-column: 1 / -1;
    min-height: 34px;
  }

  .ev-maintenance-calculator-container .ev-maintenance-charge-meter,
  .ev-maintenance-calculator-container .ev-maintenance-cost-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ev-maintenance-charge-total {
    text-align: left;
  }

  .ev-maintenance-result-value {
    font-size: 24px;
  }

  .ev-maintenance-bar-row {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .ev-maintenance-bar-value {
    grid-column: 1 / -1;
    text-align: left;
  }

  .ev-maintenance-battery-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ev-maintenance-toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
  }
}
