/* ============================================================
   EMS Auto-inplanner — designtokens & componentstijlen
   Bron: design_handoff_ems_autoplanner/README.md (high-fidelity)
   ============================================================ */

:root {
    --canvas: #F4EFE8;
    --screen: #FBF6EF;
    --card: #FFFFFF;
    --border: #F0E8DD;
    --rail: #E2D6C6;
    --primary: #E68A3D;
    --primary-dark: #C9722C;
    --accent-dark: #B4651E;
    --accent-soft: #FBE9D6;
    --text: #2B2622;
    --text-2: #948A7F;
    --text-3: #B7ADA2;
    --tab-idle: #C3B9AD;
    --success: #5B9E6F;
    --ring-track: #F1EAE0;
    --bezel: #201C19;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--canvas);
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    color: var(--text);
}

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

input, select {
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    color: var(--text);
    color-scheme: light;
}

input::placeholder { color: var(--text-3); }

::-webkit-scrollbar { width: 0; height: 0; }

@keyframes ovFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ovUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---- Telefoon-frame -------------------------------------------------- */

.phone-canvas {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.phone {
    width: 390px;
    height: 844px;
    background: var(--screen);
    border-radius: 46px;
    border: 10px solid var(--bezel);
    box-shadow: 0 30px 70px rgba(43, 38, 34, .28);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

@media (max-width: 480px) {
    .phone-canvas { padding: 0; }
    .phone {
        width: 100%;
        height: 100dvh;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
}

.statusbar {
    height: 50px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 30px 8px;
    flex: none;
}

.statusbar-time { font-size: 14px; font-weight: 600; }

.screen-scroll { flex: 1; overflow-y: auto; position: relative; }

.screen { padding: 6px 20px 120px; }

.screen-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.settings-title { margin-bottom: 16px; }
.screen-sub { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }

/* ---- Overzicht -------------------------------------------------------- */

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}

.home-greeting { font-size: 13px; color: var(--text-2); font-weight: 500; }
.home-title { font-size: 24px; font-weight: 700; margin-top: 1px; }

.price-chip {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 13px;
    text-align: right;
    cursor: pointer;
}

.price-chip-label {
    font-size: 9px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
}

.price-chip-value { font-size: 15px; font-weight: 700; }
.price-chip-value span { font-size: 10px; color: var(--text-2); font-weight: 500; }

.battery-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 26px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(43, 38, 34, .05);
}

.soc-ring { position: relative; width: 118px; height: 118px; flex: none; }

.soc-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.soc-ring-value { font-size: 32px; font-weight: 700; line-height: 1; }
.soc-ring-value span { font-size: 15px; font-weight: 600; }
.soc-ring-label { font-size: 10px; color: var(--text-2); letter-spacing: 1px; margin-top: 1px; }

.battery-info { flex: 1; }
.battery-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.battery-range { display: flex; align-items: baseline; gap: 5px; margin-bottom: 6px; }
.battery-range-km { font-size: 22px; font-weight: 700; color: var(--primary); }
.battery-range-unit { font-size: 12px; color: var(--text-2); font-weight: 600; }

.battery-note { font-size: 12px; color: var(--text-2); line-height: 1.45; }

.pill {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 8px 13px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.next-card {
    margin-top: 16px;
    background: linear-gradient(140deg, #2E2823, #443A32);
    color: #fff;
    border-radius: 26px;
    padding: 20px 22px;
}

.next-label {
    font-size: 10px;
    color: #D9C4AD;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.next-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 12px;
}

.next-name { font-size: 23px; font-weight: 700; line-height: 1.1; }
.next-line { font-size: 13px; color: #D9C4AD; }
.next-line:first-of-type { margin-top: 4px; }

.next-soc {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: 12px;
    font-weight: 600;
}

.next-soc.ok { color: #9DC7A8; }
.next-soc.warn { color: #F0A15C; }

.km-hint { font-size: 12px; font-weight: 600; margin: -8px 0 16px; }
.km-hint.ok { color: var(--success); }
.km-hint.warn { color: #D9704A; }

.next-km-wrap { text-align: right; flex: none; }
.next-km { font-size: 28px; font-weight: 700; color: #F0A15C; line-height: 1; }
.next-km-label { font-size: 10px; color: #D9C4AD; letter-spacing: .5px; }

.section-row {
    margin-top: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title { font-size: 15px; font-weight: 700; }

.link-btn { font-size: 13px; color: var(--primary); font-weight: 700; cursor: pointer; }

.trip-card {
    margin-top: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 13px;
}

.date-tile {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--accent-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: none;
}

.date-tile-mon {
    font-size: 9px;
    color: var(--accent-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.date-tile-day { font-size: 18px; font-weight: 700; color: var(--accent-dark); line-height: 1; }

.trip-card-main { flex: 1; min-width: 0; }
.trip-card-name { font-size: 15px; font-weight: 600; }
.trip-card-sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--screen);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-3);
    font-size: 18px;
    flex: none;
}

.empty-card {
    margin-top: 12px;
    background: var(--card);
    border: 1px dashed var(--rail);
    border-radius: 18px;
    padding: 26px 16px;
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
}

.empty-card strong { color: var(--primary); }

.empty-day { margin-top: 10px; padding: 22px; }

/* ---- Plannen (agenda) -------------------------------------------------- */

.day-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin: 0 -4px;
}

.day-tile {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50px;
    padding: 9px 0;
    border-radius: 16px;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text);
}

.day-tile.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.day-tile-wd { font-size: 10px; font-weight: 600; text-transform: uppercase; opacity: .75; }
.day-tile-num { font-size: 18px; font-weight: 700; line-height: 1.1; }

.day-tile-dot {
    width: 5px;
    height: 5px;
    border-radius: 5px;
    margin-top: 3px;
    background: transparent;
}

.day-tile-dot.visible { background: var(--primary); }
.day-tile.selected .day-tile-dot.visible { background: #fff; }

.agenda-label { margin-top: 18px; font-size: 13px; font-weight: 700; color: var(--text-2); }

.agenda-trip {
    margin-top: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.agenda-trip-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--primary); }
.agenda-trip-main { flex: 1; }
.agenda-trip-name { font-size: 15px; font-weight: 600; }
.agenda-trip-sub { font-size: 12px; color: var(--text-2); }

.btn-primary {
    margin-top: 16px;
    background: var(--primary);
    color: #fff;
    border-radius: 18px;
    padding: 16px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(230, 138, 61, .32);
}

/* ---- Instellingen -------------------------------------------------------- */

.section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 8px;
}

.section-label.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 22px 0 8px;
}

.section-label .link-btn { text-transform: none; letter-spacing: normal; }

.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
}

.section-label.spaced { margin-top: 22px; }

.nav-card { display: flex; align-items: center; gap: 12px; cursor: pointer; }

.screen-header-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.header-title { flex: 1; margin-bottom: 0; }

.field-title { font-size: 15px; font-weight: 600; }
.field-sub { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }

.field-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--screen);
    border-radius: 14px;
    padding: 4px 14px;
}

.field-input input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 0;
    font-size: 22px;
    font-weight: 700;
    outline: none;
    width: 100%;
    min-width: 0;
}

.field-prefix { font-size: 20px; font-weight: 700; color: var(--text-2); }
.field-suffix { font-size: 13px; color: var(--text-2); font-weight: 600; white-space: nowrap; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ---- Vaste-rit formulier ---- */

.lib-form {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 10px;
}

.lib-form.accent { border-color: var(--primary); }

.text-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 14px;
    margin-bottom: 9px;
    outline: none;
}

.lib-km-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.num-input {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 10px;
}

.toggle-label { font-size: 13px; font-weight: 600; }
.toggle-label span { color: var(--text-2); font-weight: 500; }

.toggle {
    width: 42px;
    height: 24px;
    border-radius: 24px;
    padding: 2px;
    display: flex;
    justify-content: flex-start;
    background: var(--rail);
}

.toggle.on { justify-content: flex-end; background: var(--success); }

.toggle-knob { width: 20px; height: 20px; border-radius: 20px; background: #fff; }

.lib-times { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.lib-times .tot { font-size: 12px; color: var(--text-2); padding: 0 2px; }

.lib-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.btn-ghost { color: var(--text-2); font-size: 14px; padding: 11px 8px; cursor: pointer; }

.btn-small {
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* ---- Vaste-rit lijst ---- */

.lib-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 8px;
}

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

.initial-tile {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-dark);
    font-size: 14px;
    font-weight: 700;
    flex: none;
}

.initial-tile.lg { width: 40px; height: 40px; font-size: 15px; }

.lib-item-main { flex: 1; min-width: 0; }
.lib-item-name { font-size: 15px; font-weight: 600; }
.lib-item-sub { font-size: 12px; color: var(--text-2); }

.lib-edit-btn { color: var(--text-2); font-size: 13px; font-weight: 600; padding: 6px 8px; cursor: pointer; }

/* ---- Bottom-sheets -------------------------------------------------------- */

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(32, 28, 25, .5);
    display: flex;
    align-items: flex-end;
    z-index: 40;
    animation: ovFade .18s ease;
}

.overlay-dim { position: absolute; inset: 0; }

.sheet {
    position: relative;
    width: 100%;
    max-height: 92%;
    overflow-y: auto;
    background: var(--screen);
    border-radius: 30px 30px 0 0;
    padding: 22px 22px 28px;
    animation: ovUp .26s cubic-bezier(.22, 1, .36, 1);
}

.sheet-grip {
    width: 38px;
    height: 4px;
    border-radius: 4px;
    background: var(--rail);
    margin: 0 auto 16px;
}

.sheet-step {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 2px;
}

.sheet-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.sheet-sub { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }

.sheet-actions { display: flex; gap: 12px; }

.btn-cancel {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--rail);
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-2);
    cursor: pointer;
}

