.history-chart-card { min-width: 0; margin-bottom: 18px; overflow: hidden; }
.device-card { cursor: pointer; }
.device-card:focus-visible { outline: 2px solid #93dccc; outline-offset: 3px; }
.device-card-arrow { color: #93dccc; font-size: 25px; line-height: 16px; }
.device-card:hover .device-card-arrow, .device-card:focus-visible .device-card-arrow { transform: translateX(3px); }
.pack-number { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 18px 0 20px; letter-spacing: normal; }
.pack-number strong { font-size: clamp(42px, 4vw, 52px); line-height: 1; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.pack-number strong span { margin-left: 3px; font-size: .48em; letter-spacing: normal; }
.pack-number small { display: block; font-size: 14px; line-height: 1.4; font-weight: 500; letter-spacing: normal; color: #b4c5d8; }
.alert-settings-card { margin-bottom: 18px; }
.alert-settings-card h2 { margin-bottom: 10px; }
.alert-settings-card .form-grid { margin-top: 18px; }
.alert-settings-card label > span { display: flex; align-items: center; gap: 9px; }
.alert-settings-card input[type="checkbox"] { width: auto; min-height: 0; accent-color: #42dbab; }
.alert-settings-card .note { margin: 18px 0 0; }
.device-night-rule { border-top: 1px solid #304158; padding-top: 17px; }
.device-night-rule h3 { margin-bottom: 5px; }
.device-night-rule p { margin-bottom: 15px; font-size: 12px; }
.history-chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.history-chart-heading .eyebrow { margin-bottom: 5px; }
.history-chart-heading h2 { margin-bottom: 0; }
.history-chart-heading > span { font-size: 12px; text-align: right; }
.history-chart-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin: 19px 0 14px; }
.history-chart-stat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; min-width: 0; padding: 11px; border: 1px solid #2a4058; border-top: 3px solid var(--line); border-radius: 9px; background: #0e1a2b; }
.history-chart-stat > span { grid-column: 1 / -1; color: #c0cde0; font-size: 12px; font-weight: 700; }
.history-chart-stat strong { font-size: 13px; white-space: nowrap; }
.history-chart-stat small { color: #8296ae; font-size: 10px; font-weight: 500; }
.history-chart-controls, .history-cell-controls { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.history-chart-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 10px; border: 1px solid #34475e; border-radius: 999px; background: #142238; color: #9cadc4; font-size: 12px; }
.history-chart-toggle i, .history-chart-tooltip i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--line); }
.history-chart-toggle.active { border-color: var(--line); background: #1d3347; color: #f1f7ff; }
.history-chart-toggle:not(.active) i { opacity: .38; }
.history-chart-toggle:focus-visible, .history-chart:focus-visible { outline: 2px solid #93dccc; outline-offset: 3px; }
.history-chart-frame { position: relative; width: 100%; height: clamp(230px, 28vw, 320px); min-width: 0; overflow: hidden; border: 1px solid #263a53; border-radius: 10px; background: #0d1828; }
.history-chart { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.history-chart-soc-axis { position: absolute; inset: 6.9% auto 6.9% 5px; display: flex; flex-direction: column; justify-content: space-between; color: #49dbae; font-size: 10px; font-variant-numeric: tabular-nums; pointer-events: none; }
.history-chart-soc-axis span { line-height: 1; transform: translateY(-50%); }
.history-chart-soc-axis span:last-child { transform: translateY(50%); }
.history-chart-grid line { stroke: #27384f; stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-chart-line { fill: none; stroke: var(--line); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.history-chart-line.cell-line { stroke-width: 1.8; }
.history-chart-overlay { fill: transparent; cursor: crosshair; }
.history-chart-cursor { stroke: #d3e3f5; stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.history-chart-markers { pointer-events: none; }
.history-chart-markers circle { stroke: #0d1828; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.history-chart-tooltip[hidden] { display: none; }
.history-chart-tooltip { position: absolute; z-index: 2; top: 10px; width: 190px; max-width: calc(100% - 16px); padding: 11px; border: 1px solid #4a6982; border-radius: 9px; background: #172a40; box-shadow: 0 12px 28px #0008; pointer-events: none; }
.history-chart-tooltip > strong { display: block; margin-bottom: 9px; font-size: 11px; }
.history-chart-tooltip span { display: flex; align-items: center; gap: 6px; margin: 6px 0; color: #b9c9dd; font-size: 11px; }
.history-chart-tooltip b { margin-left: auto; color: #f1f6ff; }
.history-chart-times, .history-cell-scale { display: flex; justify-content: space-between; gap: 12px; color: #91a4bb; font-size: 11px; }
.history-chart-times { margin-top: 8px; }
.history-chart-time-axis { margin-left: 5.3%; margin-right: 1.5%; font-variant-numeric: tabular-nums; }
.history-chart-scale-note { margin: 8px 0 0; color: #91a4bb; font-size: 11px; }
.history-chart-times span:last-child, .history-cell-scale span:last-child { text-align: right; }
.history-cell-scale { margin: 16px 2px 8px; }
.history-cell-note { margin: 10px 0 0; color: #91a4bb; font-size: 11px; }
.history-cell-controls { max-height: 100px; overflow: auto; padding: 2px; }
.history-recent-cells { margin-bottom: 18px; }
.history-recent-cells h2 { margin-bottom: 15px; }
.protection-log { margin-bottom: 18px; }
.protection-log .row-head > .muted { font-size: 12px; }
.protection-note { margin: 12px 0 17px; color: #9aadc4; font-size: 12px; line-height: 1.5; }
.protection-events { display: grid; gap: 11px; }
.protection-event { padding: 15px; border: 1px solid #30435a; border-radius: 11px; background: #0e1a2b; }
.protection-event > .row-head { align-items: center; }
.protection-event > .row-head strong { color: #f4bc75; }
.protection-event > .row-head span { color: #9aadc4; font-size: 12px; }
.protection-event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 13px; }
.protection-event-grid > div { display: grid; gap: 4px; min-width: 0; }
.protection-event-grid small { color: #8fa5be; }
.protection-event-grid strong { font-size: 13px; }
.protection-event-grid span, .protection-event-foot { color: #b1c3d7; font-size: 12px; }
.protection-event-foot { margin: 13px 0 0; }
.protection-event details { margin-top: 14px; border-top: 1px solid #30435a; padding-top: 11px; }
.protection-event summary { cursor: pointer; color: #9bdcc7; font-size: 12px; }
.protection-event details div { margin-top: 11px; }
.protection-event details strong, .protection-event details p { font-size: 11px; }
.protection-event details p { margin: 5px 0 0; color: #aebfd1; line-height: 1.6; }

@media (max-width: 1100px) {
  .history-chart-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .protection-event-grid { grid-template-columns: 1fr; }
  .history-chart-card { padding: 16px; }
  .history-chart-heading { flex-direction: column; gap: 4px; }
  .history-chart-heading > span { text-align: left; }
  .history-chart-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 15px 0 10px; }
  .history-chart-stat:last-child { grid-column: 1 / -1; }
  .history-chart-stat { padding: 8px; }
  .history-chart-stat strong { font-size: 11px; }
  .history-chart-toggle { font-size: 11px; }
  .history-chart-frame { height: 235px; }
  .history-chart-times { font-size: 10px; }
  .history-chart-time-axis span:nth-child(2), .history-chart-time-axis span:nth-child(4) { display: none; }
  .history-cell-controls { max-height: 84px; }
}
@media (max-width: 380px) {
  .history-chart-stat { grid-template-columns: 1fr; }
  .history-chart-stat > span { grid-column: 1; }
}

.maintenance-card { max-width: 760px; padding: 22px; }
.maintenance-card h2 { margin: 0 0 8px; font-size: 18px; }
.maintenance-options { display: grid; }
.maintenance-option { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; cursor: pointer; }
.maintenance-option + .maintenance-option { border-top: 1px solid #2b3c54; }
.maintenance-copy { display: grid; gap: 6px; min-width: 0; flex: 1; }
.maintenance-copy strong { color: #e4edf7; font-size: 14px; font-weight: 600; }
.maintenance-copy small { color: #95a7be; font-size: 12px; line-height: 1.6; max-width: 520px; }
.toggle-control { display: grid; justify-items: center; gap: 5px; flex: 0 0 46px; }
.toggle-control input[type="checkbox"], .switch-button { appearance: none; -webkit-appearance: none; position: relative; display: block; width: 44px; height: 26px; min-height: 26px; margin: 0; padding: 0; border: 1px solid #52647c; border-radius: 20px; background: #29384e; cursor: pointer; transition: background .15s, border-color .15s; }
.toggle-control input::before, .switch-button::before { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #e4edf7; box-shadow: 0 1px 3px #0005; transition: transform .15s; }
.toggle-control input:checked, .switch-button[aria-checked="true"] { background: #55d6ae; border-color: #55d6ae; }
.toggle-control input:checked::before, .switch-button[aria-checked="true"]::before { transform: translateX(18px); background: #102b27; }
.toggle-control input:focus-visible, .switch-button:focus-visible { outline: 2px solid #a5f7d9; outline-offset: 4px; box-shadow: none; }
.toggle-value { font-size: 11px; color: #95a7be; line-height: 1; }
.toggle-value::after { content: 'Off'; }
.toggle-control input:checked + .toggle-value { color: #67dfb9; }
.toggle-control input:checked + .toggle-value::after { content: 'On'; }
.maintenance-status { display: grid; gap: 7px; padding: 14px 16px; background: #0e192a; border-radius: 9px; font-size: 12px; color: #95a7be; }
.maintenance-status > span { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 16px; }
.maintenance-status strong { color: #bdcce0; font-weight: 500; }
.maintenance-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }
.maintenance-footer .muted { font-size: 12px; }
.maintenance-footer .btn { min-height: 38px; padding: 9px 16px; font-size: 13px; }
@media(max-width:650px) {
  .maintenance-card { padding: 18px; }
  .maintenance-option { gap: 16px; padding: 18px 0; }
  .maintenance-copy strong { font-size: 13px; }
  .maintenance-status > span { display: grid; gap: 4px; }
}
@media(prefers-reduced-motion:reduce) { .toggle-control input, .toggle-control input::before, .switch-button::before { transition: none; } }

.form-grid label.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 12px 14px; background: #0e192a; border: 1px solid #2b3c54; border-radius: 9px; cursor: pointer; }
.toggle-field > span:first-child { min-width: 0; color: #dbe6f4; font-size: 13px; font-weight: 500; }
.switch-button:disabled { opacity: .5; cursor: wait; }
.btn { min-height: 38px; padding: 9px 14px; font-size: 13px; }
.form-actions { flex-wrap: wrap; margin-top: 18px; }
.form-grid { gap: 13px; }
.form-grid input:not([type="checkbox"]), .form-grid textarea, .form-grid select { min-width: 0; min-height: 38px; padding: 9px 11px; font-size: 13px; }
.btn:focus-visible { outline: 2px solid #a5f7d9; outline-offset: 3px; }
@media(pointer:coarse) { .btn { min-height: 44px; } .switch-button { margin-block: 9px; } .switch-button::after { content: ''; position: absolute; inset: -9px -4px; } }
@media(prefers-reduced-motion:reduce) { .switch-button, .switch-button::before { transition: none; } }

.protection-disconnect { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; padding: 14px; background: #0d192a; border: 1px solid #315547; border-radius: 9px; }
.protection-disconnect > div { min-width: 0; display: grid; align-content: start; gap: 6px; }
.protection-disconnect small { color: #95a7be; font-size: 11px; }
.protection-disconnect strong { color: #b1f1d9; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
@media(max-width:650px) { .protection-disconnect { grid-template-columns: 1fr; gap: 12px; } }
