:root{
    font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
    color:#172b3b;
    background:#f2f6f9;
    font-size:16px;
    color-scheme:light
}

*{
    box-sizing:border-box
}

body{
    margin:0
}

header{
    background:#19374f;
    color:white;
    padding:18px 5%
}

header h1{
    font-size:1.35rem;margin:0
}

header p{
    margin:4px 0 0;
    color:#c2d6e4;
    font-size:.88rem
}

main{
    max-width:1260px;
    padding:20px;
    margin:auto
}

.mobile{
    max-width:520px
}

.panel{
    background:white;
    border:1px solid #d8e1e9;
    border-radius:12px;
    padding:18px;
    margin-bottom:14px
}

h2{
    font-size:1.05rem;
    margin:0 0 10px
}

label{
    font-size:.9rem;
    font-weight:600;
    display:block;
    margin:12px 0 5px
}

input{
    width:100%;
    padding:11px;
    border:1px solid #aebbc7;
    border-radius:7px;
    font:inherit;
    background:#fff
}

button,.link{
    display:inline-block;
    background:#1768b2;
    color:white;
    border:1px solid #1768b2;
    border-radius:7px;
    padding:11px 15px;
    text-decoration:none;
    font:inherit;
    cursor:pointer
}

button.secondary{
    background:white;
    color:#19374f;
    border-color:#b5c4d0
}

button:disabled{
    opacity:.45;
    cursor:default
}

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

.status{
    background:#eef4fa;
    border-radius:7px;
    padding:10px;
    overflow-wrap:anywhere;
    margin:12px 0 0
}

.error{
    color:#a42525;
    background:#fff1f1
}

.muted,small{
    color:#536878;
    line-height:1.6
}

dl{
    display:grid;
    grid-template-columns:auto 1fr;
    gap:8px 14px;
    font-size:.93rem
}

dt{
    color:#536878
}

dd{
    margin:0;
    overflow-wrap:anywhere;
    font-variant-numeric:tabular-nums
}

.dashboard{
    display:grid;
    grid-template-columns:320px minmax(0,1fr);
    gap:14px
}

.dashboard .panel{
    margin:0
}

#map{
    height:65vh;
    min-height:340px;
    background:#e8eff3;
    border-radius:8px;
    display:block
}

#mapMessage{
    margin:0 0 10px
}

#deviceList{
    display:flex;
    flex-direction:column;
    gap:8px;
    max-height:65vh;
    overflow:auto
}

.device{
    display:block;
    width:100%;
    text-align:left;
    color:#19374f;
    background:white;
    border:1px solid #d5dfe8;
    padding:10px
}

.device:hover{
    border-color:#1768b2
}

.device strong,.device small{
    display:block
}

.state{
    font-size:.8rem;
    font-weight:700;
    color:#19764b
}

.state.stale{
    color:#a05a14
}

.admin-form{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:0 14px
}

.marker{
    background:#1768b2;
    color:white;
    border:2px solid white;
    border-radius:12px;
    padding:4px 8px;
    font-size:12px;
    font-weight:700;
    box-shadow:0 1px 4px #3335;
    white-space:nowrap
}

.marker.stale{
    background:#a05a14
}

@media(max-width:760px){
    main{
        padding:12px
    }
    
    .dashboard,.admin-form{
        grid-template-columns:1fr
    }
    
    #map{
        height:55vh
    }
    
    #deviceList{
        max-height:260px
    }
}

/* Vehicle display name editor and truck markers */
.device-card{
    border:1px solid #d5dfe8;
    border-radius:8px;
    padding:8px;
    background:#fff
}

.device-card .device{
    border:0;
    padding:5px 4px
}

.device-card .device:hover{
    background:#edf5fb
}

.device-card .device strong{
    overflow-wrap:anywhere;
    font-size:1rem
}

.device-card .rename{
    margin:4px;
    padding:6px 12px;
    font-size:.83rem
}

.truck-marker{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:3px;
    --truck-color:#1768b2
}

.truck-marker.stale{
    --truck-color:#a05a14
}

.truck-label{
    font:700 12px system-ui,sans-serif;
    background:white;
    color:#19374f;
    border:1px solid #aebbc7;
    border-radius:5px;
    padding:3px 6px;
    max-width:180px;
    overflow-wrap:anywhere;
    text-align:center;
    box-shadow:0 1px 4px #3333
}

.truck-icon{
    background:var(--truck-color);
    border:2px solid white;
    border-radius:9px;
    box-shadow:0 1px 5px #3335;
    position:relative;
    padding:3px 6px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:8px
}

.truck-icon:after{
    content:"";
    position:absolute;
    bottom:-9px;
    left:50%;
    transform:translateX(-50%);
    border-left:7px solid transparent;
    border-right:7px solid transparent;
    border-top:9px solid var(--truck-color)
}

dialog{
    width:min(420px,calc(100% - 28px));
    border:1px solid #b5c4d0;
    border-radius:12px;
    padding:20px;
    color:#19374f;
    background:white;
    box-shadow:0 8px 36px #0003
}

dialog::backdrop{
    background:#172b3b66
}

dialog input{
    margin-top:4px
}

dialog .muted{
    margin:8px 0;
    font-size:.88rem
}

dialog .actions{
    justify-content:flex-end
}

dialog [hidden]{
    display:none
}