:root {
    --brand-ice-100: #cae5f6;
    --brand-blue-600: #296cbf;
    --brand-blue-700: #123e9a;
    --brand-blue-800: #0a2a85;

    --text: #111827;
    --muted: #4b5563;
    --border: #e5e7eb;
    --bg: #ffffff;

    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    --bs-primary: var(--brand-blue-700);
    --bs-primary-rgb: 18, 62, 154;
    --bs-secondary-color: var(--muted);
    --bs-link-color: var(--brand-blue-600);
    --bs-link-hover-color: var(--brand-blue-700);
    --bs-border-color: var(--border);
    --bs-body-font-family: var(--font);
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 24px;
    color: var(--text);
    background:
        radial-gradient(1100px 380px at 10% -5%, #e8f3fb 0%, rgba(232, 243, 251, 0) 75%),
        linear-gradient(180deg, #fdfefe 0%, var(--bg) 100%);
}

h1,
.h1 {
    font-size: 40px;
    line-height: 48px;
    font-weight: 600;
    color: var(--brand-blue-800);
}

h2,
.h2 {
    font-size: 28px;
    line-height: 36px;
    font-weight: 600;
    color: var(--brand-blue-800);
}

h3,
.h3 {
    font-size: 22px;
    line-height: 30px;
    font-weight: 600;
    color: var(--brand-blue-700);
}

.small {
    font-size: 14px;
    line-height: 20px;
}

.caption {
    font-size: 12px;
    line-height: 16px;
    color: var(--muted);
}

a {
    color: var(--brand-blue-600);
}

a:hover {
    color: var(--brand-blue-700);
}

.navbar {
    border-bottom: 1px solid var(--border);
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--brand-blue-800);
    display: inline-flex;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
}

.navbar-logo {
    display: block;
    height: 50px !important;
    max-height: 50px !important;
    width: auto !important;
    max-width: 180px !important;
    object-fit: contain;
}

.nav-link {
    color: var(--muted);
    font-weight: 500;
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
    color: var(--brand-blue-700);
}

.card {
    border: 1px solid var(--border);
    box-shadow: 0 16px 36px rgba(10, 42, 133, 0.08);
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    color: var(--brand-blue-800);
    font-weight: 600;
    border-bottom-width: 1px;
}

.btn-primary {
    --bs-btn-bg: var(--brand-blue-700);
    --bs-btn-border-color: var(--brand-blue-700);
    --bs-btn-hover-bg: var(--brand-blue-600);
    --bs-btn-hover-border-color: var(--brand-blue-600);
    --bs-btn-active-bg: var(--brand-blue-800);
    --bs-btn-active-border-color: var(--brand-blue-800);
    --bs-btn-focus-shadow-rgb: 41, 108, 191;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-blue-700);
    --bs-btn-border-color: var(--brand-blue-700);
    --bs-btn-hover-bg: var(--brand-blue-700);
    --bs-btn-hover-border-color: var(--brand-blue-700);
    --bs-btn-active-bg: var(--brand-blue-800);
    --bs-btn-active-border-color: var(--brand-blue-800);
    --bs-btn-focus-shadow-rgb: 41, 108, 191;
}

.btn-outline-secondary {
    --bs-btn-color: var(--muted);
    --bs-btn-border-color: #c7cfda;
    --bs-btn-hover-bg: #eff3f9;
    --bs-btn-hover-border-color: #b5c4d8;
    --bs-btn-hover-color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-blue-600);
    box-shadow: 0 0 0 0.25rem rgba(41, 108, 191, 0.25);
}

.alert-info {
    --bs-alert-bg: var(--brand-ice-100);
    --bs-alert-border-color: #9bc8e8;
    --bs-alert-color: var(--brand-blue-800);
}

.badge.bg-primary {
    background-color: var(--brand-blue-700) !important;
}

.surface-highlight {
    background: var(--brand-ice-100);
    border: 1px solid #9bc8e8;
    color: var(--brand-blue-800);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 1.8rem;
    line-height: 2.15rem;
    font-weight: 600;
    color: var(--brand-blue-800);
}

.card {
    border-radius: 0.75rem;
}

.card.p-4,
.card.p-3 {
    background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--border);
}

.table tbody tr:hover {
    background: #f7fbff;
}

.table tfoot th,
.table tfoot td {
    color: var(--brand-blue-800);
}

.money-amount {
    min-width: 130px;
    white-space: nowrap;
}

.invoice-lines-table {
    table-layout: fixed;
    width: 100%;
}

.invoice-lines-table .invoice-line-desc {
    width: 35%;
    max-width: 35%;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.92rem;
}

.badge.text-bg-success {
    background-color: #0f766e !important;
}

.badge.text-bg-danger {
    background-color: #b91c1c !important;
}

.btn-warning {
    --bs-btn-bg: #f59e0b;
    --bs-btn-border-color: #f59e0b;
    --bs-btn-hover-bg: #d97706;
    --bs-btn-hover-border-color: #d97706;
    --bs-btn-color: #111827;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-icon i {
    font-size: 1rem;
    line-height: 1;
}

.pagination {
    --bs-pagination-color: var(--brand-blue-700);
    --bs-pagination-bg: #ffffff;
    --bs-pagination-border-color: var(--border);
    --bs-pagination-hover-color: var(--brand-blue-800);
    --bs-pagination-hover-bg: #eff5fd;
    --bs-pagination-hover-border-color: #bfd7f0;
    --bs-pagination-active-bg: var(--brand-blue-700);
    --bs-pagination-active-border-color: var(--brand-blue-700);
    --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(41, 108, 191, 0.2);
}

.wysiwyg {
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: #fff;
}

.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.wysiwyg-editor {
    min-height: 220px;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    overflow: auto;
}

.wysiwyg-editor:focus {
    box-shadow: none !important;
}

.wysiwyg-editor p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .navbar .navbar-collapse {
        border-top: 1px solid var(--border);
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }

    .navbar .navbar-nav .nav-link {
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }

    .page-title {
        font-size: 1.45rem;
        line-height: 1.9rem;
    }

    .table-responsive .btn {
        white-space: nowrap;
    }

    .navbar .container {
        gap: 0.5rem;
    }

    .wysiwyg-toolbar .btn {
        flex: 1 1 auto;
    }
}
