:root{
    --bg:#f5f7fa;
    --panel:#ffffff;
    --line:#e4e9ef;
    --text:#18212b;
    --muted:#748091;
    --nav:#17222e;
    --nav2:#223140;
    --blue:#2185d0;
    --cyan:#20a7cf;
    --green:#21ba45;
    --orange:#f2a93b;
    --red:#db4655;
    --shadow:0 12px 35px rgba(20,35,50,.08);
}

*{box-sizing:border-box}

html,body{
    margin:0;
    min-height:100%;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Hiragino Kaku Gothic ProN",
        "Yu Gothic",
        Meiryo,
        sans-serif;
    background:var(--bg);
    color:var(--text);
}

a{
    text-decoration:none;
    color:inherit;
}

.login-page{
    min-height:100vh;
    display:grid;
    place-items:center;
    background:
        radial-gradient(circle at 20% 20%,rgba(33,133,208,.20),transparent 32%),
        radial-gradient(circle at 80% 70%,rgba(32,167,207,.16),transparent 28%),
        linear-gradient(135deg,#111b26,#1b2d3d);
    padding:24px;
}

.login-card{
    width:min(460px,100%);
    background:#fff;
    border-radius:22px;
    box-shadow:0 30px 80px rgba(0,0,0,.30);
    overflow:hidden;
}

.login-head{
    background:linear-gradient(135deg,#1c6fa8,#1fa7c8);
    padding:32px;
    color:#fff;
}

.login-brand{
    font-size:30px;
    font-weight:900;
    letter-spacing:.04em;
}

.login-sub{
    margin-top:6px;
    opacity:.8;
    font-size:13px;
}

.login-body{
    padding:30px;
}

.field{
    margin-bottom:18px;
}

.field label{
    display:block;
    font-weight:700;
    margin-bottom:7px;
    font-size:13px;
}

.field input{
    width:100%;
    height:48px;
    border:1px solid #dce3ea;
    border-radius:10px;
    padding:0 14px;
    font-size:16px;
    outline:none;
}

.field input:focus{
    border-color:#2185d0;
    box-shadow:0 0 0 3px rgba(33,133,208,.10);
}

.login-button{
    width:100%;
    height:50px;
    border:0;
    border-radius:10px;
    color:white;
    font-size:15px;
    font-weight:800;
    cursor:pointer;
    background:linear-gradient(135deg,#2185d0,#1fa7c8);
}

.error{
    background:#fff0f1;
    color:#b72b3a;
    border:1px solid #ffd0d5;
    padding:11px 13px;
    border-radius:9px;
    font-size:13px;
    margin-bottom:16px;
}

.app{
    min-height:100vh;
}

.topnav{
    height:68px;
    display:flex;
    align-items:center;
    background:var(--nav);
    color:white;
    padding:0 20px;
    position:sticky;
    top:0;
    z-index:20;
    box-shadow:0 2px 14px rgba(0,0,0,.18);
}

.brand{
    min-width:190px;
    font-size:20px;
    font-weight:900;
    letter-spacing:.04em;
}

.brand small{
    display:block;
    color:#7bd3ed;
    font-size:9px;
    font-weight:700;
    letter-spacing:.16em;
}

.navitems{
    display:flex;
    align-items:stretch;
    height:100%;
}

.navitems a{
    min-width:110px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:13px;
    color:#cbd5df;
    padding:0 15px;
    border-left:1px solid rgba(255,255,255,.04);
}

.navitems a:hover,
.navitems a.active{
    background:var(--nav2);
    color:white;
}

.userarea{
    margin-left:auto;
    display:flex;
    align-items:center;
    gap:16px;
    font-size:12px;
    color:#d1dae3;
}

.logout{
    padding:7px 12px;
    border:1px solid rgba(255,255,255,.20);
    border-radius:7px;
}

.page{
    padding:22px;
}

.page-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    margin-bottom:18px;
}

.page-title{
    font-size:21px;
    font-weight:850;
}

.page-note{
    margin-top:4px;
    font-size:12px;
    color:var(--muted);
}

.live{
    font-size:12px;
    font-weight:800;
    color:#138f34;
}

.kpis{
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:13px;
}

.kpi{
    background:#fff;
    border:1px solid var(--line);
    border-radius:10px;
    padding:16px;
    box-shadow:var(--shadow);
}

.kpi .label{
    color:var(--muted);
    font-size:12px;
}

.kpi .value{
    margin-top:5px;
    font-weight:900;
    font-size:26px;
}

.kpi.red .value{color:var(--red)}
.kpi.green .value{color:var(--green)}
.kpi.blue .value{color:var(--blue)}

.grid-main{
    margin-top:14px;
    display:grid;
    grid-template-columns:minmax(0,1.65fr) minmax(320px,.65fr);
    gap:14px;
}

.panel{
    background:#fff;
    border:1px solid var(--line);
    border-radius:10px;
    box-shadow:var(--shadow);
    overflow:hidden;
}

.panel-head{
    min-height:50px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:0 16px;
    border-bottom:1px solid var(--line);
}

.panel-title{
    font-size:14px;
    font-weight:800;
}

.map-placeholder{
    height:520px;
    position:relative;
    background:
        linear-gradient(rgba(255,255,255,.72),rgba(255,255,255,.72)),
        repeating-linear-gradient(0deg,#dbe3ea 0,#dbe3ea 1px,transparent 1px,transparent 48px),
        repeating-linear-gradient(90deg,#dbe3ea 0,#dbe3ea 1px,transparent 1px,transparent 48px),
        #edf2f6;
}

.map-center{
    position:absolute;
    inset:0;
    display:grid;
    place-items:center;
    color:#718094;
    text-align:center;
}

.map-center strong{
    display:block;
    color:#30465a;
    font-size:18px;
    margin-bottom:5px;
}

.case-list{
    padding:0 14px 14px;
}

.case{
    padding:13px 2px;
    border-bottom:1px solid var(--line);
}

.case:last-child{
    border-bottom:0;
}

.case-time{
    font-size:12px;
    color:var(--muted);
}

.case-title{
    font-size:13px;
    font-weight:800;
    margin-top:4px;
}

.case-sub{
    margin-top:4px;
    color:var(--muted);
    font-size:11px;
}

.empty{
    color:var(--muted);
    text-align:center;
    padding:50px 15px;
    font-size:13px;
}

.hotel-box{
    margin-top:14px;
    display:grid;
    grid-template-columns:1fr 1fr 1fr;
    gap:14px;
}

.hotel-stat{
    padding:18px;
}

.hotel-stat strong{
    display:block;
    font-size:25px;
    margin-top:5px;
}

@media(max-width:1100px){
    .navitems{
        overflow-x:auto;
    }

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

    .grid-main{
        grid-template-columns:1fr;
    }
}

@media(max-width:700px){
    .brand{
        min-width:auto;
    }

    .navitems{
        display:none;
    }

    .userarea span{
        display:none;
    }

    .page{
        padding:12px;
    }

    .kpis,
    .hotel-box{
        grid-template-columns:1fr;
    }
}

/* CAST NAVI DRIVER VEHICLE ICON */
.driver-dot img{
    position:relative;
    z-index:3;
    width:46px;
    max-height:42px;
    object-fit:contain;
    display:block;
    filter:drop-shadow(0 2px 4px rgba(0,0,0,.35));
}

.driver-dot span{
    position:relative;
    z-index:3;
    font-size:11px;
    font-weight:900;
}

/* =========================================================
   CAST NAVI GPS - SIGMA style driver marker
========================================================= */

.driver-marker{
    position:relative;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:3px;
    cursor:pointer;
}

/* ドライバー名 */
.driver-label{
    padding:3px 8px !important;
    border-radius:999px !important;

    background:rgba(6,17,31,.92) !important;
    border:1px solid rgba(0,168,255,.55) !important;

    box-shadow:
        0 0 16px rgba(0,168,255,.25) !important;

    color:#e0f2fe !important;

    font-size:11px !important;
    font-weight:900 !important;

    white-space:nowrap;
}

/* 通常マーカー */
.driver-dot{
    position:relative !important;

    width:56px !important;
    height:56px !important;

    display:flex !important;
    align-items:center !important;
    justify-content:center !important;

    background:transparent !important;
    border:0 !important;

    box-shadow:none !important;
}

/* リング */
.driver-dot::before{
    content:'';

    position:absolute;
    inset:4px;

    border-radius:50%;

    border:3px solid #fff;

    z-index:0;

    pointer-events:none;
}

/* 通常時の車は小さい */
.driver-dot img{
    position:relative;
    z-index:3;

    width:34px !important;
    height:auto !important;
    max-height:40px !important;

    object-fit:contain;

    display:block;

    filter:
        drop-shadow(0 2px 4px rgba(0,0,0,.35));

    pointer-events:none;
}

/* 通信停止 */
.driver-dot.stale::before{
    border-color:#ef4444;

    box-shadow:
        0 0 10px rgba(239,68,68,.95),
        0 0 22px rgba(239,68,68,.55);
}

/* 待機 */
.driver-dot.waiting::before{
    border-color:#fff;

    box-shadow:
        0 0 10px rgba(255,255,255,.85),
        0 0 22px rgba(255,255,255,.35);
}

/* 通常走行 */
.driver-dot:not(.waiting):not(.stale)::before{
    border-color:#22c55e;

    box-shadow:
        0 0 10px rgba(34,197,94,.95),
        0 0 22px rgba(34,197,94,.55);
}


/* =========================================================
   SIGMA style popup
========================================================= */

.mapboxgl-popup{
    z-index:50;
}

.mapboxgl-popup-content{
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;

    padding:0 !important;

    overflow:hidden;

    border-radius:4px !important;

    background:#fff !important;

    box-shadow:
        0 8px 24px rgba(0,0,0,.30) !important;
}

.castnavi-driver-popup{
    width:188px;

    box-sizing:border-box;

    padding:18px 14px 16px;

    text-align:center;

    background:#fff;

    color:#111827;
}

.castnavi-driver-popup-car{
    height:82px;

    display:flex;
    justify-content:center;
    align-items:center;

    margin-bottom:7px;
}

.castnavi-driver-popup-car img{
    width:90px;
    max-width:110px;

    max-height:75px;

    object-fit:contain;

    display:block;
}

.castnavi-driver-popup-name{
    font-size:14px;
    line-height:1.35;

    font-weight:900;

    color:#111827;
}

.castnavi-driver-popup-status{
    margin-top:5px;

    font-size:12px;
    font-weight:500;

    color:#475569;
}

.mapboxgl-popup-close-button{
    width:25px;
    height:25px;

    padding:0 !important;

    top:4px !important;
    right:4px !important;

    display:flex;
    align-items:center;
    justify-content:center;

    border:2px solid #60a5fa !important;
    border-radius:3px;

    color:#111827 !important;

    background:#fff !important;

    font-size:16px !important;
    line-height:1 !important;
}


/* =========================================================
   CAST NAVI GPS - SIGMA exact anchor structure
========================================================= */

.driver-marker-anchor{
    position:relative !important;
    width:0 !important;
    height:0 !important;
    overflow:visible !important;
}

.driver-marker-anchor > .driver-marker{
    position:absolute !important;
    left:50% !important;
    bottom:0 !important;
    transform:translate(-50%,0) !important;
    transform-origin:50% 100% !important;
}


/* GPS座標を56px車リングの中心へ合わせる */
.driver-marker-anchor > .driver-marker{
    transform:translate(-50%,28px) !important;
    transform-origin:50% 100% !important;
}
