@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

@font-face {
    font-family: "APSDisplay";
    src: url("https://c-p.rmcdn1.net/custom-fonts/font-c2823911-022e-46f7-a5d1-48a0acd1b4bc.otf") format("opentype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "APSDisplay";
    src: url("https://c-p.rmcdn1.net/custom-fonts/font-96d869e1-e46a-4c91-86e1-807f14b4c93a.otf") format("opentype");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

:root {
    --aps-navy: #0c1a4f;
    --aps-navy-900: #071238;
    --aps-blue: #64c5fd;
    --aps-blue-600: #2b499b;
    --bg: #f3f6fb;
    --panel: #ffffff;
    --primary: var(--aps-navy);
    --secondary: #e7eef7;
    --text: #101827;
    --muted: #5f6b85;
    --shadow: 0 14px 40px rgba(12, 26, 79, 0.14);
    --radius-card: 16px;
    --radius-pill: 999px;
    --container-width: 1400px;
}

* {
    box-sizing: border-box;
}

h1,
h2,
h3,
.dashboard-title,
.dashboard-subtitle,
.brand-name {
    font-family: "APSDisplay", "Inter", sans-serif;
}

body {
    margin: 0;
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(180deg, #f6f9ff 0%, #eef3fb 45%, #f8fafc 100%);
    color: var(--text);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    gap: 20px;
    flex-wrap: wrap;
    margin: 16px auto 0;
    width: min(var(--container-width), calc(100% - 32px));
    background: linear-gradient(135deg, #2b499b 0%, #0c1a4f 70%, #09122f 100%);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow);
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.brand-logo {
    height: 32px;
    width: auto;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-family: "APSDisplay", "Inter", sans-serif;
    font-size: 18px;
    letter-spacing: 0.02em;
}

.brand-subtitle {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.7;
}

.nav {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    opacity: 0.8;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.nav a:hover {
    opacity: 1;
    color: var(--aps-blue);
}

.auth a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.2s ease, border 0.2s ease;
}

.auth a:hover,
.auth .logout-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.auth form {
    margin: 0;
}

.auth .logout-button {
    background: transparent;
    color: #fff;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.nav-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.nav-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 8px 10px;
    gap: 4px;
    flex-direction: column;
    cursor: pointer;
}

.nav-toggle span {
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 999px;
}

.page {
    padding: 24px;
    width: min(var(--container-width), calc(100% - 32px));
    margin: 16px auto 48px;
}

.panel {
    background: var(--panel);
    padding: 20px;
    border-radius: var(--radius-card);
    box-shadow: 0 10px 30px rgba(12, 26, 79, 0.08);
}

.card {
    background: var(--panel);
    padding: 16px;
    border-radius: var(--radius-card);
    border: 1px solid rgba(12, 26, 79, 0.08);
    box-shadow: 0 6px 20px rgba(12, 26, 79, 0.06);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    position: relative;
    z-index: 20;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    position: relative;
    z-index: 10;
}

.controls input,
.controls select {
    padding: 6px 10px;
    border: 1px solid rgba(12, 26, 79, 0.2);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
}

button,
.primary,
.secondary {
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button {
    background: var(--primary);
    color: #fff;
}

button:hover,
.primary:hover {
    box-shadow: 0 6px 16px rgba(12, 26, 79, 0.22);
    transform: translateY(-1px);
}

.primary {
    background: var(--primary);
    color: #fff;
}

.secondary {
    background: #fff;
    color: var(--aps-navy);
    border: 1px solid rgba(12, 26, 79, 0.25);
}

.map {
    height: 460px;
    border-radius: 8px;
    border: 1px solid rgba(12, 26, 79, 0.08);
    position: relative;
    z-index: 1;
}

.legend {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
}

.map-shell {
    position: relative;
    overflow: visible;
}

.map-legend {
    position: absolute;
    right: 16px;
    bottom: 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(12, 26, 79, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text);
    min-width: 220px;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.12);
    z-index: 1100;
}

.map-legend h4 {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.map-legend-item:last-child {
    margin-bottom: 0;
}

.legend-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
}

.legend-icon.blue {
    background: var(--aps-blue);
    color: var(--aps-navy);
}

.legend-icon.red {
    background: #ef4444;
}

.legend-icon.orange {
    background: #f59e0b;
}

.legend-icon.green {
    background: #2b499b;
}

.legend-icon.gray {
    background: #94a3b8;
}

.map-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.required {
    color: #ef4444;
}

.marker-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.marker-blue {
    background: var(--aps-blue);
}

.marker-red {
    background: #ef4444;
}

.marker-green {
    background: #2b499b;
}

.marker-orange {
    background: #f59e0b;
}

.marker-known {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--aps-blue-600);
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.search-field {
    position: relative;
    min-width: 220px;
    z-index: 30;
}

.search-field input {
    width: 100%;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8ee;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.15);
    max-height: 240px;
    overflow-y: auto;
    display: none;
    z-index: 1200;
}

.search-results.open {
    display: block;
}

.search-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eef2f6;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: #f8fafc;
}

.search-item-title {
    font-weight: 600;
    font-size: 13px;
}

.search-item-meta {
    font-size: 12px;
    color: var(--muted);
}

.form-card {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: var(--muted);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid rgba(12, 26, 79, 0.2);
    border-radius: 8px;
    font-size: 14px;
}

.form-group select {
    padding: 10px 12px;
    border: 1px solid rgba(12, 26, 79, 0.2);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--aps-blue-600);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.detail-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
}

.detail-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--muted);
}

