:root {
    --ge-primary: #142864;
    --ge-primary-dark: #0d1c47;
    --ge-secondary: #e96225;
    --ge-secondary-dark: #c94f18;
    --ge-text: #212529;
    --ge-bg: #f6f8fb;
    --ge-white: #ffffff;
    --ge-border: #dee2e6;
    --ge-muted: #6c757d;
    --ge-shadow: 0 8px 24px rgba(20, 40, 100, 0.08);
    --ge-radius: 14px;
}

html, body { min-height: 100%; }
body {
    background: var(--ge-bg);
    color: var(--ge-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--ge-primary); }
a:hover { color: var(--ge-secondary); }

.ge-app { background: var(--ge-bg); }
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--ge-primary), var(--ge-primary-dark));
    box-shadow: 8px 0 24px rgba(20, 40, 100, 0.12);
}
.sidebar-brand {
    color: var(--ge-white);
    font-weight: 800;
    letter-spacing: .01em;
}
.sidebar-brand span { color: var(--ge-secondary); }

.login-logo {
    width: 80%;
    height: auto;
    display: block;
    padding-left: 20%;
    padding-bottom: 5%;
}
.sidebar-logo {
    width: 70%;
    height: auto;
    display: block;
    padding-left: 10%;
    margin-bottom: 5%;
}
.sidebar .nav-link {
    border-radius: 12px;
    color: rgba(255,255,255,.76) !important;
    font-weight: 600;
    padding: .75rem .9rem;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}
.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: rgba(255,255,255,.12);
    color: var(--ge-white) !important;
    transform: translateX(2px);
}
.sidebar .nav-link.active { border-left: 4px solid var(--ge-secondary); }

.ge-header {
    background: var(--ge-white);
    border-bottom: 3px solid var(--ge-primary);
    box-shadow: 0 2px 14px rgba(20, 40, 100, 0.06);
}
.ge-header-title {
    color: var(--ge-primary);
    font-weight: 800;
}
main h1, main h2, main h3, main h4, main h5,
.h1, .h2, .h3, .h4, .h5 { color: var(--ge-primary); }
.text-muted { color: var(--ge-muted) !important; }

.card, .ge-card {
    background: var(--ge-white);
    border: 1px solid rgba(222, 226, 230, .9) !important;
    border-radius: var(--ge-radius) !important;
    box-shadow: var(--ge-shadow) !important;
}
.card-header { background: rgba(20, 40, 100, .04); border-bottom-color: var(--ge-border); }

.btn { border-radius: 10px; font-weight: 650; padding: .55rem 1rem; }
.btn-sm { border-radius: 8px; padding: .35rem .75rem; }
.btn-primary, .btn-ge-primary {
    --bs-btn-bg: var(--ge-primary);
    --bs-btn-border-color: var(--ge-primary);
    --bs-btn-hover-bg: var(--ge-primary-dark);
    --bs-btn-hover-border-color: var(--ge-primary-dark);
    --bs-btn-active-bg: var(--ge-primary-dark);
    --bs-btn-active-border-color: var(--ge-primary-dark);
    color: var(--ge-white);
}
.btn-outline-primary, .btn-ge-outline {
    --bs-btn-color: var(--ge-primary);
    --bs-btn-border-color: var(--ge-primary);
    --bs-btn-hover-bg: var(--ge-primary);
    --bs-btn-hover-border-color: var(--ge-primary);
    --bs-btn-hover-color: var(--ge-white);
}
.btn-ge-secondary, .btn-secondary {
    --bs-btn-bg: var(--ge-secondary);
    --bs-btn-border-color: var(--ge-secondary);
    --bs-btn-hover-bg: var(--ge-secondary-dark);
    --bs-btn-hover-border-color: var(--ge-secondary-dark);
    color: var(--ge-white);
}
.btn-ge-danger { --bs-btn-bg: #dc3545; --bs-btn-border-color: #dc3545; color: var(--ge-white); }
.btn:disabled { opacity: .55; }

.nav-tabs {
    border-bottom: 1px solid var(--ge-border);
    gap: .25rem;
}
.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: 12px 12px 0 0;
    color: var(--ge-primary);
    font-weight: 700;
    padding: .75rem 1.05rem;
}
.nav-tabs .nav-link:hover { border-color: rgba(233, 98, 37, .35); color: var(--ge-secondary); }
.nav-tabs .nav-link.active {
    background: var(--ge-primary);
    border-color: var(--ge-primary);
    color: var(--ge-white);
    box-shadow: 0 -2px 0 var(--ge-secondary) inset;
}
.tab-content {
    border-color: var(--ge-border) !important;
    border-radius: 0 0 var(--ge-radius) var(--ge-radius);
}

