:root {
    --ink: #111827;
    --muted: #6b7280;
    --line: #dfe6ee;
    --soft: #f5f8fb;
    --paper: #ffffff;
    --paper-strong: #ffffff;
    --input-bg: #ffffff;
    --button-bg: #ffffff;
    --tile-bg: #f6f8fb;
    --chip-bg: #eef3f7;
    --chip-text: #475569;
    --grid-line: #e8eef4;
    --green: #16a56f;
    --green-dark: #0c7c56;
    --blue: #2468d5;
    --cyan: #17a2bf;
    --amber: #f5a524;
    --red: #dd3e45;
    --shadow: 0 24px 70px rgba(30, 41, 59, 0.22);
    --radius: 8px;
}

[data-theme="dark"] {
    --ink: #eef4f8;
    --muted: #9aa8b6;
    --line: #263340;
    --soft: #0e141b;
    --paper: #151d26;
    --paper-strong: #1b2632;
    --input-bg: #101821;
    --button-bg: #101821;
    --tile-bg: #101821;
    --chip-bg: #202c38;
    --chip-text: #d7e2ec;
    --grid-line: #263747;
    --green: #25c689;
    --green-dark: #7ee2b6;
    --blue: #73a7ff;
    --cyan: #5ecae0;
    --amber: #f6b64d;
    --red: #ff6b73;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body[data-theme="dark"] {
    background: #070b10;
}

body {
    margin: 0;
    overflow: hidden;
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(22, 165, 111, 0.12), transparent 34%),
        linear-gradient(315deg, rgba(36, 104, 213, 0.10), transparent 38%),
        #dce4ed;
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
    letter-spacing: 0;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.phone-shell {
    width: min(430px, 100vw);
    height: min(900px, 100dvh);
    max-height: 100dvh;
    position: relative;
    overflow: hidden;
    background: var(--soft);
    border: 1px solid rgba(17, 24, 39, 0.09);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .phone-shell {
    border-color: #1d2935;
}

.auth-view,
.app-view {
    width: 100%;
    height: 100%;
}

.auth-view {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 22px;
    padding: 34px 22px 24px;
    overflow: hidden;
}

.auth-brand {
    min-height: 236px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    border-radius: 18px;
    background:
        linear-gradient(160deg, rgba(17, 24, 39, 0.94), rgba(12, 124, 86, 0.86)),
        url("../media/charger-phase.png") right 12px bottom -34px / 180px auto no-repeat;
}

.brand-logo {
    width: 158px;
    height: auto;
    filter: brightness(0) invert(1);
}

.auth-copy h1 {
    margin: 0 0 5px;
    font-size: 34px;
    line-height: 1;
}

.auth-copy p {
    margin: 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 15px;
}

.auth-card {
    align-self: end;
    display: grid;
    gap: 18px;
    padding: 18px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    background: var(--chip-bg);
    border-radius: 8px;
}

.auth-tab {
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.auth-tab.active {
    color: var(--ink);
    background: var(--paper-strong);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.auth-form,
.form-grid {
    display: none;
    gap: 13px;
}

.auth-form.active,
.form-grid {
    display: grid;
}

label {
    display: grid;
    gap: 6px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--ink);
    outline: none;
}

[data-theme="dark"] input,
[data-theme="dark"] select {
    border-color: #334456;
    background: var(--input-bg);
    color: var(--ink);
}

input:focus,
select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 165, 111, 0.14);
}

.primary-action,
.command-button,
.icon-button,
.tab-button,
.text-button,
.settings-list button,
.logout-button,
.quick-amounts button {
    border: 0;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-action {
    min-height: 48px;
    gap: 9px;
    background: var(--green);
    color: #fff;
    font-weight: 900;
}

.primary-action:hover {
    background: var(--green-dark);
}

[data-theme="dark"] .primary-action:hover {
    background: var(--green);
}

.app-view {
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--soft);
}

.app-header {
    min-height: 76px;
    padding: calc(16px + env(safe-area-inset-top)) 18px 12px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    background: rgba(245, 248, 251, 0.92);
    border-bottom: 1px solid rgba(223, 230, 238, 0.76);
}

[data-theme="dark"] .app-header,
[data-theme="dark"] .tab-bar {
    background: rgba(21, 29, 38, 0.96);
}

.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.app-header h2,
.screen-heading h1,
.charger-hero h1 {
    margin: 0;
}

.app-header h2 {
    margin-top: 3px;
    font-size: 22px;
    line-height: 1.05;
}

.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    color: var(--ink);
    background: var(--button-bg);
    border: 1px solid var(--line);
}

[data-theme="dark"] .icon-button {
    background: var(--button-bg);
}

.icon-button.filled {
    background: var(--ink);
    color: var(--soft);
    border-color: var(--ink);
}

