body {
    font-family: "Segoe UI", Arial, sans-serif;
}

:root {
    --jw-green: #13855c;
    --jw-green-dark: #0f6848;
    --jw-green-soft: rgba(19, 133, 92, .12);
}

.bg-gradient-primary {
    background-color: var(--jw-green) !important;
    background-image: linear-gradient(180deg, #1cc88a 10%, var(--jw-green) 100%) !important;
}

.btn-primary {
    background-color: var(--jw-green);
    border-color: var(--jw-green);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--jw-green-dark);
    border-color: var(--jw-green-dark);
}

.btn-outline-primary {
    border-color: var(--jw-green);
    color: var(--jw-green);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--jw-green);
    border-color: var(--jw-green);
    color: #fff;
}

.text-primary,
.panel-title {
    color: var(--jw-green) !important;
}

.form-control:focus {
    border-color: #1cc88a;
    box-shadow: 0 0 0 .2rem rgba(28, 200, 138, .25);
}

.sidebar .nav-item.active .nav-link,
.sidebar .nav-item .nav-link:hover {
    color: #fff;
}

body.portal-dark {
    background: #111827;
    color: #d7dee9;
}

body.portal-dark #content-wrapper,
body.portal-dark #content,
body.portal-dark .container-fluid {
    background: #111827;
}

body.portal-dark .bg-white,
body.portal-dark .panel,
body.portal-dark .metric-card,
body.portal-dark .topbar,
body.portal-dark footer {
    background: #1f2937 !important;
    color: #d7dee9;
}

body.portal-dark .text-gray-800,
body.portal-dark .text-gray-700,
body.portal-dark .metric-card .value {
    color: #f3f6fb !important;
}

body.portal-dark .text-muted,
body.portal-dark .metric-card .label,
body.portal-dark .data-table th,
body.portal-dark .data-table td {
    color: #aeb8c7 !important;
}

body.portal-dark .data-table th {
    background: #111827;
}

body.portal-dark .form-control,
body.portal-dark .custom-select {
    background: #111827;
    border-color: #374151;
    color: #f3f6fb;
}

body.portal-dark .billing-amount,
body.portal-dark .billing-ref-code,
body.portal-dark .billing-meta-grid strong,
body.portal-dark .billing-plan-list strong,
body.portal-dark .invoice-arrangement strong,
body.portal-dark .invoice-detail-title,
body.portal-dark .invoice-total-row strong {
    color: #f3f6fb;
}

body.portal-dark .billing-subline,
body.portal-dark .billing-kicker,
body.portal-dark .billing-meta-grid span,
body.portal-dark .billing-plan-list span,
body.portal-dark .invoice-arrangement span,
body.portal-dark .invoice-total-row span {
    color: #aeb8c7;
}

body.portal-dark .billing-actions {
    background: #111827;
    border-top-color: #374151;
}

body.portal-dark .billing-meta-grid,
body.portal-dark .billing-meta-grid div {
    border-color: #374151;
}

.portal-login-screen {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(19, 133, 92, .96), rgba(28, 200, 138, .82)),
        url("assets/img/undraw_posting_photo.svg") center bottom / 520px auto no-repeat;
    display: flex;
    min-height: 100vh;
    padding: 2rem;
}

.portal-login-card {
    background: #fff;
    border-radius: .5rem;
    box-shadow: 0 1.25rem 3rem rgba(20, 31, 55, .28);
    margin: 0 auto;
    max-width: 440px;
    padding: 2rem;
    width: 100%;
}

