:root {
    --sw-blue: #0878d8;
    --sw-blue-strong: #0069c7;
    --sw-blue-deep: #063f7b;
    --sw-black: #101820;
    --sw-ink: #182433;
    --sw-charcoal: #293747;
    --sw-muted: #6d7b8d;
    --sw-gray: #f3f7fb;
    --sw-gray-2: #eaf1f8;
    --sw-line: #dfe8f2;
    --sw-white: #ffffff;
    --sw-green: #17a86b;
    --sw-orange: #f59e0b;
    --sw-red: #d94848;
    --radius: 8px;
    --shadow-soft: 0 14px 38px rgba(25, 43, 64, .08);
    --shadow-card: 0 10px 26px rgba(25, 43, 64, .06);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Montserrat", Arial, sans-serif;
    color: var(--sw-charcoal);
    background:
        linear-gradient(180deg, #f7fbff 0%, #eef4fa 100%);
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, .brand-copy strong, .public-title {
    font-family: "Baloo 2", "Arial Rounded MT Bold", "Rubik", Arial, sans-serif;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--sw-black);
}
h1, h2, h3, h4, h5 { line-height: 1.05; }

a { color: var(--sw-blue); text-decoration: none; }
a:hover { color: var(--sw-blue-deep); }

.btn {
    border-radius: 7px;
    font-weight: 800;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: none;
}
.btn-primary {
    --bs-btn-bg: var(--sw-blue);
    --bs-btn-border-color: var(--sw-blue);
    --bs-btn-hover-bg: var(--sw-blue-deep);
    --bs-btn-hover-border-color: var(--sw-blue-deep);
}
.btn-outline-primary {
    --bs-btn-color: var(--sw-blue);
    --bs-btn-border-color: #9dcaee;
    --bs-btn-hover-bg: var(--sw-blue);
    --bs-btn-hover-border-color: var(--sw-blue);
}
.btn-success {
    --bs-btn-bg: var(--sw-green);
    --bs-btn-border-color: var(--sw-green);
}
.btn-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    padding: 0;
}

.form-label {
    color: #44566b;
    font-size: .84rem;
    font-weight: 800;
    margin-bottom: 7px;
}
.form-control, .form-select {
    border-radius: 7px;
    min-height: 46px;
    border-color: #d7e2ee;
    color: var(--sw-ink);
    font-weight: 600;
    background-color: #fff;
}
.form-control::placeholder { color: #97a6b8; font-weight: 600; }
.form-control:focus, .form-select:focus {
    border-color: var(--sw-blue);
    box-shadow: 0 0 0 .22rem rgba(8, 120, 216, .12);
}
.input-group-text {
    border-color: #d7e2ee;
    background: #f5f9fd;
    color: var(--sw-blue);
    font-weight: 800;
}

.logo-white {
    display: inline-flex;
    align-items: center;
    background: #fff;
    padding: 0;
    border: 0;
    box-shadow: none;
    outline: 0;
}
.logo-white img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.admin-body { min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 292px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    overflow-y: auto;
    background: #fbfdff;
    border-right: 1px solid var(--sw-line);
    box-shadow: 12px 0 30px rgba(26, 45, 67, .04);
}
.sidebar-brand {
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--sw-line);
    background: #fff;
}
.sidebar-brand .logo-white {
    width: 178px;
    min-height: 60px;
}
.sidebar-brand img { max-height: 60px; }
.brand-copy {
    margin-top: 12px;
    display: grid;
    gap: 3px;
}
.brand-copy strong {
    font-size: 1.05rem;
    line-height: 1.1;
}
.brand-copy span {
    color: var(--sw-muted);
    font-size: .76rem;
    font-weight: 900;
    text-transform: uppercase;
}
.sidebar-nav { padding: 16px 12px 28px; }
.nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #3f5064;
    border-radius: 7px;
    font-weight: 800;
    margin: 3px 0;
    padding: 10px 12px;
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
}
.nav-link i {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    color: var(--sw-blue);
}
.nav-link:hover {
    background: #eef7ff;
    color: var(--sw-blue-deep);
}
.nav-link.active {
    color: var(--sw-blue-deep);
    background: #e8f4ff;
    border-color: #c8e4fa;
    box-shadow: inset 3px 0 0 var(--sw-blue);
}
.nav-group-toggle .fa-chevron-down {
    transition: transform .18s ease;
    color: #8495a8;
    width: auto;
}
.nav-group.is-open .fa-chevron-down { transform: rotate(180deg); }
.nav-sub {
    display: none;
    padding-left: 28px;
    margin: 2px 0 8px;
}
.nav-group.is-open .nav-sub { display: block; }
.nav-sub .nav-link {
    min-height: 36px;
    font-size: .9rem;
    font-weight: 750;
    padding: 8px 10px;
}