.btn-save {
    flex: 1.4;
    background: var(--primary);
    color: #fff;
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ---- Bevestigingssheet ---- */

.sheet-confirm .sheet-title { text-align: center; margin-bottom: 0; }
.sheet-confirm .sheet-sub { text-align: center; margin: 4px 0 22px; line-height: 1.5; }
.sheet-confirm .sheet-sub strong { color: var(--text); }

.btn-danger {
    flex: 1.4;
    background: #D9704A;
    color: #fff;
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ---- SOC-sheet ---- */

.sheet-soc { padding: 24px 22px 30px; }
.sheet-soc .sheet-grip { margin-bottom: 18px; }
.sheet-soc .sheet-title { text-align: center; margin-bottom: 0; }
.sheet-soc .sheet-sub { text-align: center; margin: 2px 0 0; }

.soc-big {
    text-align: center;
    margin: 22px 0 8px;
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    color: var(--primary);
}

.soc-big span { font-size: 28px; }

.soc-slider { width: 100%; accent-color: var(--primary); margin: 10px 0 4px; }

.soc-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-3);
    margin-bottom: 20px;
}

/* ---- Plan-sheets (stap 1 & 2) ---- */

.pick-row {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 13px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 13px;
    cursor: pointer;
}

.pick-chevron { color: var(--tab-idle); font-size: 20px; font-weight: 600; flex: none; }