.detail-actions {
    margin-left: auto;
}

.tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid #e2e8ee;
    margin-bottom: 16px;
}

.tab {
    background: none;
    border: none;
    padding: 10px 0;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}

.tab.active {
    color: var(--text);
    border-bottom: 2px solid var(--aps-blue);
}

.tab-section {
    display: none;
    gap: 16px;
    flex-direction: column;
}

.tab-section.active {
    display: flex;
}

.detail-grid-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.detail-list {
    display: grid;
    gap: 10px;
}

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.detail-list span {
    color: var(--muted);
}

.detail-list strong {
    font-weight: 600;
}

.mini-map {
    margin-top: 12px;
    height: 200px;
    border-radius: 10px;
    border: 1px solid #e2e8ee;
}

.detail-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-links a {
    color: var(--aps-blue-600);
    text-decoration: none;
    font-size: 13px;
}

.report-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.report-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--aps-blue) 0%, var(--aps-blue-600) 65%, var(--aps-navy) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 18px rgba(12, 26, 79, 0.2);
}

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

.report-summary {
    margin-bottom: 12px;
    font-size: 14px;
}

.report-chart {
    margin: 16px 0 24px;
}

.report-toolbar {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.icon-button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(12, 26, 79, 0.28);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(12, 26, 79, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-button svg {
    width: 22px;
    height: 22px;
    fill: var(--aps-navy);
}

.icon-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(12, 26, 79, 0.2);
}

.report-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    background: rgba(100, 197, 253, 0.22);
    color: var(--aps-navy);
    border: 1px solid rgba(12, 26, 79, 0.12);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-chip button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
}