.main-content {
    flex: 1;
    margin-left: 292px;
    padding: 30px;
    max-width: calc(100% - 292px);
}
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, .82);
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(8px);
}
.content-header h1 {
    margin: 0;
    font-size: clamp(1.7rem, 2.2vw, 2.35rem);
}
.eyebrow {
    font-size: .74rem;
    text-transform: uppercase;
    color: var(--sw-blue);
    font-weight: 900;
}
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1050;
    background: #fff;
    border-bottom: 1px solid var(--sw-line);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 22px rgba(24, 40, 58, .06);
}
.mobile-title {
    font-weight: 900;
    color: var(--sw-black);
}

.panel {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-card);
}
.panel h4 { margin-bottom: 14px; }

.metric-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    padding: 18px;
    min-height: 126px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    box-shadow: var(--shadow-card);
}
.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--sw-blue);
}
.metric-card .metric-label {
    color: var(--sw-muted);
    font-weight: 900;
    font-size: .78rem;
    text-transform: uppercase;
}
.metric-card .metric-value {
    margin-top: 8px;
    font-size: 2.05rem;
    color: var(--sw-black);
    font-weight: 900;
    line-height: 1.05;
}
.metric-card .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: #eaf5ff;
    color: var(--sw-blue);
    flex: 0 0 auto;
    border: 1px solid #cae3f8;
}

.table {
    vertical-align: middle;
    color: var(--sw-charcoal);
}
.table > :not(caption) > * > * {
    padding: .9rem .85rem;
}
.table thead th {
    background: #f5f9fd;
    border-bottom: 1px solid var(--sw-line);
    font-size: .75rem;
    color: #526273;
    text-transform: uppercase;
    white-space: nowrap;
    font-weight: 900;
}
.table tbody tr:hover { background: #f8fbff; }
.table-responsive {
    border-radius: var(--radius);
    border: 1px solid var(--sw-line);
}
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d7e2ee;
    border-radius: 7px;
    min-height: 40px;
    padding: 7px 12px;
}
.dt-buttons .btn { min-height: 36px; padding: 6px 10px; }

.badge {
    font-weight: 900;
    padding: .52em .78em;
}
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.action-buttons .btn { min-height: 34px; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.detail-item {
    border: 1px solid var(--sw-line);
    border-radius: 7px;
    padding: 14px;
    background: #fff;
}
.detail-item span {
    display: block;
    color: var(--sw-muted);
    font-size: .74rem;
    text-transform: uppercase;
    font-weight: 900;
    margin-bottom: 5px;
}
.detail-item strong {
    color: var(--sw-black);
    word-break: break-word;
}

.timeline { display: grid; gap: 12px; }
.timeline-item {
    border-left: 4px solid var(--sw-blue);
    padding: 10px 0 10px 14px;
    background: #f8fbff;
    border-radius: 0 7px 7px 0;
}
.timeline-item .time {
    color: var(--sw-muted);
    font-size: .82rem;
    font-weight: 800;
}

.public-body {
    background:
        linear-gradient(180deg, #ffffff 0%, #eef5fb 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.public-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px clamp(16px, 4vw, 52px);
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--sw-line);
    box-shadow: 0 8px 24px rgba(25, 43, 64, .05);
}
.public-logo img {
    max-height: 68px;
    max-width: 230px;
}
.public-header nav a {
    font-weight: 900;
    color: var(--sw-blue-deep);
}
.tracking-wrap {
    width: min(1120px, calc(100% - 28px));
    margin: 34px auto;
    display: grid;
    gap: 20px;
}
.tracking-hero {
    background: #fff;
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    padding: clamp(24px, 5vw, 46px);
    box-shadow: var(--shadow-soft);
}
.tracking-hero::after {
    content: "";
    display: block;
    height: 1px;
    margin-top: 26px;
    background: linear-gradient(90deg, var(--sw-blue), transparent);
}
.public-title {
    font-size: clamp(2.15rem, 5vw, 3.7rem);
    line-height: .95;
    margin-bottom: 10px;
}
.tracking-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-top: 26px;
}
.tracking-search .form-control {
    min-height: 56px;
    font-size: 1rem;
}
.tracking-search .btn { min-height: 56px; }
.tracking-result {
    background: #fff;
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-card);
}
.contact-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.contact-tile {
    background: #fff;
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--sw-charcoal);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
    box-shadow: var(--shadow-card);
}
.contact-tile i {
    color: var(--sw-blue);
    margin-top: 3px;
    font-size: 1.1rem;
}
.contact-tile span { word-break: break-word; font-weight: 700; }
.public-footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
    color: var(--sw-muted);
    background: #fff;
    border-top: 1px solid var(--sw-line);
}

