/* IGNAN Track web preview (tracking_map.php) — light design (owner 2026-11-20). */
:root {
    --tm-bg: #f4f6f9;
    --tm-card: #ffffff;
    --tm-text: #0f172a;
    --tm-muted: #64748b;
    --tm-line: #e3e8ef;
    --tm-accent: #1769e0;
    --tm-accent-soft: #e8f0fd;
    --tm-ok: #15803d;
    --tm-ok-soft: #e7f6ec;
    --tm-warn: #b45309;
    --tm-err: #b91c1c;
    --tm-err-soft: #fdecec;
    --tm-radius: 14px;
    --tm-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
    --tm-bar: 60px;
    --tm-head: #0b3560; /* IGNAN navy, same as the site footer (owner 2026-11-20: header in its own colour) */
}

* { box-sizing: border-box; }

/* Component display rules must not beat the hidden attribute. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body.tm {
    margin: 0;
    background: var(--tm-bg);
    color: var(--tm-text);
    font: 400 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.tm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ top bar */
.tm-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--tm-bar);
    padding: 0 20px;
    background: var(--tm-head);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 2px 10px rgba(11, 53, 96, .25);
}

.tm-logo { font-size: 20px; letter-spacing: -.02em; color: #fff; text-decoration: none; white-space: nowrap; }
.tm-logo b { font-weight: 800; }
.tm-logo span { font-weight: 400; color: #8ec5ff; }

.tm-bar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }

.tm-vehicle select {
    height: 38px;
    max-width: 260px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--tm-line);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--tm-text);
    font: inherit;
    font-weight: 500;
    appearance: none;
}

.tm-user { display: flex; align-items: center; gap: 8px; min-width: 0; color: rgba(255, 255, 255, .82); font-size: 14px; }
.tm-bar .tm-avatar { background: rgba(255, 255, 255, .16); color: #fff; }
.tm-bar .tm-btn-line { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.tm-bar .tm-btn-line:hover { background: rgba(255, 255, 255, .1); border-color: #fff; }
.tm-bar .tm-vehicle select { border-color: transparent; }
.tm-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.tm-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tm-accent-soft);
    color: var(--tm-accent);
    font-weight: 700;
}

/* ------------------------------------------------------------ buttons, links */
.tm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.tm-btn:disabled { opacity: .6; cursor: default; }
.tm-btn-line { background: #fff; border-color: var(--tm-line); color: var(--tm-text); }
.tm-btn-line:hover { border-color: #c9d2de; }
.tm-btn-soft { background: var(--tm-accent-soft); color: var(--tm-accent); }
.tm-btn-soft:hover { background: #dbe7fb; }
.tm-btn:focus-visible, .tm-item:focus-visible, .tm-seg button:focus-visible, .tm-link:focus-visible {
    outline: 3px solid rgba(23, 105, 224, .35);
    outline-offset: 2px;
}

.tm-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--tm-accent);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.tm-link:hover { text-decoration: underline; }

.tm-kicker { display: block; color: var(--tm-muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.tm-note { display: block; color: var(--tm-muted); font-size: 12.5px; line-height: 1.45; }

.tm-alert {
    margin: 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--tm-err-soft);
    color: var(--tm-err);
    font-size: 14px;
}

/* ------------------------------------------------------------ sign-in */
.tm-login {
    display: grid;
    place-items: center;
    min-height: calc(100vh - var(--tm-bar));
    padding: 32px 16px;
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(23, 105, 224, .10), transparent 70%),
        var(--tm-bg);
}

.tm-login-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    background: var(--tm-card);
    border: 1px solid var(--tm-line);
    border-radius: 20px;
    box-shadow: var(--tm-shadow);
    text-align: center;
}
.tm-login-card h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.tm-login-card p { margin: 0; color: var(--tm-muted); }
.tm-login-card small { color: var(--tm-muted); }
.tm-login-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--tm-accent-soft);
    color: var(--tm-accent);
}
.tm-login-icon svg { width: 28px; height: 28px; }
.tm-login-form { display: flex; justify-content: center; min-height: 44px; width: 100%; }

/* ------------------------------------------------------------ app layout */
.tm-app {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    height: calc(100vh - var(--tm-bar));
    height: calc(100dvh - var(--tm-bar));
}

.tm-side {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--tm-card);
    border-right: 1px solid var(--tm-line);
}