.screen-stack {
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.screen {
    width: 100%;
    height: 100%;
    display: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 16px 94px;
    scrollbar-width: none;
}

.screen::-webkit-scrollbar,
.modal-sheet::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.screen.active {
    display: block;
}

.charger-hero {
    min-height: 188px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 138px;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    border-radius: 18px;
    padding: 18px 0 18px 18px;
    color: #fff;
    background:
        linear-gradient(140deg, #111827 0%, #0e3f35 62%, #16a56f 100%);
}

.hero-copy {
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-pill {
    width: fit-content;
    max-width: 100%;
    padding: 6px 9px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #dff7ee;
    font-size: 12px;
    font-weight: 900;
}

.charger-hero h1 {
    font-size: 32px;
    line-height: 1;
}

.serial {
    margin-top: 7px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 700;
    word-break: break-word;
}

.charger-image {
    width: 142px;
    max-height: 180px;
    object-fit: contain;
    align-self: end;
    filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.28));
}

.live-strip {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
}

.power-ring {
    --power-fill: 66%;
    min-height: 118px;
    aspect-ratio: auto;
    display: grid;
    place-items: center;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(22, 165, 111, 0.18), transparent),
        var(--paper);
    color: var(--ink);
}

[data-theme="dark"] .power-ring {
    background:
        linear-gradient(135deg, rgba(37, 198, 137, 0.22), transparent),
        var(--paper);
}

.power-ring span {
    font-size: 38px;
    line-height: 1;
    font-weight: 900;
}

.power-ring small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.power-ring::before {
    content: "Live power";
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.live-metrics,
.energy-summary,
.metric-grid {
    display: grid;
    gap: 10px;
}

.live-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.live-metrics div,
.metric-tile,
.energy-summary div,
.section-block,
.next-charge,
.profile-band,
.preference-panel,
.balance-hero {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

[data-theme="dark"] .live-metrics div,
[data-theme="dark"] .metric-tile,
[data-theme="dark"] .energy-summary div,
[data-theme="dark"] .section-block,
[data-theme="dark"] .next-charge,
[data-theme="dark"] .profile-band,
[data-theme="dark"] .preference-panel,
[data-theme="dark"] .balance-hero,
[data-theme="dark"] .device-item,
[data-theme="dark"] .settings-list button,
[data-theme="dark"] .modal-sheet,
[data-theme="dark"] .auth-card {
    background: var(--paper);
}

.live-metrics div {
    min-height: 74px;
    display: grid;
    align-content: space-between;
    gap: 8px;
    padding: 10px 12px;
}

.live-metrics span,
.metric-tile span,
.energy-summary span,
.next-charge span,
.section-title span,
.activity-item span,
.session-item span,
.device-meta span,
.settings-list span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.live-metrics strong,
.metric-tile strong,
.energy-summary strong {
    font-size: 16px;
    font-weight: 900;
    text-align: left;
}

.mode-control {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mode-chip {
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--button-bg);
    color: var(--ink);
    font-weight: 900;
}

.mode-chip.active {
    border-color: rgba(22, 165, 111, 0.36);
    background: #e7f8f1;
    color: var(--green-dark);
}

[data-theme="dark"] .mode-chip.active {
    background: rgba(37, 198, 137, 0.18);
}

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

.command-button {
    min-width: 0;
    min-height: 66px;
    flex-direction: column;
    gap: 7px;
    padding: 8px 4px;
    background: var(--button-bg);
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 12px;
    font-weight: 900;
}

.command-button i {
    font-size: 17px;
}

.command-button.primary {
    color: var(--green-dark);
    background: #e9f9f1;
    border-color: rgba(22, 165, 111, 0.32);
}

[data-theme="dark"] .command-button.primary {
    background: rgba(37, 198, 137, 0.16);
}

.command-button.danger {
    color: #aa2630;
    background: #fff0f0;
    border-color: rgba(221, 62, 69, 0.25);
}

[data-theme="dark"] .command-button.danger {
    color: #ffb0b5;
    background: rgba(255, 107, 115, 0.14);
}

.section-block,
.preference-panel {
    margin-top: 14px;
    padding: 14px;
}

.section-title {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.section-title h3 {
    margin: 0;
    font-size: 16px;
}

.text-button {
    padding: 5px 0;
    background: transparent;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
}

.chart {
    width: 100%;
    height: 132px;
    display: block;
}

#weeklyChart {
    height: 190px;
}

.large-chart {
    height: 230px;
}

.output-panel {
    display: grid;
    gap: 14px;
    padding: 0;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(22, 165, 111, 0.08), transparent 42%),
        var(--paper);
}

.output-panel .section-title {
    margin-bottom: 0;
    padding: 14px 14px 0;
}

.graph-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 0 14px;
}

