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

:root {
    --primary-blue: #1264d8;
    --primary-dark: #0b3f8a;
    --accent-teal: #0f766e;
    --accent-orange: #d97706;
    --accent-rose: #dc2626;
    --surface-light: #ffffff;
    --background-gray: #f5f7fb;
    --text-main: #223044;
    --text-muted: #667085;
    --border-soft: #dfe5ee;
    --sidebar-bg: #0f315f;
    --sidebar-bg-2: #123f73;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    overflow-x: hidden;
    background: var(--background-gray);
    color: var(--text-main);
}

.portal-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    background: var(--background-gray);
}

.portal-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    flex: 0 0 248px;
    width: 248px;
    height: 100vh;
    padding: 18px 14px;
    overflow-y: auto;
    color: #fff;
    background: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg));
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.12);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px 8px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-brand-icon,
.sidebar-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 1.25rem;
}

.sidebar-brand-title,
.sidebar-brand-subtitle,
.sidebar-user-toggle small {
    display: block;
}

.sidebar-brand-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.1;
}

.sidebar-brand-subtitle,
.sidebar-user-toggle small {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.74rem;
    font-weight: 600;
}

.sidebar-nav {
    gap: 6px;
    margin-top: 12px;
    margin-bottom: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0.7rem 0.85rem !important;
    color: rgba(255, 255, 255, 0.82) !important;
    border-radius: 8px;
    font-weight: 700;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.portal-sidebar .nav-link:hover,
.portal-sidebar .nav-link.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.14) !important;
}

.portal-sidebar .nav-link.active {
    box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.9);
}

.sidebar-user {
    padding-top: 14px;
    margin-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border-radius: 8px;
}

.sidebar-user-toggle:hover {
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.portal-content {
    flex: 1 1 auto;
    min-width: 0;
    height: 100vh;
    padding: 24px 28px 36px;
    overflow-x: hidden;
    overflow-y: auto;
}

#main-content {
    width: 100%;
    max-width: 100%;
}

.portal-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.portal-page-head h2,
.portal-page-head h4 {
    margin: 0;
}

.portal-page-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
}

.card {
    border: 1px solid var(--border-soft) !important;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06) !important;
}

.card-header {
    border-radius: 8px 8px 0 0 !important;
}

.dashboard-kpi {
    min-height: 132px;
}

.dashboard-kpi .card-body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.dashboard-kpi .kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 8px;
    color: var(--primary-blue);
    background: rgba(18, 100, 216, 0.11);
    font-size: 1.35rem;
}

.dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.notification-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--primary-dark);
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.notification-dot {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 9px;
    height: 9px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent-rose);
}

.metric-card {
    min-height: 118px;
}

.metric-card .card-body {
    display: flex;
    align-items: center;
    gap: 14px;
}

.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 8px;
    font-size: 1.35rem;
}

