:root {
    --brand-blue: #0B4F8C;
    --brand-black: #000000;
    --brand-header: #0B4F8C;
    --brand-dark: #0f172a;
    --brand-gray: #f1f5f9;
    --brand-white: #ffffff;
}

body {
    background-color: var(--brand-gray);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.bg-brand {
    background-color: var(--brand-header) !important;
}

/* App shell layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Mobile top bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background-color: var(--brand-header);
    border-bottom: 2px solid var(--brand-blue);
    z-index: 1050;
}

@media (max-width: 991.98px) {
    .app-shell {
        padding-top: 58px;
    }
}

.topbar-toggler {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.375rem;
    color: var(--brand-white);
    padding: 0.4rem 0.65rem;
    line-height: 1;
}

.topbar-toggler:hover,
.topbar-toggler:focus {
    border-color: rgba(255, 255, 255, 0.7);
    color: var(--brand-white);
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
}

/* Sidebar */
.sidebar {
    --bs-offcanvas-width: 210px;
    background-color: var(--brand-blue) !important;
    color: var(--brand-white);
    border-right: 2px solid var(--brand-blue);
    z-index: 1055;
    font-size: 0.875rem;
}

@media (min-width: 992px) {
    .sidebar {
        width: 210px;
        flex: 0 0 210px;
        position: sticky !important;
        top: 0;
        height: 100vh;
        visibility: visible !important;
        transform: none !important;
        border-right-width: 2px !important;
    }
}

.sidebar-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem 0.85rem;
    background-color: var(--brand-blue) !important;
    overflow-y: auto;
}

.sidebar .offcanvas-header {
    background-color: var(--brand-header);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0;
    padding: 0.6rem 0.5rem;
    padding-top: 0px;
    margin-bottom: 1.25rem;
}

.sidebar-brand-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-search-btn {
    background: transparent;
    border: none;
    color: var(--brand-white);
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.sidebar-search-btn:hover,
.sidebar-search-btn:focus {
    color: rgba(255, 255, 255, 0.75);
    outline: none;
}

.sidebar-logo {
    height: 40px;
    max-width: 130px;
    width: auto;
    object-fit: contain;
    display: block;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-subheading {
    padding: 0.4rem 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.55);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-icon {
    width: 1rem;
    font-size: 0.8rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover,
.sidebar-link:focus {
    background-color: rgba(11, 79, 140, 0.35);
    color: var(--brand-white);
}

.sidebar-link.active {
    background-color: var(--brand-blue);
    background-color: color-mix(in srgb, var(--brand-blue), var(--brand-white) 20%);
    color: var(--brand-white);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Buttons */
.btn-brand {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    color: var(--brand-white);
    font-weight: 600;
}

.btn-brand:hover,
.btn-brand:focus {
    background-color: #083d6f;
    border-color: #083d6f;
    color: var(--brand-white);
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-black) 100%);
}

.login-card {
    width: 100%;
    max-width: 360px;
    border-top: 4px solid var(--brand-blue);
    border-radius: 0.5rem;
}

.login-card .card-title {
    color: var(--brand-black);
    font-weight: 700;
}

.form-control:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.25rem rgba(11, 79, 140, 0.25);
}

/* Cards and tables */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table {
    background-color: var(--brand-white);
}

/* Upload previews */
.upload-preview {
    gap: 0.5rem;
}

.upload-preview img,
.photo-grid img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 0.375rem;
}

.upload-preview img {
    width: 100px;
    height: 100px;
}

/* Utilities */
.text-brand {
    color: var(--brand-blue) !important;
}

@media (min-width: 576px) {
    .login-card {
        max-width: 400px;
    }
}

/* Dashboard: 7-day performance stat card */
.stat-card {
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-blue), #0ea5e9);
}

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-black);
    margin-bottom: 0.15rem;
}

.stat-card-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0;
}

.stat-calls {
    text-align: right;
    line-height: 1;
}

.stat-calls-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--brand-blue);
    line-height: 1;
}

.stat-calls-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-top: 0.25rem;
}

.stat-rings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.stat-ring-card {
    flex: 1 1 200px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-radius: 0.6rem;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-ring-card:hover,
.stat-ring-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.1);
    color: inherit;
    text-decoration: none;
}

.stat-ring-card.stat-ring-good:hover { border-color: #0ea5e9; }
.stat-ring-card.stat-ring-bad:hover { border-color: #dc3545; }
.stat-ring-card.stat-ring-photos:hover { border-color: #0d6efd; }

.stat-ring-wrap {
    position: relative;
    width: 76px;
    height: 76px;
    flex-shrink: 0;
}

.stat-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.stat-ring-track {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 8;
}

.stat-ring-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}

.stat-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-ring-center i {
    font-size: 0.85rem;
    margin-bottom: 0.1rem;
}

.stat-ring-pct {
    font-size: 1rem;
    font-weight: 800;
    color: var(--brand-black);
}

.stat-ring-info {
    line-height: 1.2;
}

.stat-ring-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--brand-black);
}

.stat-ring-count {
    font-size: 0.78rem;
    color: #6c757d;
}

@media (max-width: 575.98px) {
    .stat-calls {
        text-align: left;
    }
}

/* Logos */
.logo {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

.login-logo {
    max-height: 64px;
    max-width: 220px;
}

/* Nav account search */
.topbar-search-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.375rem;
    color: var(--brand-white);
    padding: 0.4rem 0.65rem;
    line-height: 1;
    margin-left: auto;
}

.topbar-search-btn:hover,
.topbar-search-btn:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.7);
    color: var(--brand-white);
}

.nav-search-wrap {
    position: relative;
}

.nav-search-results {
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0.375rem;
}

.nav-search-results .list-group-item-action {
    cursor: pointer;
}

/* Feedback widget */
.feedback-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background-color: var(--brand-blue);
    color: var(--brand-white);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    z-index: 1040;
}

.feedback-fab:hover,
.feedback-fab:focus {
    background-color: #062a4d;
    color: var(--brand-white);
}

@media (max-width: 575.98px) {
    .feedback-fab {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
        right: 1rem;
        bottom: 1rem;
    }
}