.graph-metrics div {
    min-height: 58px;
    padding: 10px;
    display: grid;
    align-content: space-between;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--tile-bg);
}

.graph-metrics span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.graph-metrics strong {
    font-size: 14px;
    font-weight: 900;
}

.interactive-chart {
    cursor: crosshair;
}

.chart-shell {
    width: 100%;
    min-width: 0;
    padding: 0 0 8px;
    overflow: hidden;
}

.chart-shell canvas {
    width: 100% !important;
    max-width: 100%;
    display: block;
}

.energy-visual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.mini-chart-card {
    margin-top: 0;
    overflow: hidden;
}

.small-chart {
    height: 130px;
}

.energy-insights {
    margin-top: 14px;
}

.metric-grid {
    margin-top: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-tile {
    min-height: 76px;
    padding: 14px;
    display: grid;
    align-content: space-between;
}

.metric-tile strong {
    text-align: left;
    font-size: 20px;
}

.activity-list,
.sessions-list,
.schedule-list,
.device-list {
    display: grid;
    gap: 10px;
}

.activity-item,
.session-item,
.schedule-item,
.device-item {
    min-width: 0;
    padding: 12px 0;
    display: grid;
    gap: 4px;
    border-bottom: 1px solid var(--line);
}

.schedule-item,
.device-item,
.session-item.clickable,
.card-item {
    cursor: pointer;
}

.schedule-item:hover,
.device-item:hover,
.session-item.clickable:hover,
.card-item:hover {
    border-color: rgba(22, 165, 111, 0.38);
}

.activity-item:last-child,
.session-item:last-child,
.schedule-item:last-child,
.device-item:last-child {
    border-bottom: 0;
}

.activity-item strong,
.session-item strong,
.schedule-item strong,
.device-item strong {
    min-width: 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.screen-heading {
    margin: 0 0 16px;
}

.screen-heading.compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.screen-heading h1 {
    margin-top: 2px;
    font-size: 28px;
    line-height: 1.05;
}

.energy-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.energy-summary div {
    min-height: 86px;
    padding: 12px;
    display: grid;
    align-content: space-between;
}

.energy-summary strong {
    text-align: left;
    font-size: 18px;
    overflow-wrap: anywhere;
}

.session-item,
.schedule-item,
.device-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.session-item small,
.schedule-item small,
.device-item small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.amount-chip,
.schedule-state,
.device-state {
    padding: 5px 8px;
    border-radius: 999px;
    background: #edf6ff;
    color: #1557ad;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

[data-theme="dark"] .amount-chip,
[data-theme="dark"] .schedule-state,
[data-theme="dark"] .device-state {
    background: rgba(115, 167, 255, 0.16);
    color: #b9d2ff;
}

.schedule-state.on,
.device-state.online,
.device-state.charging {
    background: #dcf8ea;
    color: #08764c;
}

[data-theme="dark"] .schedule-state.on,
[data-theme="dark"] .device-state.online,
[data-theme="dark"] .device-state.charging {
    background: rgba(37, 198, 137, 0.16);
    color: var(--green-dark);
}

.device-state.offline {
    background: #e5e7eb;
    color: #4b5563;
}

[data-theme="dark"] .device-state.offline {
    background: #263340;
    color: var(--muted);
}

.next-charge {
    margin-bottom: 14px;
    padding: 16px;
    display: grid;
    gap: 6px;
    background:
        linear-gradient(110deg, rgba(23, 162, 191, 0.14), transparent),
        var(--paper);
}

.mini-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-button.small {
    width: 34px;
    height: 34px;
}

.plan-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendar-label,
.calendar-day {
    min-width: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 900;
}

.calendar-label {
    color: var(--muted);
    padding-bottom: 4px;
}

.calendar-day {
    min-height: 42px;
    padding: 6px 2px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--tile-bg);
    color: var(--ink);
}

.calendar-day.is-today {
    border-color: var(--green);
    color: var(--green-dark);
}

.calendar-day.has-schedule::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green);
}

.segmented-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.segment {
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-weight: 900;
}

.segment.active {
    background: var(--green);
    color: #fff;
}

[data-theme="dark"] .segment.active {
    color: #07120d;
}

.next-charge strong {
    font-size: 24px;
    line-height: 1.1;
}

.next-charge small {
    color: var(--muted);
    font-weight: 700;
}

.device-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.device-item.full {
    grid-template-columns: 1fr;
}

.vehicle-photo,
.profile-photo {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--tile-bg);
}

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

.device-meta {
    display: grid;
    gap: 3px;
}

.device-health {
    margin-top: 9px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.device-health div {
    padding: 9px;
    border-radius: var(--radius);
    background: var(--tile-bg);
}

.device-health strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
}

