/* System ON TIME NORTH — shell Tabler v2 (wzorowany na Systemie TSL). */
:root {
    --north-night: #07111c;
    --north-panel: #101b29;
    --north-blue: #0b5cad;
    --north-teal: #14b8a6;
    --north-page-bg: #f3f6fa;
    --north-sidebar-bg: #ffffff;
    --north-sidebar-border: #dce3ec;
    --north-topbar-bg: rgba(255, 255, 255, .96);
    --north-nav-color: #334155;
    --north-nav-hover: rgba(11, 92, 173, .07);
    --north-nav-active: rgba(11, 92, 173, .12);
    --north-nav-active-color: #084a8c;
    --north-focus: #0b5cad;
    --north-sidebar-width: 250px;
    --north-sidebar-collapsed-width: 72px;
}

[data-bs-theme="dark"] {
    --north-page-bg: #0a1420;
    --north-sidebar-bg: var(--north-night);
    --north-sidebar-border: rgba(255, 255, 255, .08);
    --north-topbar-bg: rgba(16, 27, 41, .96);
    --north-nav-color: #c7d2df;
    --north-nav-hover: rgba(20, 184, 166, .08);
    --north-nav-active: rgba(20, 184, 166, .14);
    --north-nav-active-color: #ffffff;
    --north-focus: var(--north-teal);
}

body.north-v2,
body.north-login {
    --tblr-primary: var(--north-blue);
    --tblr-primary-rgb: 11, 92, 173;
    background: var(--north-page-bg);
}

.north-v2 .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.north-skip-link {
    position: absolute;
    z-index: 1080;
    top: 8px;
    left: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--tblr-bg-surface);
}

/* Marka (tekstowa, do czasu logo ON TIME NORTH). */
.north-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--tblr-body-color);
    text-decoration: none;
}

.north-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(135deg, var(--north-blue), var(--north-teal));
}

.north-brand-mark .icon {
    width: 22px;
    height: 22px;
}

.north-brand-text {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: .04em;
    white-space: nowrap;
}

.north-brand-text strong {
    font-weight: 800;
}

/* Pasek boczny */
.north-v2-sidebar {
    background: var(--north-sidebar-bg);
    border-right: 1px solid var(--north-sidebar-border);
}

.north-v2-sidebar .navbar-brand {
    min-height: 72px;
}

.north-v2-brand-compact {
    display: none;
    color: var(--north-blue);
    font-size: .875rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.north-v2-sidebar .nav-link {
    margin: 1px 8px;
    border-radius: 7px;
    color: var(--north-nav-color);
}

.north-v2-sidebar .nav-link:hover {
    color: var(--north-nav-active-color);
    background: var(--north-nav-hover);
}

.north-v2-sidebar .nav-link.active {
    color: var(--north-nav-active-color);
    background: var(--north-nav-active);
}

.north-v2-nav-section {
    margin: 14px 12px 4px;
    padding-top: 7px;
    border-top: 1px solid var(--north-sidebar-border);
}

.north-v2-nav-section-label {
    color: var(--north-nav-color);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
    opacity: .66;
}

.north-v2-sidebar .nav-link:focus-visible,
.north-v2-topbar a:focus-visible,
.north-v2-topbar button:focus-visible,
.north-theme-toggle:focus-visible {
    outline: 2px solid var(--north-focus);
    outline-offset: 2px;
}

.north-v2-topbar {
    min-height: 58px;
    background: var(--north-topbar-bg);
    border-bottom: 1px solid var(--north-sidebar-border);
}

.north-v2 .page-body {
    min-height: calc(100vh - 116px);
}

/* Pulpit */
.north-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 12px;
}

.north-module-card {
    min-height: 132px;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}

.north-module-card:hover {
    color: inherit;
    border-color: rgba(20, 184, 166, .5);
    transform: translateY(-1px);
}

.north-module-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    color: var(--north-teal);
    background: rgba(20, 184, 166, .12);
}

.north-code {
    font-family: var(--tblr-font-monospace);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: .12em;
}

.north-mono {
    font-family: var(--tblr-font-monospace);
}

@media (min-width: 992px) {
    .north-v2-sidebar.navbar-vertical {
        width: var(--north-sidebar-width);
        transition: width 180ms ease;
    }

    .north-v2-sidebar.navbar-vertical ~ .page-wrapper {
        margin-left: var(--north-sidebar-width);
        transition: margin-left 180ms ease;
    }

    .north-v2-sidebar-collapsed .north-v2-sidebar.navbar-vertical {
        width: var(--north-sidebar-collapsed-width);
    }

    .north-v2-sidebar-collapsed .north-v2-sidebar.navbar-vertical ~ .page-wrapper {
        margin-left: var(--north-sidebar-collapsed-width);
    }

    .north-v2-sidebar-collapsed .north-v2-sidebar > .container-fluid {
        padding-inline: 0;
    }

    .north-v2-sidebar-collapsed .north-v2-sidebar .navbar-brand {
        justify-content: center;
        padding-inline: 8px;
    }

    .north-v2-sidebar-collapsed .north-v2-brand-full,
    .north-v2-sidebar-collapsed .north-v2-sidebar .nav-link-title,
    .north-v2-sidebar-collapsed .north-v2-nav-section {
        display: none !important;
    }

    .north-v2-sidebar-collapsed .north-v2-brand-compact {
        display: inline-flex;
    }

    .north-v2-sidebar-collapsed .north-v2-sidebar .nav-link {
        justify-content: center;
        padding-inline: 8px;
    }

    .north-v2-sidebar-collapsed .north-v2-sidebar .nav-link-icon {
        margin: 0 !important;
    }
}