.pick-custom {
    border: 1.5px dashed var(--rail);
    border-radius: 16px;
    padding: 15px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--accent-dark);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.pick-custom .plus { font-size: 20px; line-height: .8; }

.sheet-back-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }

.back-btn {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-2);
    flex: none;
}

.sheet-back-row .sheet-title { margin-bottom: 0; }

.field-label { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }

.details-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 13px 15px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    outline: none;
}

.km-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 0 14px;
    margin-bottom: 16px;
}

.km-wrap input {
    flex: 1;
    border: none;
    padding: 13px 0;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    width: 100%;
    min-width: 0;
    background: transparent;
}

.time-cols { display: flex; gap: 12px; margin-bottom: 22px; }
.time-col { flex: 1; }

.btn-confirm {
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(230, 138, 61, .3);
}

.btn-confirm.disabled { opacity: .45; }

/* ---- Tijdkiezer (24u) ---- */

.time-select { display: flex; align-items: center; gap: 5px; flex: 1; width: 100%; }

.time-dd {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 13px 10px;
    font-size: 15px;
    font-weight: 600;
    background: var(--card);
    outline: none;
    text-align: center;
    min-width: 0;
}

.time-select.compact .time-dd { border-radius: 11px; padding: 10px 4px; font-size: 14px; }

.time-colon { font-weight: 700; color: var(--text-2); }

/* ---- Tabbar -------------------------------------------------------- */

.tabbar {
    flex: none;
    display: flex;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 10px 24px 24px;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--tab-idle);
}

.tab.active { color: var(--primary); }

.tab-label { font-size: 10px; font-weight: 600; }

.tab-icon-home {
    width: 17px;
    height: 17px;
    border: 2.4px solid currentColor;
    border-radius: 5px;
}

.tab-icon-plus { position: relative; width: 17px; height: 17px; }

.tab-icon-plus::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 0;
    width: 17px;
    height: 3px;
    border-radius: 3px;
    background: currentColor;
}

.tab-icon-plus::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 0;
    width: 3px;
    height: 17px;
    border-radius: 3px;
    background: currentColor;
}

.tab-icon-settings { display: flex; flex-direction: column; gap: 3px; width: 17px; }
.tab-icon-settings span { height: 2.6px; border-radius: 3px; background: currentColor; }
.tab-icon-settings span:nth-child(2) { width: 12px; }

/* ---- Blazor error UI (template) ---- */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