.profile-band {
    margin-bottom: 14px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-band div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.profile-band span {
    font-weight: 900;
}

.profile-band strong {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.settings-list {
    display: grid;
    gap: 10px;
}

.settings-list button {
    width: 100%;
    min-height: 58px;
    justify-content: start;
    gap: 12px;
    padding: 0 14px;
    background: var(--button-bg);
    border: 1px solid var(--line);
    text-align: left;
}

.settings-list i {
    width: 24px;
    color: var(--green-dark);
    font-size: 17px;
}

.settings-list strong {
    margin-left: auto;
    color: var(--ink);
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
}

.toggle-row {
    min-height: 48px;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.toggle-row:last-child {
    border-bottom: 0;
}

.toggle-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-row span {
    width: 47px;
    height: 28px;
    position: relative;
    border-radius: 999px;
    background: var(--chip-bg);
    transition: background 0.18s ease;
}

.toggle-row span::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.18s ease;
}

.toggle-row input:checked + span {
    background: var(--green);
}

.toggle-row input:checked + span::after {
    transform: translateX(19px);
}

.logout-button {
    width: 100%;
    min-height: 48px;
    margin-top: 14px;
    gap: 9px;
    color: #a82631;
    background: #fff1f1;
    border: 1px solid rgba(221, 62, 69, 0.2);
    font-weight: 900;
}

[data-theme="dark"] .logout-button {
    color: #ffb0b5;
    background: rgba(255, 107, 115, 0.12);
}

.tab-bar {
    min-height: 78px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
}

.tab-button {
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
}

[data-theme="dark"] .tab-button {
    color: var(--muted);
}

.tab-button i {
    font-size: 17px;
}

.tab-button.active {
    background: #e8f7f0;
    color: var(--green-dark);
}

[data-theme="dark"] .tab-button.active {
    background: rgba(37, 198, 137, 0.16);
}

.modal {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: grid;
    align-items: end;
    padding: 12px;
    background: rgba(15, 23, 42, 0.42);
}

.modal-sheet {
    max-height: min(720px, calc(100dvh - 28px));
    overflow-y: auto;
    padding: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.info-content {
    display: grid;
    gap: 12px;
}

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

.info-grid div,
.debug-box {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--tile-bg);
}

.info-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.info-grid strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.debug-box {
    overflow-x: auto;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 11px;
    white-space: pre-wrap;
}

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

.balance-hero {
    margin-bottom: 14px;
    padding: 18px;
    display: grid;
    gap: 10px;
}

.balance-hero span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.balance-hero strong {
    font-size: 30px;
    line-height: 1;
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.mini-button {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--tile-bg);
    color: var(--ink);
    font-weight: 900;
}

.danger-mini {
    color: #a82631;
    background: #fff1f1;
    border-color: rgba(221, 62, 69, 0.24);
}

[data-theme="dark"] .danger-mini {
    color: #ffb0b5;
    background: rgba(255, 107, 115, 0.12);
}

.modal-head {
    min-height: 46px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h2 {
    margin: 0;
    font-size: 22px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.day-pills,
.quick-amounts {
    display: grid;
    gap: 8px;
}

.day-pills {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.day-pills label {
    display: block;
}

.day-pills input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.day-pills span,
.quick-amounts button {
    width: 100%;
    min-height: 38px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--chip-bg);
    color: var(--chip-text);
    font-size: 12px;
    font-weight: 900;
}

.day-pills input:checked + span {
    color: var(--green-dark);
    background: #e1f6ed;
}

[data-theme="dark"] .day-pills input:checked + span {
    background: rgba(37, 198, 137, 0.18);
}

.quick-amounts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-amounts button {
    border: 0;
}

.checkbox-line {
    min-height: 42px;
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
}

.toast {
    position: absolute;
    z-index: 60;
    left: 16px;
    right: 16px;
    bottom: calc(90px + env(safe-area-inset-bottom));
    min-height: 44px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    color: #fff;
    background: var(--ink);
    border-radius: var(--radius);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.22);
    font-size: 13px;
    font-weight: 800;
}

[data-theme="dark"] .toast {
    color: #07120d;
    background: var(--green);
}

@media (max-width: 600px) {
    body {
        place-items: stretch;
        background: var(--soft);
    }

    .phone-shell {
        width: 100dvw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

@media (max-width: 360px) {
    .charger-hero {
        grid-template-columns: minmax(0, 1fr) 116px;
    }

    .charger-image {
        width: 122px;
    }

    .live-strip {
        grid-template-columns: 104px minmax(0, 1fr);
    }

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

    .energy-summary {
        grid-template-columns: 1fr;
    }

    .day-pills {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