@media (max-width: 991.98px) {
    .north-v2-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--north-sidebar-border);
    }

    .north-v2-sidebar .navbar-brand {
        min-height: 52px;
    }
}

/* Logowanie i ustawienie hasła */
body.north-login {
    min-height: 100vh;
    margin: 0;
}

.north-login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr);
}

.north-login-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(32px, 5vw, 72px);
    color: #0b3657;
    background:
        radial-gradient(circle at 85% 10%, rgba(20, 184, 166, .2), transparent 34%),
        linear-gradient(145deg, #e8f3fb, #ffffff);
}

[data-bs-theme="dark"] .north-login-brand {
    color: #f7fbff;
    background:
        radial-gradient(circle at 85% 10%, rgba(20, 184, 166, .22), transparent 34%),
        linear-gradient(145deg, var(--north-night), var(--north-panel));
}

.north-login-brand::after {
    position: absolute;
    right: -20%;
    bottom: -28%;
    width: 70%;
    aspect-ratio: 1;
    border: 1px solid rgba(20, 184, 166, .22);
    border-radius: 50%;
    content: "";
}

.north-login-brand .north-brand {
    color: inherit;
}

.north-login-brand .north-brand-text {
    font-size: 1.35rem;
}

.north-login-copy {
    position: relative;
    z-index: 1;
    max-width: 680px;
}

.north-login-copy > span {
    color: var(--north-teal);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
}

.north-login-copy h1 {
    margin: 18px 0;
    font-size: clamp(2.2rem, 4.6vw, 4.4rem);
    line-height: 1.04;
}

.north-login-copy p {
    opacity: .75;
    font-size: 1rem;
}

.north-login-panel {
    display: grid;
    place-content: center;
    padding: 28px;
}

.north-login-card {
    width: min(100%, 440px);
    box-shadow: 0 18px 48px rgba(7, 17, 28, .12);
}

.north-login-card .card-body {
    padding: clamp(26px, 5vw, 42px);
}

.north-login-mobile-brand {
    display: none;
}

.north-login-theme-toggle {
    position: fixed;
    z-index: 5;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    border: 1px solid var(--tblr-border-color);
    background: var(--tblr-bg-surface);
}

.north-code-input {
    font-family: var(--tblr-font-monospace);
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
}

@media (max-width: 880px) {
    .north-login-layout {
        grid-template-columns: 1fr;
    }

    .north-login-brand {
        display: none;
    }

    .north-login-panel {
        min-height: 100vh;
    }

    .north-login-mobile-brand {
        display: inline-flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    .north-v2-sidebar.navbar-vertical,
    .north-v2-sidebar.navbar-vertical ~ .page-wrapper,
    .north-module-card {
        transition: none;
    }
}

/* Wiersze z przejściem do szczegółów */
.north-row-link {
    cursor: pointer;
}

.north-row-link:hover {
    background: var(--tblr-active-bg, rgba(11, 92, 173, .04));
}

.north-flag {
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 6px;
    vertical-align: -2px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

/* Galeria zdjęć pojazdu */
.north-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}

.north-photo {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    background: var(--tblr-bg-surface-secondary);
}

.north-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.north-photo-caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 4px 8px;
    color: #fff;
    font-size: .75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}

/* Mapa GPS */
.north-map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 12px;
}

#north-map {
    height: calc(100vh - 290px);
    min-height: 460px;
    border-radius: 8px;
}

.north-map-list {
    max-height: calc(100vh - 380px);
    min-height: 360px;
    overflow-y: auto;
}

.north-map-marker {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    background: var(--north-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.north-map-marker.is-moving {
    background: #2fb344;
}

.north-map-marker.is-stale {
    background: #868e96;
}

.north-map-marker.is-trailer {
    border-radius: 6px;
    background: var(--north-teal);
}

.north-map-label {
    padding: 1px 6px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    font-weight: 700;
    background: rgba(7, 17, 28, .85);
    box-shadow: none;
}

.north-map-label::before {
    display: none;
}

@media (max-width: 991.98px) {
    .north-map-layout {
        grid-template-columns: 1fr;
    }

    #north-map {
        height: 60vh;
    }

    .north-map-list {
        max-height: none;
    }
}