.progress { height: .85rem; border-radius: 99px; background: #e9edf5; }
.progress-bar { background-color: var(--ge-primary); border-radius: 99px; }

.badge { border-radius: 999px; padding: .45em .7em; font-weight: 700; }
.text-bg-primary { background-color: var(--ge-primary) !important; color: var(--ge-white) !important; }
.text-bg-warning { background-color: rgba(233, 98, 37, .14) !important; color: #a94212 !important; border: 1px solid rgba(233, 98, 37, .28); }
.text-bg-info { background-color: #dfe8ff !important; color: var(--ge-primary) !important; }
.text-bg-secondary { background-color: #edf0f5 !important; color: #4f5968 !important; }

.form-label { color: var(--ge-text); font-weight: 650; }
.form-control, .form-select {
    border-color: var(--ge-border);
    border-radius: 10px;
    padding: .65rem .8rem;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--ge-primary);
    box-shadow: 0 0 0 0.2rem rgba(20, 40, 100, 0.15);
}

.table { color: var(--ge-text); }
.table thead th {
    background: rgba(20, 40, 100, .06);
    color: var(--ge-primary);
    border-bottom-color: var(--ge-border);
    font-weight: 800;
}
.table tbody tr:hover { background: rgba(20, 40, 100, .025); }
.list-group-item { border-color: var(--ge-border); }

.alert-success { background: #eaf7ef; border-color: #bfe6cb; color: #146c43; }
.alert-danger { background: #fff0f1; border-color: #f2b7be; color: #a51d2d; }
.alert-warning { background: #fff6ef; border-color: rgba(233, 98, 37, .32); color: #8d380f; }
.alert-info { background: #eef4ff; border-color: #cad8f6; color: var(--ge-primary); }

.auth-bg {
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(233,98,37,.18), transparent 28%), linear-gradient(135deg, var(--ge-primary), #eef3f8 72%);
}

.modal-content { border: 0; border-radius: var(--ge-radius); box-shadow: 0 22px 60px rgba(20, 40, 100, .22); }
.modal-title { color: var(--ge-primary); font-weight: 800; }

@media (max-width: 992px) {
    .ge-shell { flex-direction: column; }
    .sidebar { width: 100%; min-height: auto !important; }
    .sidebar .nav { flex-direction: row !important; overflow-x: auto; }
    .sidebar .nav-link { white-space: nowrap; }
    main { padding: 1rem !important; }
}

.progress-bar-incomplete {
    background-color: #e96225 !important;
}

.progress-bar-complete {
    background-color: #198754 !important;
}

.table-responsive {
    overflow-x: auto;
}

.table th,
.crm-table th {
    white-space: nowrap;
    vertical-align: middle;
}

.table-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    text-decoration: none;
}

.commercial-onboarding {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(20, 40, 100, 0.08);
    padding: 24px;
    margin-bottom: 24px;
}

.commercial-onboarding-header,
.commercial-onboarding-compact,
.commercial-onboarding-actions,
.commercial-onboarding-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.commercial-onboarding-header,
.commercial-onboarding-compact {
    justify-content: space-between;
}

.commercial-onboarding-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.commercial-onboarding-kicker {
    color: var(--ge-secondary);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.commercial-onboarding-title {
    color: #142864;
    font-weight: 700;
}

.commercial-onboarding-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.commercial-onboarding-card {
    border: 1px solid #e9ecef;
    border-radius: 14px;
    padding: 16px;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.commercial-onboarding-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--ge-primary), var(--ge-secondary));
}

.commercial-onboarding-icon {
    align-items: center;
    background: rgba(20, 40, 100, .08);
    border-radius: 999px;
    color: var(--ge-primary);
    display: inline-flex;
    font-size: 1.35rem;
    height: 42px;
    justify-content: center;
    margin-bottom: 12px;
    width: 42px;
}

.commercial-onboarding-card h3 {
    color: #142864;
    font-size: 1rem;
    font-weight: 700;
}

.commercial-onboarding-card p {
    font-size: .94rem;
}

.commercial-onboarding-warning {
    color: #e96225;
    font-weight: 600;
    font-size: 0.9rem;
}

.commercial-onboarding-hide {
    color: var(--ge-muted);
    text-decoration: none;
}

.commercial-onboarding-hide:hover,
.commercial-onboarding-restore .btn-link:hover {
    color: var(--ge-secondary);
}

@media (max-width: 992px) {
    .commercial-onboarding-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .commercial-onboarding {
        padding: 18px;
    }

    .commercial-onboarding-header,
    .commercial-onboarding-actions,
    .commercial-onboarding-header-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .commercial-onboarding-grid {
        grid-template-columns: 1fr;
    }
}

.menu-notification-badge {
    background-color: #e96225;
    color: #ffffff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.acd-preview-table .address-cell {
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.documents-table .document-date-cell {
    font-size: 0.85rem;
    white-space: nowrap;
}

.quotation-sites-list,
.acd-sites-list {
    max-height: 45vh;
    overflow: auto;
}

.quotation-sites-selection-table thead th,
.acd-preview-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
}

#quotationRequestModal .modal-dialog,
#acdPreviewModal .modal-dialog {
    max-height: calc(100vh - 2rem);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#quotationRequestModal .modal-content,
#acdPreviewModal .modal-content {
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#quotationRequestModal .modal-content > form,
#acdPreviewModal .modal-content > form {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

#quotationRequestModal .modal-body,
#acdPreviewModal .modal-body {
    min-height: 0;
    overflow-y: auto;
    flex: 1 1 auto;
}

#quotationRequestModal .modal-header,
#quotationRequestModal .modal-footer,
#acdPreviewModal .modal-header,
#acdPreviewModal .modal-footer {
    flex: 0 0 auto;
}

#quotationRequestModal .modal-footer,
#acdPreviewModal .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: #ffffff;
    box-shadow: 0 -10px 24px rgba(20, 40, 100, .08);
}

@media (max-height: 700px) {
    #quotationRequestModal .modal-dialog,
    #acdPreviewModal .modal-dialog,
    #quotationRequestModal .modal-content,
    #acdPreviewModal .modal-content {
        max-height: calc(100vh - 1rem);
    }

    #quotationRequestModal .modal-dialog,
    #acdPreviewModal .modal-dialog {
        margin-top: .5rem;
        margin-bottom: .5rem;
    }
}
