:root {
    --app-primary: #415a77;
    --app-primary-dark: #1b263b;
    --app-primary-soft: #e0e1dd;
    --app-accent: #778da9;
    --app-bg: #e0e1dd;
    --app-surface: #f8f9f7;
    --app-text: #0d1b2a;
    --app-muted: #778da9;
    --app-border: #c8ced2;
    --app-sidebar: #1b263b;
    --app-sidebar-soft: #0d1b2a;
    --bs-primary: #415a77;
    --bs-primary-rgb: 65, 90, 119;
    --bs-body-color: #0d1b2a;
    --bs-body-bg: #e0e1dd;
    --bs-border-color: #c8ced2;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.95rem;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--app-primary);
}

a:hover {
    color: var(--app-primary-dark);
}

.sidebar {
    width: 264px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--app-sidebar-soft) 0%, var(--app-sidebar) 100%);
    border-right: 1px solid #415a77;
    box-shadow: 12px 0 34px rgba(13, 27, 42, 0.13);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1030;
}

.sidebar-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin: 4px 6px 30px;
}

.sidebar-brand-mark,
.login-brand-mark {
    align-items: center;
    background: #e0e1dd;
    border: 1px solid #778da9;
    border-radius: 13px;
    box-shadow: 0 9px 20px rgba(13, 27, 42, 0.24);
    color: #0d1b2a;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.sidebar-brand-title {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-brand-subtitle {
    color: #778da9;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-nav-label {
    color: #778da9;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    margin: 0 16px 10px;
    text-transform: uppercase;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar a {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #e0e1dd;
    display: flex;
    font-weight: 500;
    gap: 4px;
    padding: 10px 13px;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar a i {
    color: #778da9;
    font-size: 1rem;
    transition: color 160ms ease;
}

.sidebar a:hover {
    background: rgba(119, 141, 169, 0.17);
    border-color: rgba(119, 141, 169, 0.28);
    color: #ffffff;
    transform: translateX(2px);
}

.sidebar a.active {
    background: #415a77;
    border-color: #778da9;
    box-shadow: 0 8px 18px rgba(13, 27, 42, 0.22);
    color: #ffffff;
}

.sidebar a:hover i {
    color: #ffffff;
}

.sidebar a.active i {
    color: #e0e1dd;
}

.main {
    margin-left: 264px;
    min-height: 100vh;
}

.topbar {
    backdrop-filter: blur(12px);
    background: rgba(248, 249, 247, 0.94);
    border-bottom: 1px solid #c8ced2;
    height: 72px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-title {
    color: var(--app-text);
    display: block;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.topbar-eyebrow {
    color: #778da9;
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.user-chip {
    align-items: center;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--app-border);
    border-radius: 999px;
    color: #1b263b;
    display: flex;
    font-size: 0.82rem;
    font-weight: 600;
    gap: 8px;
    padding: 4px 12px 4px 5px;
}

.user-avatar {
    align-items: center;
    background: var(--app-primary-soft);
    border-radius: 50%;
    color: var(--app-primary);
    display: inline-flex;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.topbar-logout {
    border-color: var(--app-border);
    border-radius: 9px;
    color: #415a77;
    font-weight: 600;
}

.topbar-logout:hover {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.content {
    margin: 0 auto;
    max-width: 1680px;
    padding: 30px 32px 44px;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--app-text);
    letter-spacing: -0.015em;
}

.text-muted {
    color: var(--app-muted) !important;
}

.card {
    background: linear-gradient(180deg, #ffffff 0%, var(--app-surface) 100%);
    border: 1px solid var(--app-border) !important;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(13, 27, 42, 0.07) !important;
    overflow: hidden;
}

.card-body {
    padding: 1.3rem 1.4rem;
}

.btn {
    border-radius: 9px;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
}

.btn-sm {
    border-radius: 8px;
    padding: 0.34rem 0.65rem;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
    --bs-btn-active-bg: #0d1b2a;
    --bs-btn-active-border-color: #0d1b2a;
    box-shadow: 0 4px 11px rgba(27, 38, 59, 0.2);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-primary);
    --bs-btn-border-color: #778da9;
    --bs-btn-hover-bg: var(--app-primary-soft);
    --bs-btn-hover-border-color: #415a77;
    --bs-btn-hover-color: var(--app-primary-dark);
    --bs-btn-active-bg: var(--app-primary);
    --bs-btn-active-border-color: var(--app-primary);
}

.btn-light,
.btn-outline-secondary {
    --bs-btn-bg: #ffffff;
    --bs-btn-border-color: var(--app-border);
    --bs-btn-color: #475569;
    --bs-btn-hover-bg: #f8fafc;
    --bs-btn-hover-border-color: #cbd5e1;
    --bs-btn-hover-color: var(--app-text);
}

.form-label {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 650;
    margin-bottom: 0.42rem;
}

.form-control,
.form-select {
    background-color: #ffffff;
    border-color: #cbd5e1;
    border-radius: 10px;
    color: var(--app-text);
    min-height: 42px;
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus {
    border-color: #778da9;
    box-shadow: 0 0 0 0.22rem rgba(119, 141, 169, 0.18);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--app-text);
    --bs-table-hover-bg: #f0f2f1;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--app-border);
    padding: 0.78rem 0.8rem;
}

.table thead th {
    background: #e0e1dd;
    color: #1b263b;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table td.text-end,
.table td.fw-semibold {
    white-space: nowrap;
}

.invoice-list-table {
    min-width: 900px;
}

.invoice-list-table th,
.invoice-list-table td {
    white-space: nowrap;
}

.table-responsive {
    border: 1px solid var(--app-border);
    border-radius: 12px;
}

.nav-tabs {
    border-bottom: 1px solid var(--app-border);
    gap: 6px;
}

.nav-tabs .nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--app-muted);
    font-weight: 600;
    padding: 0.65rem 0.88rem;
}

.nav-tabs .nav-link:hover {
    background: #f0f2f1;
    color: var(--app-primary);
}

.nav-tabs .nav-link.active {
    background: var(--app-primary-soft);
    border-bottom-color: var(--app-primary);
    color: var(--app-primary);
}

.badge {
    border-radius: 999px;
    font-weight: 650;
    padding: 0.4em 0.65em;
}

.bg-primary {
    background-color: var(--app-primary) !important;
}

.alert {
    border: 1px solid transparent;
    border-radius: 12px;
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.04);
}

.alert-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #166534;
}

.alert-danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.login-page {
    background:
        radial-gradient(circle at 12% 12%, rgba(65, 90, 119, 0.2), transparent 30%),
        radial-gradient(circle at 86% 78%, rgba(119, 141, 169, 0.24), transparent 30%),
        var(--app-bg);
}

.login-card {
    border-radius: 20px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08) !important;
}

.login-brand-mark {
    font-size: 0.8rem;
    font-weight: 800;
    height: 48px;
    margin-bottom: 16px;
    width: 48px;
}

.dashboard-welcome {
    background:
        linear-gradient(120deg, rgba(65, 90, 119, 0.11), rgba(119, 141, 169, 0.05)),
        #ffffff;
    border: 1px solid #cfd7df;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(27, 38, 59, 0.05);
    padding: 22px 24px;
}

.dashboard-welcome h3 {
    color: #1b263b;
    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -0.025em;
}

.dashboard-kicker {
    color: #778da9;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.075em;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.dashboard-metric {
    background: #ffffff;
    border: 1px solid #d2d9e0;
    border-radius: 16px;
    box-shadow: 0 9px 25px rgba(27, 38, 59, 0.055);
    min-height: 176px;
    overflow: hidden;
    padding: 19px 20px 17px;
    position: relative;
}

.dashboard-metric::before {
    background: #415a77;
    content: "";
    height: 4px;
    inset: 0 0 auto;
    position: absolute;
}

.dashboard-metric::after {
    border-radius: 50%;
    content: "";
    height: 115px;
    opacity: 0.08;
    position: absolute;
    right: -38px;
    top: -42px;
    width: 115px;
}

.metric-collected {
    background: linear-gradient(150deg, #ffffff 55%, #f0f6f4);
}

.metric-collected::before,
.metric-collected::after {
    background: #3f7d68;
}

.metric-outstanding {
    background: linear-gradient(150deg, #ffffff 55%, #eef3f8);
}

.metric-outstanding::before,
.metric-outstanding::after {
    background: #415a77;
}

.metric-overdue {
    background: linear-gradient(150deg, #ffffff 55%, #fbf1ef);
}

.metric-overdue::before,
.metric-overdue::after {
    background: #a85d55;
}

.metric-uninvoiced {
    background: linear-gradient(150deg, #ffffff 55%, #f1f0f8);
}

.metric-uninvoiced::before,
.metric-uninvoiced::after {
    background: #6f668f;
}

.dashboard-metric-head {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.dashboard-metric-label {
    color: #334155;
    font-size: 0.79rem;
    font-weight: 720;
}

.dashboard-metric-period {
    color: #7b8798;
    font-size: 0.7rem;
    margin-top: 2px;
}

.dashboard-metric-icon {
    align-items: center;
    background: rgba(65, 90, 119, 0.09);
    border: 1px solid rgba(65, 90, 119, 0.12);
    border-radius: 10px;
    color: #415a77;
    display: inline-flex;
    font-size: 1rem;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.metric-collected .dashboard-metric-icon {
    background: rgba(63, 125, 104, 0.1);
    color: #2f6d59;
}

.metric-overdue .dashboard-metric-icon {
    background: rgba(168, 93, 85, 0.1);
    color: #934f48;
}

.metric-uninvoiced .dashboard-metric-icon {
    background: rgba(111, 102, 143, 0.1);
    color: #625981;
}

.dashboard-metric-values {
    color: #17243a;
    font-size: 1.46rem;
    font-weight: 780;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 19px 0 13px;
    position: relative;
    z-index: 1;
}

.dashboard-metric-values > div + div {
    font-size: 1.02rem;
    margin-top: 4px;
}

.dashboard-metric-foot {
    color: #6b7788;
    font-size: 0.72rem;
    position: relative;
    z-index: 1;
}

.dashboard-stat {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d2d9e0;
    border-radius: 14px;
    color: #1b263b;
    display: flex;
    gap: 12px;
    min-height: 78px;
    padding: 14px 15px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

a.dashboard-stat:hover {
    border-color: #9eafbf;
    box-shadow: 0 8px 22px rgba(27, 38, 59, 0.08);
    color: #1b263b;
    transform: translateY(-1px);
}

.dashboard-stat-icon {
    align-items: center;
    background: #e9eef3;
    border-radius: 11px;
    color: #415a77;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.05rem;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.dashboard-stat strong,
.dashboard-stat small {
    display: block;
}

.dashboard-stat strong {
    font-size: 1.15rem;
    line-height: 1.1;
}

.dashboard-stat small {
    color: #718096;
    font-size: 0.69rem;
    margin-top: 3px;
}

.dashboard-stat-arrow {
    color: #9aa8b7;
    margin-left: auto;
}

.dashboard-panel {
    border-radius: 16px;
    overflow: hidden;
}

.dashboard-panel-head {
    align-items: center;
    border-bottom: 1px solid #dbe1e7;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    min-height: 78px;
    padding: 18px 20px;
}

.dashboard-panel-head h5 {
    color: #1b263b;
    font-size: 0.96rem;
    font-weight: 730;
}

.dashboard-list-row {
    align-items: center;
    border-bottom: 1px solid #e2e7ec;
    color: #1b263b;
    display: flex;
    gap: 15px;
    min-height: 72px;
    padding: 14px 20px;
    text-decoration: none;
    transition: background 0.16s ease;
}

.dashboard-list-row:last-child {
    border-bottom: 0;
}

.dashboard-list-row:hover {
    background: #f5f7f8;
    color: #1b263b;
}

.dashboard-list-main {
    min-width: 0;
}

.dashboard-list-main strong,
.dashboard-list-main small,
.dashboard-list-value strong,
.dashboard-list-value small {
    display: block;
}

.dashboard-list-main strong {
    font-size: 0.86rem;
}

.dashboard-list-main small,
.dashboard-list-value small {
    color: #748092;
    font-size: 0.69rem;
}

.dashboard-list-value {
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

.dashboard-list-value strong {
    font-size: 0.86rem;
}

.dashboard-list-row > .bi-chevron-right {
    color: #a4afbb;
    font-size: 0.72rem;
}

.dashboard-list-scroll {
    max-height: 432px;
    overflow-y: auto;
}

.dashboard-empty {
    align-items: center;
    color: #697789;
    display: flex;
    flex-direction: column;
    min-height: 255px;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.dashboard-empty span {
    align-items: center;
    background: #eaf1ee;
    border-radius: 50%;
    color: #3f7d68;
    display: inline-flex;
    font-size: 1.25rem;
    height: 48px;
    justify-content: center;
    margin-bottom: 12px;
    width: 48px;
}

.dashboard-empty strong {
    color: #334155;
    font-size: 0.88rem;
}

.dashboard-empty small {
    margin-top: 3px;
}

.dashboard-empty-compact {
    min-height: 150px;
}

.quick-task-modal .modal-dialog {
    max-width: 760px;
}

.quick-task-modal .modal-content {
    border: 1px solid #b9c4cf;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(13, 27, 42, 0.24);
    overflow: hidden;
}

.quick-task-modal .modal-header {
    align-items: flex-start;
    background:
        linear-gradient(120deg, rgba(65, 90, 119, 0.12), rgba(119, 141, 169, 0.04)),
        #ffffff;
    border-bottom: 1px solid #d6dde4;
    padding: 22px 24px;
}

.quick-task-modal .modal-title {
    color: var(--app-primary-dark);
    font-size: 1.35rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.quick-task-modal .modal-kicker {
    color: var(--app-accent);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.quick-task-modal .modal-body {
    padding: 24px;
}

.quick-task-modal .modal-footer {
    background: #f5f7f8;
    border-top: 1px solid #d6dde4;
    gap: 8px;
    padding: 16px 24px;
}

.quick-project-picker {
    position: relative;
}

.quick-project-search {
    position: relative;
}

.quick-project-search > i {
    color: #778da9;
    left: 15px;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.quick-project-search .form-control {
    padding-left: 42px;
}

.quick-project-results {
    background: #ffffff;
    border: 1px solid #c8d1da;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(13, 27, 42, 0.1);
    margin-top: 8px;
    max-height: 275px;
    overflow-y: auto;
    padding: 6px;
}

.quick-project-results.is-collapsed {
    display: none;
}

.quick-project-option {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: var(--app-text);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 11px 12px;
    text-align: left;
    width: 100%;
}

.quick-project-option[hidden] {
    display: none !important;
}

.quick-project-option:hover,
.quick-project-option:focus,
.quick-project-option.is-selected {
    background: #edf1f5;
    outline: none;
}

.quick-project-option.is-selected {
    box-shadow: inset 3px 0 0 var(--app-primary);
}

.quick-project-option-main {
    min-width: 0;
}

.quick-project-option-main strong,
.quick-project-option-main small {
    display: block;
}

.quick-project-option-main strong {
    font-size: 0.9rem;
}

.quick-project-option-main small {
    color: #718096;
    font-size: 0.74rem;
    margin-top: 2px;
}

.quick-project-option-meta {
    align-items: flex-end;
    color: #66758a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    font-size: 0.72rem;
    gap: 3px;
}

.quick-project-recent {
    background: #dfe8f0;
    border-radius: 999px;
    color: #415a77;
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    text-transform: uppercase;
}

.quick-project-picker-foot {
    color: #7b8796;
    display: flex;
    font-size: 0.68rem;
    justify-content: space-between;
    margin-top: 7px;
}

.quick-project-selected {
    align-items: center;
    background: #edf2f6;
    border: 1px solid #c7d2dd;
    border-radius: 12px;
    display: flex;
    gap: 11px;
    margin-top: 10px;
    padding: 10px 12px;
}

.quick-project-selected-icon {
    align-items: center;
    background: var(--app-primary);
    border-radius: 50%;
    color: #ffffff;
    display: inline-flex;
    flex-shrink: 0;
    height: 30px;
    justify-content: center;
    width: 30px;
}

.quick-project-selected strong,
.quick-project-selected small {
    display: block;
}

.quick-project-selected strong {
    font-size: 0.86rem;
}

.quick-project-selected small {
    color: #66758a;
    font-size: 0.72rem;
}

.quick-task-billable {
    background: #f5f7f8;
    border: 1px solid #d8dfe5;
    border-radius: 11px;
    margin-top: 18px;
    padding: 12px 14px 12px 40px;
}

.quick-task-billable .form-check-input {
    margin-left: -25px;
}

.quick-task-billable label {
    font-weight: 650;
}

.quick-task-billable label small {
    color: #718096;
    display: block;
    font-size: 0.71rem;
    font-weight: 400;
}

.quick-task-empty {
    align-items: center;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    justify-content: center;
    padding: 28px;
    text-align: center;
}

.quick-task-empty > span {
    align-items: center;
    background: #e5ebf0;
    border-radius: 50%;
    color: #415a77;
    display: inline-flex;
    font-size: 1.3rem;
    height: 54px;
    justify-content: center;
    margin-bottom: 14px;
    width: 54px;
}

.quick-task-empty h5 {
    color: var(--app-primary-dark);
    font-weight: 720;
}

.quick-task-empty p {
    color: #718096;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .sidebar {
        min-height: auto;
        padding-bottom: 12px !important;
        position: relative;
        width: 100%;
    }

    .sidebar-brand {
        margin-bottom: 16px;
    }

    .sidebar-nav-label {
        display: none;
    }

    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .sidebar a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .main {
        margin-left: 0;
    }

    .content {
        padding: 22px 18px 36px;
    }
}

@media (max-width: 575px) {
    .topbar {
        height: auto;
        min-height: 68px;
        padding: 10px 16px !important;
    }

    .user-chip span:last-child,
    .topbar-logout span {
        display: none;
    }

    .content {
        padding-left: 14px;
        padding-right: 14px;
    }

    .dashboard-welcome {
        padding: 19px;
    }

    .dashboard-welcome .btn {
        flex: 1 1 auto;
    }

    .dashboard-metric {
        min-height: 165px;
    }

    .dashboard-stat {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        min-height: 112px;
    }

    .dashboard-stat-arrow {
        display: none;
    }

    .dashboard-panel-head {
        align-items: flex-start;
    }

    .dashboard-list-row {
        flex-wrap: wrap;
    }

    .dashboard-list-value {
        margin-left: 0;
        text-align: left;
    }

    .dashboard-list-row > .bi-chevron-right {
        margin-left: auto;
    }

    .quick-task-modal .modal-header,
    .quick-task-modal .modal-body,
    .quick-task-modal .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .quick-task-modal .modal-footer .btn {
        flex: 1 1 100%;
    }

    .quick-project-picker-foot {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .quick-project-option {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .quick-project-option-meta {
        align-items: center;
        flex-direction: row;
    }
}
