/* ilmCode GPS - admin + client panel. No build step; bump ?v= in layouts when changing. */
:root {
    --bg: #f4f6f9; --card: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
    --brand: #0d9488; --brand-ink: #fff; --ok: #16a34a; --idle: #f59e0b; --off: #94a3b8; --bad: #dc2626;
    --radius: 10px; --top: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 "Hind Siliguri", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
small { font-size: 12.5px; }
.muted { color: var(--muted); }
code { font-size: 13px; background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }

/* top bar */
.topbar { height: var(--top); display: flex; align-items: center; gap: 24px; padding: 0 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 1000; }
.brand { color: #fff; font-size: 18px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand b { color: #5eead4; }
.brand.big { color: var(--ink); font-size: 26px; justify-content: center; }
.brand.big b { color: var(--brand); }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: #2dd4bf; box-shadow: 0 0 0 4px rgba(45, 212, 191, .25); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #cbd5e1; padding: 6px 12px; border-radius: 8px; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.logout { display: flex; align-items: center; gap: 10px; }
.logout .who { color: #94a3b8; font-size: 13px; }
.logout button { background: none; border: 1px solid #334155; color: #cbd5e1; border-radius: 8px; padding: 4px 10px; cursor: pointer; }

.flash { padding: 10px 16px; font-size: 14px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.warn { background: #fef3c7; color: #92400e; }

/* buttons / forms */
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 16px; border-radius: 8px; cursor: pointer; font: inherit; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.link.danger { color: var(--bad); }
label { display: block; font-size: 13.5px; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(13, 148, 136, .3); border-color: var(--brand); }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; }
.stack > * + * { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; gap: 10px; }
.error { color: var(--bad); font-size: 14px; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: #f1f5f9; color: var(--muted); }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.bad { background: #fee2e2; color: #991b1b; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #ccfbf1, var(--bg) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--card); padding: 32px 28px; border-radius: 16px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.login-card > p { text-align: center; margin: 4px 0 24px; }
.login-card > * + label { margin-top: 14px; }
.login-card .btn { margin-top: 18px; padding: 11px; }

/* map pages */
.map-layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--top)); }
#map { height: 100%; }
.panel { background: var(--card); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 18px; }
.vehicle-list { list-style: none; padding: 0; margin: 12px 0 0; }
.vehicle-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; }
.vehicle-list li:hover { border-color: #99f6e4; }
.vehicle-list li.active { border-color: var(--brand); background: #f0fdfa; }
.v-name { font-weight: 600; }
.v-name small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.st { font-size: 13px; }
.st::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.st.moving::before { background: var(--ok); } .st.idle::before { background: var(--idle); } .st.parked::before { background: #2563eb; } .st.off::before { background: var(--off); }

.veh-icon { background: none; border: 0; }
.veh { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.veh.moving { background: var(--ok); } .veh.idle { background: var(--idle); } .veh.parked { background: #2563eb; } .veh.off { background: var(--off); }
.veh .arrow { font-size: 14px; line-height: 1; transform-origin: center; }
.veh-label { position: absolute; top: 36px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }

.quick { display: flex; gap: 6px; }
.quick button { flex: 1; border: 1px solid var(--line); background: #f8fafc; border-radius: 8px; padding: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.result { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px; }
.stats div { background: #f8fafc; border-radius: 8px; padding: 10px 4px; }
.stats b { display: block; font-size: 20px; }
.stats small { color: var(--muted); }
.player { display: flex; gap: 8px; margin: 14px 0 8px; }
.player .btn { flex: 1; }
.player select { width: 80px; margin: 0; }
input[type=range] { padding: 0; border: 0; accent-color: var(--brand); }

/* plain pages */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.page.narrow { max-width: 680px; }
.page h1 { margin: 0 0 16px; font-size: 22px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 500; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions > * { margin-left: 10px; display: inline; }

@media (max-width: 760px) {
    .topbar { gap: 10px; }
    .logout .who { display: none; }
    .map-layout { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
    #map { grid-row: 1; height: 55vh; }
    .panel { grid-row: 2; border-right: 0; }
    .grid2 { grid-template-columns: 1fr; }
}

.page h2.sub { font-size: 16px; margin: 26px 0 10px; }