.metric-label {
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-value {
    color: var(--text-main);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.metric-primary .metric-icon {
    color: var(--primary-blue);
    background: rgba(18, 100, 216, 0.11);
}

.metric-success .metric-icon {
    color: #047857;
    background: rgba(4, 120, 87, 0.10);
}

.metric-warning .metric-icon {
    color: #b45309;
    background: rgba(217, 119, 6, 0.12);
}

.metric-info .metric-icon {
    color: #0369a1;
    background: rgba(3, 105, 161, 0.10);
}

.mission-status-list {
    display: grid;
    gap: 1rem;
}

.mission-status-row span {
    color: var(--text-muted);
    font-weight: 800;
}

.mission-status-progress {
    height: 0.5rem;
    background: #e5eaf2;
}

.progress-ok {
    background: #047857;
}

.progress-warn {
    background: var(--accent-orange);
}

.progress-muted {
    background: var(--primary-blue);
}

#surveyMap {
    min-height: 420px;
    border-radius: 0 0 8px 8px;
}

.completed-survey-map {
    width: 100%;
    height: 560px;
    border-radius: 8px;
}

.table-card .card-body {
    padding: 0;
}

.table-responsive {
    width: 100%;
}

.modern-table,
.modern-grid {
    width: 100%;
    margin: 0;
}

.modern-table th,
.modern-grid th {
    padding: 0.9rem 1rem;
    color: #475569;
    background-color: #f8fafc !important;
    border-bottom: 1px solid var(--border-soft) !important;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.modern-table td,
.modern-grid td {
    padding: 0.9rem 1rem;
    color: #334155;
    border-bottom: 1px solid #edf1f7;
    font-size: 0.94rem;
    vertical-align: middle;
}

.modern-table tbody tr:hover,
.modern-grid tbody tr:hover {
    background: #f8fafc;
}

.status-pill,
.soft-badge,
.entry-chip,
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.24rem 0.58rem;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.soft-badge {
    color: var(--primary-dark);
    background: rgba(18, 100, 216, 0.10);
}

.entry-chip {
    color: var(--accent-teal);
    background: rgba(15, 118, 110, 0.10);
}

.status-pill.ok {
    color: #047857;
    background: rgba(4, 120, 87, 0.10);
}

.status-pill.warn {
    color: #b45309;
    background: rgba(217, 119, 6, 0.12);
}

.status-pill.muted {
    color: #64748b;
    background: rgba(100, 116, 139, 0.12);
}

.status-pill.danger {
    color: var(--accent-rose);
    background: rgba(220, 38, 38, 0.10);
}

.survey-control-panel,
.section-summary,
.section-band {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.survey-control-panel {
    padding: 1rem;
}

.form-select-premium {
    min-height: 50px;
    padding: 0.72rem 1rem;
    border: 1px solid #cfd7e3;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.form-select-premium:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(18, 100, 216, 0.14);
}

.survey-stat-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.52rem 0.75rem;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--text-main);
    background: #f8fafc;
}

.stat-pill i {
    color: var(--primary-blue);
}

.stat-pill span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-pill strong {
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.section-summary {
    display: flex;
    min-height: 100%;
    gap: 1rem;
    padding: 1rem;
}

.section-summary-icon,
.survey-row-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
}

.section-summary-icon {
    width: 48px;
    height: 48px;
    font-size: 1.45rem;
}

.section-feasibility .section-summary-icon,
.section-feasibility.survey-row-icon {
    color: var(--primary-dark);
    background: rgba(18, 100, 216, 0.12);
}

.section-hoto .section-summary-icon,
.section-hoto.survey-row-icon {
    color: var(--accent-orange);
    background: rgba(217, 119, 6, 0.13);
}

.section-percent {
    color: var(--primary-dark);
    font-size: 1.3rem;
}

.section-progress {
    height: 0.45rem;
    background-color: #e2e8f0;
}

.section-progress .progress-bar {
    background: var(--primary-blue);
}

.section-summary-meta {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.section-summary-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.section-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0 0.75rem;
    padding: 1rem 1.1rem;
}

.section-band p {
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.section-band-count {
    white-space: nowrap;
    border-radius: 8px;
    padding: 0.48rem 0.72rem;
    color: #fff;
    font-weight: 800;
    background: var(--primary-blue);
}

.section-band.section-hoto .section-band-count {
    background: var(--accent-orange);
}

.premium-accordion .accordion-item {
    margin-bottom: 1rem;
    border: none;
    background: transparent;
}

.premium-accordion .accordion-header {
    overflow: hidden;
    border-radius: 8px !important;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.premium-accordion .accordion-button {
    padding: 0.95rem 1rem;
    color: var(--text-main);
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 8px !important;
    box-shadow: none !important;
    font-size: 1rem;
    font-weight: 700;
}

.premium-accordion .accordion-button:not(.collapsed) {
    color: var(--primary-dark);
    background: #f8fbff;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.premium-accordion .accordion-body {
    padding: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.premium-accordion .badge-counter {
    color: #fff;
    background: var(--primary-blue);
}

.survey-row-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    margin-right: 1rem;
}

.survey-row-title small {
    color: var(--text-muted);
    font-weight: 600;
}

.survey-row-icon {
    width: 38px;
    height: 38px;
}

.survey-table-wrap {
    max-height: 54vh;
    overflow: auto;
}

.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-width: 92px;
    border: 1px solid rgba(18, 100, 216, 0.28);
    border-radius: 8px;
    color: var(--primary-blue);
    background: #fff;
    font-weight: 800;
}

.btn-modern:hover {
    color: #fff;
    background: var(--primary-blue);
}

.chip-list,
.checklist-stack {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.chip-list span,
.hoto-route-chip,
.checklist-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    color: #1e3a8a;
    background: #f8fbff;
    font-size: 0.78rem;
    font-weight: 800;
}

.hoto-route-panel,
.checklist-panel {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border-soft);
    background: #f8fafc;
}

.hoto-route-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hoto-route-chip.ok,
.checklist-chip.ok {
    color: #047857;
    border-color: rgba(4, 120, 87, 0.22);
    background: rgba(4, 120, 87, 0.08);
}

.hoto-route-chip.danger,
.checklist-chip.danger {
    color: var(--accent-rose);
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.08);
}

.checklist-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 86px;
    height: 86px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    font-size: 2.4rem;
}

.empty-state-icon.muted {
    color: #94a3b8;
}

.empty-state-icon.danger {
    color: var(--accent-rose);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in-scale {
    animation: fadeInScale 0.28s ease-out forwards;
}

@media (max-width: 991px) {
    .portal-sidebar {
        flex-basis: 220px;
        width: 220px;
    }

    .portal-content {
        padding: 20px;
    }

    .survey-stat-row {
        justify-content: flex-start;
    }

    .checklist-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .portal-shell {
        flex-direction: column;
        overflow: visible;
    }

    .portal-sidebar {
        position: relative;
        flex-basis: auto;
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 12px;
    }

    .sidebar-brand {
        padding-bottom: 12px;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 6px;
    }

    .sidebar-user {
        margin-top: 10px;
    }

    .portal-content {
        height: auto;
        min-height: calc(100vh - 220px);
        padding: 16px;
        overflow: visible;
    }

    .portal-page-head,
    .section-band {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-kpi .card-body,
    .section-summary {
        flex-direction: column;
    }

    #surveyMap {
        min-height: 340px;
    }
}