.login-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 34px auto;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
    gap: 20px;
    align-items: stretch;
}
.login-brand-panel,
.login-card {
    background: #fff;
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.login-brand-panel {
    padding: clamp(24px, 5vw, 46px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 610px;
}
.login-brand-panel .logo-white img {
    max-height: 82px;
    max-width: 260px;
}
.login-card {
    padding: clamp(22px, 4vw, 36px);
}
.login-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}
.login-stat {
    border: 1px solid var(--sw-line);
    border-radius: 7px;
    padding: 14px;
    background: #f8fbff;
}
.login-stat strong {
    display: block;
    font-size: 1.25rem;
    color: var(--sw-black);
}
.login-stat span {
    display: block;
    color: var(--sw-muted);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}
.login-rail {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}
.login-rail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--sw-line);
    border-radius: 7px;
    background: #fff;
    color: var(--sw-charcoal);
    font-weight: 800;
}
.login-rail-item i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: #eaf5ff;
    color: var(--sw-blue);
}

.install-body {
    background:
        linear-gradient(180deg, #ffffff 0%, #eef5fb 100%);
    min-height: 100vh;
}
.install-shell {
    width: min(980px, calc(100% - 28px));
    margin: 32px auto;
}
.install-card {
    background: #fff;
    border: 1px solid var(--sw-line);
    border-radius: var(--radius);
    padding: clamp(20px, 4vw, 36px);
    box-shadow: var(--shadow-soft);
}
.install-logo img {
    max-height: 74px;
    max-width: 240px;
}
.step-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0;
}
.step-pills span {
    border: 1px solid var(--sw-line);
    border-radius: 999px;
    padding: 7px 12px;
    font-weight: 900;
    color: var(--sw-muted);
    background: #fff;
}
.step-pills .active {
    color: #fff;
    background: var(--sw-blue);
    border-color: var(--sw-blue);
}
.requirement-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--sw-line);
}
.diagnose-shell { width: min(1180px, calc(100% - 28px)); }
.diagnose-head {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 22px;
}
.diagnose-table td:last-child {
    max-width: 520px;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 12px 0 30px rgba(16, 24, 32, .14);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 18px 14px 26px;
    }
    .content-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }
    .header-actions {
        width: 100%;
        justify-content: stretch;
    }
    .header-actions .btn,
    .header-actions .dropdown,
    .header-actions .dropdown .btn {
        width: 100%;
    }
    .login-shell {
        grid-template-columns: 1fr;
    }
    .login-brand-panel { min-height: auto; }
}

@media (max-width: 575.98px) {
    .panel { padding: 15px; }
    .metric-card {
        min-height: 108px;
        padding: 15px;
    }
    .metric-card .metric-value { font-size: 1.65rem; }
    .tracking-search {
        grid-template-columns: 1fr;
    }
    .tracking-search .btn { width: 100%; }
    .public-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
    .public-logo img { max-width: 190px; }
    .action-buttons .btn { width: 100%; }
    .login-stat-grid { grid-template-columns: 1fr; }
    .diagnose-head { grid-template-columns: 1fr; }
}

@media print {
    body {
        background: #fff !important;
        color: #000;
    }
    .sidebar,
    .mobile-topbar,
    .content-header .header-actions,
    .no-print,
    .dataTables_filter,
    .dataTables_length,
    .dataTables_paginate,
    .dt-buttons {
        display: none !important;
    }
    .main-content {
        margin: 0;
        max-width: none;
        padding: 0;
    }
    .panel,
    .detail-item {
        border-color: #ccc;
        box-shadow: none;
    }
    .logo-white { background: #fff !important; }
}