.portal-login-brand {
    align-items: center;
    display: flex;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.portal-login-brand .brand-mark {
    align-items: center;
    background: var(--jw-green);
    border-radius: .45rem;
    color: #fff;
    display: flex;
    flex: 0 0 3rem;
    font-size: 1.25rem;
    height: 3rem;
    justify-content: center;
}

.portal-login-brand h1 {
    color: #2f3545;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0;
}

.portal-login-brand p,
.portal-login-form label {
    color: #858796;
}

.portal-login-form label {
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.account-picker {
    min-width: 220px;
}

.alert-host {
    position: fixed;
    right: 1rem;
    top: 5rem;
    width: min(420px, calc(100vw - 2rem));
    z-index: 1080;
}

.alert-host .alert {
    box-shadow: 0 .5rem 1.25rem rgba(30, 45, 70, .18);
}

.ops-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ops-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-card {
    background: #fff;
    border-left: .25rem solid var(--jw-green);
    border-radius: .35rem;
    box-shadow: 0 .15rem 1.75rem rgba(58, 59, 69, .12);
    padding: 1rem;
}

.metric-card.success {
    border-left-color: #1cc88a;
}

.metric-card.warning {
    border-left-color: #f6c23e;
}

.metric-card.danger {
    border-left-color: #e74a3b;
}

.metric-card .label {
    color: #5a5c69;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.metric-card .value {
    color: #2f3545;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
}

.panel {
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: .35rem;
    box-shadow: 0 .15rem 1.75rem rgba(58, 59, 69, .08);
    margin-bottom: 1rem;
}

.panel-header {
    align-items: center;
    border-bottom: 1px solid #edf0f7;
    display: flex;
    justify-content: space-between;
    min-height: 3.2rem;
    padding: .75rem 1rem;
}

.panel-title {
    color: var(--jw-green);
    font-size: .85rem;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
}

.panel-body {
    padding: 1rem;
}

.split {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
}

.billing-hero {
    border-left: .25rem solid var(--jw-green);
}

.billing-hero-main {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1.25rem 1.35rem .85rem;
}

.billing-kicker {
    color: #858796;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.billing-amount {
    color: #1f2937;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: .25rem;
}

.billing-subline {
    color: #6f7890;
    margin-top: .25rem;
}

.billing-reference {
    min-width: 260px;
    text-align: right;
}

.billing-ref-code {
    color: #111827;
    font-family: Consolas, "Courier New", monospace;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: .04em;
    margin: .2rem 0 .5rem;
}

.billing-meta-grid {
    border-top: 1px solid #edf0f7;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.billing-meta-grid div {
    border-right: 1px solid #edf0f7;
    padding: .9rem 1.25rem;
}

.billing-meta-grid div:last-child {
    border-right: 0;
}

.billing-meta-grid span,
.billing-plan-list span,
.invoice-arrangement span {
    color: #858796;
    display: block;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.billing-meta-grid strong,
.billing-plan-list strong,
.invoice-arrangement strong {
    color: #2f3545;
    display: block;
    font-weight: 800;
    margin-top: .18rem;
}

.billing-actions {
    align-items: center;
    background: #f8fafc;
    border-top: 1px solid #edf0f7;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .9rem 1.25rem;
}

.billing-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr);
}

.billing-plan-list,
.invoice-arrangement {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-detail-head {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.invoice-detail-title {
    color: #1f2937;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.15;
}

.invoice-lines th,
.invoice-lines td {
    white-space: normal;
}

.invoice-total-row {
    align-items: center;
    border-top: 2px solid #1f2937;
    display: flex;
    gap: 2rem;
    justify-content: flex-end;
    margin-left: auto;
    margin-top: .75rem;
    max-width: 380px;
    padding-top: .75rem;
}

.invoice-total-row span {
    color: #6f7890;
    font-weight: 700;
}

.invoice-total-row strong {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 800;
}

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

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide {
    grid-column: 1 / -1;
}

.data-table {
    font-size: .86rem;
    margin-bottom: 0;
}

.data-table th {
    background: #f8f9fc;
    border-top: 0;
    color: #4b5570;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    vertical-align: middle;
}

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

.table-tools {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: space-between;
    margin-bottom: .75rem;
}

.table-tools .form-control {
    max-width: 260px;
}

.table-page-controls {
    display: flex;
    gap: .35rem;
}

.sort-button {
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    font-weight: 800;
    padding: 0;
}

.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .75rem;
}

.chart-wrap {
    height: 290px;
    position: relative;
}

.json-box {
    background: #1f2937;
    border-radius: .35rem;
    color: #e5edf7;
    font-family: Consolas, "Courier New", monospace;
    font-size: .82rem;
    max-height: 420px;
    overflow: auto;
    padding: 1rem;
    white-space: pre-wrap;
}

textarea.form-control.code-input {
    font-family: Consolas, "Courier New", monospace;
    min-height: 140px;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: .72rem;
    font-weight: 800;
    padding: .22rem .55rem;
}

.status-ACTIVE,
.status-ONLINE,
.status-PAID,
.status-APPROVED,
.status-FILLED,
.status-EXECUTED {
    background: #e6f4ee;
    color: #0f7a55;
}

.status-PENDING,
.status-CREATED,
.status-QUEUED,
.status-DISPATCHED,
.status-CLIENT_ACKED,
.status-LOCAL_CONFIRM_PENDING,
.status-SENT_TO_IBKR,
.status-IBKR_ACCEPTED,
.status-PARTIAL_FILL,
.status-PARTIALLY_FILLED,
.status-CANCEL_PENDING,
.status-MODIFY_REQUESTED,
.status-MODIFY_PENDING,
.status-SUBMITTED,
.status-PRESUBMITTED,
.status-PENDING_REVIEW,
.status-UNPAID,
.status-PARTIALLY_PAID,
.status-PAYMENT_REVIEW,
.status-CANCEL_REQUESTED,
.status-ACKNOWLEDGED {
    background: #fff5d9;
    color: #9b6500;
}

.status-DISABLED,
.status-OFFLINE,
.status-EXPIRED,
.status-REJECTED,
.status-CANCELLED,
.status-FAILED,
.status-LOCAL_CONFIRM_REJECTED,
.status-VOID {
    background: #fde8e6;
    color: #b42318;
}

.mini-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.mini-actions .btn {
    padding: .2rem .45rem;
}

.muted-empty {
    color: #858796;
    padding: 1.25rem;
    text-align: center;
}

@media (max-width: 1200px) {
    .ops-grid,
    .ops-grid.two,
    .billing-grid,
    .split,
    .form-grid,
    .form-grid.two {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .account-picker {
        display: none;
    }

    .ops-grid,
    .ops-grid.two,
    .billing-grid,
    .billing-meta-grid,
    .billing-plan-list,
    .invoice-arrangement,
    .split,
    .form-grid,
    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .billing-hero-main,
    .invoice-detail-head {
        flex-direction: column;
    }

    .billing-reference {
        min-width: 0;
        text-align: left;
    }

    .billing-meta-grid div {
        border-right: 0;
        border-bottom: 1px solid #edf0f7;
    }

    .billing-meta-grid div:last-child {
        border-bottom: 0;
    }
}
