/* JDI Billing theme, layered on Bootstrap 5. Colours are tokens so the look can change in one place. */
:root {
    --brand: #1769c7;
    --brand-dark: #125299;
    --brand-soft: #e8f1fb;
    --ink: #1c2733;
    --ink-muted: #647182;
    --line: #e4e8ee;
    --surface: #ffffff;
    --page: #f4f6f9;
    --side: #14202f;
    --side-ink: #aeb9c7;
    --side-active: #223449;
    --series-in: #2a78d6;
    --series-out: #eb6834;
    --radius: 10px;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 23, 105, 199;
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 23, 105, 199;
    --bs-link-hover-color: var(--brand-dark);
    --bs-body-font-size: .875rem;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--page);
    --bs-border-color: var(--line);
}

body { background: var(--page); color: var(--ink); }
a { text-decoration: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; }

.btn { --bs-btn-font-size: .8125rem; --bs-btn-padding-y: .34rem; --bs-btn-padding-x: .7rem; --bs-btn-border-radius: 7px; }
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.app-side {
    width: 228px; flex: 0 0 228px; background: var(--side); color: var(--side-ink);
    position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 24px;
}
.offcanvas.app-side { position: fixed; height: 100%; }
.app-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 1rem; padding: 4px 8px 14px; }
.app-brand i { font-size: 1.3rem; color: #6db3ff; }
.nav-group { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #76859a; margin: 14px 8px 4px; }
.side-link { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 6px 10px; border-radius: 7px; font-size: .84rem; }
.side-link i { font-size: 1rem; width: 18px; text-align: center; }
.side-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side-link.active { color: #fff; background: var(--side-active); box-shadow: inset 3px 0 0 #6db3ff; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top {
    background: var(--surface); border-bottom: 1px solid var(--line); height: 52px; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.app-body { padding: 18px 20px 32px; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
    display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; flex-shrink: 0;
}
img.avatar { object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.7rem; }

/* Blocks */
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.page-head h1 { font-size: 1.2rem; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--ink-muted); font-size: .8rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: .9rem; margin: 0; }
.panel-body { padding: 14px; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: center; gap: 12px; height: 100%; color: inherit; }
.stat-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex: none; }
.stat-label { color: var(--ink-muted); font-size: .74rem; }
.stat-value { font-size: 1.12rem; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tone-primary { background: #e8f1fb; color: #125299; }
.tone-success { background: #e4f5ec; color: #0f6b3f; }
.tone-warning { background: #fdf3dc; color: #8a5a00; }
.tone-danger { background: #fce9e7; color: #a82a1f; }
.tone-secondary { background: #edf0f4; color: #475465; }

.badge-soft { display: inline-block; font-size: .7rem; font-weight: 600; padding: .18em .58em; border-radius: 20px; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.filters .form-control, .filters .form-select { width: auto; min-width: 150px; font-size: .8125rem; }
.filters .filter-search { flex: 1 1 200px; max-width: 320px; }

.table { --bs-table-bg: transparent; margin: 0; }
.table > thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
.table > tbody td { vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f7f9fc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-empty { text-align: center; color: var(--ink-muted); padding: 32px 10px !important; }
.pager { padding: 10px 14px 0; }
.pager .pagination { --bs-pagination-font-size: .8rem; --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); }
.pager nav > div.d-sm-none { display: none !important; }
.pager nav > div.d-none { display: flex !important; flex-wrap: wrap; gap: 6px; }

.form-label { font-size: .78rem; font-weight: 600; margin-bottom: 3px; color: #3b4857; }
.form-control, .form-select { font-size: .84rem; border-radius: 7px; padding-top: .33rem; padding-bottom: .33rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .18rem rgba(23, 105, 199, .15); }
.form-section { font-size: .8rem; font-weight: 600; color: var(--brand-dark); border-bottom: 1px dashed var(--line); padding-bottom: 5px; margin: 6px 0 2px; }

.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 5px 10px; margin: 0; }
.detail-list dt { color: var(--ink-muted); font-weight: 500; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }

.progress { --bs-progress-height: 6px; --bs-progress-bar-bg: var(--brand); min-width: 70px; }

.items-table td { padding: 4px; }
.items-table .form-control, .items-table .form-select { font-size: .8rem; }
.totals-box { min-width: 260px; }
.totals-box div { display: flex; justify-content: space-between; gap: 20px; padding: 2px 0; }
.totals-box .grand { font-weight: 700; font-size: 1rem; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }

.comment { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }

/* Dashboard cash-flow chart: thin bars, 4px rounded ends on the baseline, 2px gap in a pair */
.chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; height: 170px; align-items: end; border-bottom: 1px solid var(--line); }
.chart-month { position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 2px; height: 100%; }
.chart-bar { width: 16px; min-height: 2px; border-radius: 4px 4px 0 0; }
.chart-bar.in { background: var(--series-in); }
.chart-bar.out { background: var(--series-out); }
.chart-tip {
    display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); z-index: 5; white-space: nowrap;
    background: var(--ink); color: #fff; font-size: .72rem; padding: 5px 8px; border-radius: 6px; margin-bottom: -22px;
}
.chart-month:hover .chart-tip { display: block; }
.chart-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; text-align: center; color: var(--ink-muted); font-size: .72rem; padding-top: 5px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* Sign-in */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, #14202f, #1b3350 60%, #1769c7); }
.auth-card { width: 100%; max-width: 860px; min-height: 470px; display: grid; grid-template-columns: 5fr 6fr; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
.auth-side { container-type: inline-size; background: linear-gradient(160deg, #12305c, #0b2145 60%, #071630); color: #fff; padding: 24px 32px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 600; }
/* An icon is one em wide, so 100cqw makes it exactly as wide as the panel's content. */
.auth-emblem { font-size: 19rem; font-size: 100cqw; line-height: 1; display: flex; }
.auth-place { color: rgba(255, 255, 255, .7); }
.auth-form { padding: 36px; display: flex; flex-direction: column; justify-content: center; }
.auth-form .input-group-text { background: var(--page); color: var(--ink-muted); }
.auth-form .btn-primary { padding-block: 9px; font-weight: 600; }
.portal-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #edf0f4; padding: 4px; border-radius: 9px; margin-bottom: 18px; }
.portal-switch a { text-align: center; padding: 6px; border-radius: 6px; color: var(--ink-muted); font-weight: 600; font-size: .82rem; }
.portal-switch a.active { background: var(--surface); color: var(--brand-dark); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* Quotation to invoice progress */
.flow-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.flow-step { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-muted); font-size: .8rem; font-weight: 600; }
.flow-step.done { background: #e4f5ec; border-color: #e4f5ec; color: #0f6b3f; }

/* Print layouts */
.doc-page { background: #fff; max-width: 820px; margin: 16px auto; padding: 34px 38px; border: 1px solid var(--line); color: #111; font-size: .85rem; }
.doc-actions { max-width: 820px; margin: 16px auto -4px; display: flex; gap: 8px; justify-content: flex-end; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid #222; padding-bottom: 12px; margin-bottom: 14px; }
.doc-logo { max-height: 56px; max-width: 220px; }
.doc-title { text-align: center; font-size: 1.05rem; font-weight: 700; letter-spacing: .05em; margin-bottom: 12px; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.doc-table th, .doc-table td { border: 1px solid #bbb; padding: 5px 7px; vertical-align: top; }
.doc-table th { background: #f1f3f5; font-size: .74rem; }
.doc-foot { margin-top: 22px; display: flex; justify-content: space-between; gap: 24px; }

@media (max-width: 991.98px) {
    .app-body { padding: 14px 16px 28px; }
    .app-top { padding: 0 16px; }
}
@media (max-width: 720px) {
    .auth-card { grid-template-columns: 1fr; min-height: 0; max-width: 420px; }
    .auth-side { flex-direction: row; align-items: center; padding: 14px 20px; }
    .auth-emblem { font-size: 2.6rem; }
    .auth-place { display: none; }
    .auth-form { padding: 22px 20px; }
    .doc-page { padding: 18px 16px; margin: 0; border: 0; }
    .chart-bar { width: 10px; }
    .stat { padding: 10px; gap: 8px; }
    .stat-icon { width: 30px; height: 30px; font-size: .9rem; }
    .stat-value { font-size: .95rem; overflow-wrap: anywhere; }
}
@media print {
    body { background: #fff; }
    .doc-actions { display: none; }
    .doc-page { border: 0; margin: 0; max-width: none; padding: 0; }
    .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