.filter-panel {
    display: none;
    background: #f6f9ff;
    border: 1px solid rgba(12, 26, 79, 0.12);
    border-radius: 12px;
    padding: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-panel.open {
    display: flex;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

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

.filter-field input,
.filter-field select {
    padding: 8px 10px;
    border: 1px solid rgba(12, 26, 79, 0.2);
    border-radius: 8px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.form-group input:focus {
    outline: none;
    border-color: var(--aps-blue-600);
    box-shadow: 0 0 0 2px rgba(100, 197, 253, 0.25);
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-error {
    background: #fff1f2;
    color: #b42318;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
}

.form-error.show {
    display: block;
}

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8ee;
    text-align: left;
    font-size: 14px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.detail-card {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #eef2f6;
}

.form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.form input {
    padding: 8px 10px;
    border: 1px solid #d5dde6;
    border-radius: 6px;
}

.login {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: radial-gradient(circle at top, #2b499b 0%, #0c1a4f 45%, #070b19 100%);
}

.login-card {
    width: 360px;
    background: var(--panel);
    padding: 28px;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(7, 18, 56, 0.35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.brand-mark {
    background: var(--aps-navy);
    padding: 8px 10px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-mark img {
    height: 28px;
    display: block;
}

.login-links {
    margin-top: 14px;
    font-size: 12px;
}

.login-links a {
    color: var(--aps-blue-600);
    text-decoration: none;
}

.login-card label {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
}

.login-card input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d5dde6;
    border-radius: 6px;
}

.login-card button {
    width: 100%;
    margin-top: 16px;
}

.error {
    background: #ffefef;
    color: #b42318;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.subtle {
    color: var(--muted);
    font-size: 14px;
}

.print .page {
    padding: 12px;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--aps-navy);
}

.dashboard-subtitle {
    font-size: 20px;
    font-weight: 700;
    margin-top: 4px;
    color: var(--aps-navy);
}

.dashboard-meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-controls {
    display: flex;
    align-items: center;
}

.controls-row label {
    font-size: 13px;
    color: var(--muted);
}

.controls-row select {
    padding: 6px 10px;
    border: 1px solid rgba(12, 26, 79, 0.2);
    border-radius: 6px;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.kpi-card {
    display: flex;
    align-items: center;
    min-height: 72px;
}

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

.kpi-value {
    font-size: 24px;
    font-weight: 700;
}

.kpi-good {
    border-left: 6px solid #22c55e;
}

.kpi-warn {
    border-left: 6px solid #f59e0b;
}

.kpi-danger {
    border-left: 6px solid #ef4444;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.chart-card canvas {
    width: 100%;
    max-height: 260px;
}

.chart-wrap {
    position: relative;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-center {
    position: absolute;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
}

.card-footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
}

.report-link {
    color: var(--aps-blue-600);
    text-decoration: none;
    font-size: 12px;
}

.as-of {
    font-size: 12px;
    color: var(--muted);
}

.big-number {
    font-size: 36px;
    font-weight: 700;
    margin: 8px 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.stat-box {
    border: 1px solid #e2e8ee;
    border-radius: 10px;
    padding: 12px;
    min-height: 120px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-value {
    font-size: 34px;
    font-weight: 700;
    margin: 6px 0 8px;
}

.stat-danger {
    border-left: 6px solid #ef4444;
}

.stat-good {
    border-left: 6px solid #22c55e;
}

.collision-card {
    padding: 12px;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
}

.collision-count {
    font-size: 36px;
    font-weight: 700;
    color: #ef4444;
}

.collision-text {
    font-weight: 600;
    margin-top: 4px;
}

.collision-subtext {
    color: var(--muted);
    margin-top: 4px;
}

@media (max-width: 1200px) {
    .span-2,
    .span-3 {
        grid-column: span 1;
    }
}

@media (max-width: 980px) {
    .topbar {
        border-radius: 20px;
        padding: 12px 16px;
        align-items: flex-start;
    }

    .brand {
        flex: 1 1 auto;
        order: 1;
    }

    .brand-logo {
        height: 28px;
    }

    .brand-name {
        font-size: 16px;
    }

    .brand-subtitle {
        font-size: 10px;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
        order: 2;
    }

    .nav-wrap {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-top: 8px;
        background: rgba(7, 18, 56, 0.85);
        padding: 14px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        order: 3;
    }

    .topbar.open .nav-wrap {
        display: flex;
    }

    .nav {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .nav a {
        font-size: 12px;
    }

    .auth {
        width: 100%;
    }

    .auth a {
        width: 100%;
        text-align: center;
    }
}