/* Compact status (owner 2026-11-20): the room goes to the journey history below. */
.tm-status { display: flex; flex-direction: column; gap: 4px; padding: 14px 20px 12px; border-bottom: 1px solid var(--tm-line); }
.tm-status-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tm-status h1 { margin: 0; font-size: 16px; letter-spacing: -.01em; line-height: 1.3; }
.tm-status h1 small { color: var(--tm-muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.tm-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--tm-muted); }
.tm-place { margin: 0; font-size: 14px; font-weight: 500; }
.tm-place:empty { display: none; }
.tm-status .tm-note { font-size: 11.5px; }
.tm-icon-btn {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--tm-accent-soft);
    color: var(--tm-accent);
    cursor: pointer;
}
.tm-icon-btn:hover { background: #dbe7fb; }
.tm-icon-btn svg { width: 18px; height: 18px; }

.tm-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef1f5;
    color: var(--tm-muted);
    font-size: 13px;
    font-weight: 600;
}
.tm-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tm-pill.is-parked { background: var(--tm-ok-soft); color: var(--tm-ok); }
.tm-pill.is-idle { background: #eef1f5; color: var(--tm-muted); }

.tm-period { padding: 12px 20px 10px; border-bottom: 1px solid var(--tm-line); }
.tm-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    margin-bottom: 10px;
    padding: 0 12px;
    border: 1px solid var(--tm-line);
    border-radius: 10px;
    background: #fff;
    color: var(--tm-muted);
}
.tm-search:focus-within { border-color: var(--tm-accent); box-shadow: 0 0 0 3px rgba(23, 105, 224, .15); }
.tm-search svg { flex: none; width: 16px; height: 16px; }
.tm-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--tm-text); font: inherit; font-size: 14px; }
.tm-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #eef1f5; }
.tm-seg button {
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--tm-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.tm-seg button.is-on { background: #fff; color: var(--tm-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tm-totals { margin: 10px 2px 0; color: var(--tm-muted); font-size: 13.5px; }
.tm-totals b { color: var(--tm-text); font-weight: 600; }

.tm-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 20px; }
.tm-empty { margin: 24px 8px; color: var(--tm-muted); text-align: center; }

.tm-day h3 {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0;
    padding: 14px 8px 6px;
    background: var(--tm-card);
    font-size: 13px;
    font-weight: 700;
}
.tm-day h3 small { color: var(--tm-muted); font-weight: 600; }

.tm-item {
    min-width: 0;
    display: flex;
    gap: 12px;
    width: 100%;
    margin: 2px 0;
    padding: 10px 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tm-item:hover { background: #f5f7fb; }
.tm-item.is-on { background: var(--tm-accent-soft); border-color: #c8dafb; }
.tm-item-time {
    display: flex;
    flex-direction: column;
    flex: none;
    width: 46px;
    color: var(--tm-text);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.tm-item-time i { color: var(--tm-muted); font-style: normal; font-weight: 500; }
.tm-item-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.tm-item-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tm-item-main small { color: var(--tm-muted); font-size: 13px; }

/* ------------------------------------------------------------ map */
.tm-map-wrap { position: relative; min-height: 0; }
.tm-map { position: absolute; inset: 0; background: #e8ecf1; }
.leaflet-container { font-family: inherit; }
.leaflet-control-zoom a { border-radius: 8px; }

.tm-car span {
    position: relative;
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(23, 105, 224, .18);
}
.tm-car span::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: var(--tm-accent);
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .3);
}

.tm-dot { border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .35); }
.tm-dot.is-start { background: var(--tm-ok); }
.tm-dot.is-start.is-estimated { background: #fff; border-color: var(--tm-ok); }
.tm-note-est::before {
    content: "";
    display: inline-block;
    width: 18px;
    margin: 0 6px 3px 0;
    border-top: 3px dotted #64748b;
    vertical-align: middle;
}
.tm-dot.is-end { background: var(--tm-err); }

.tm-trip {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 900;
    width: min(380px, calc(100% - 32px));
    padding: 16px 18px;
    background: var(--tm-card);
    border: 1px solid var(--tm-line);
    border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow);
}
.tm-trip h2 { margin: 4px 72px 10px 0; font-size: 16px; line-height: 1.35; }
.tm-trip .tm-kicker { margin-right: 72px; }
.tm-trip-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.tm-trip-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f1f4f8;
    color: var(--tm-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.tm-trip-btn:hover { background: #e5eaf1; color: var(--tm-text); }
.tm-trip-btn svg { width: 16px; height: 16px; transition: transform .2s; }
.tm-trip.is-min { padding: 10px 14px; }
.tm-trip.is-min h2 { margin-bottom: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.tm-trip.is-min .tm-trip-btn svg { transform: rotate(180deg); }
.tm-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 0; }
.tm-stats div { min-width: 0; }
.tm-stats dt { color: var(--tm-muted); font-size: 12px; }
.tm-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tm-trip .tm-note { margin: 10px 0 0; }

/* ------------------------------------------------------------ phone */
@media (max-width: 860px) {
    .tm-bar { padding: 0 12px; }
    .tm-user-name { display: none; }
    .tm-vehicle select { max-width: 150px; }
    body.tm { overflow-x: hidden; }
    .tm-bar-end { gap: 8px; }
    .tm-app {
        display: flex;
        flex-direction: column-reverse;
        width: 100%;
        height: auto;
    }
    .tm-side, .tm-map-wrap { width: 100%; }
    .tm-map-wrap { height: 52vh; min-height: 300px; }
    .tm-side { border-right: 0; border-top: 1px solid var(--tm-line); }
    .tm-list { overflow: visible; }
    .tm-trip { left: 8px; right: 8px; bottom: 8px; width: auto; padding: 12px 14px; }
    .tm-trip h2 { font-size: 15px; margin-bottom: 8px; }
    .tm-stats { grid-template-columns: repeat(3, 1fr); gap: 6px 12px; }
}
