/* ===========================================================
   BlueLedger — blue on white theme for Bootstrap 5.3.2
   =========================================================== */
:root {
  --bl-blue: #0b4aa2;
  --bl-blue-dark: #07326f;
  --bl-blue-mid: #2f6fd0;
  --bl-blue-soft: #e9f1fd;
  --bl-blue-line: #c9dbf6;
  --bl-ink: #10233f;
  --bs-primary: var(--bl-blue);
  --bs-primary-rgb: 11, 74, 162;
  --bs-link-color: var(--bl-blue);
  --bs-link-color-rgb: 11, 74, 162;
  --bs-link-hover-color: var(--bl-blue-dark);
  --bs-body-color: var(--bl-ink);
  --bs-body-bg: #ffffff;
  --bs-border-radius: .55rem;
  --bs-font-sans-serif: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
body { background: #fff; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; }
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .4rem .8rem; }

.btn-primary { --bs-btn-bg: var(--bl-blue); --bs-btn-border-color: var(--bl-blue); --bs-btn-hover-bg: var(--bl-blue-dark); --bs-btn-hover-border-color: var(--bl-blue-dark); --bs-btn-active-bg: var(--bl-blue-dark); --bs-btn-disabled-bg: var(--bl-blue); --bs-btn-disabled-border-color: var(--bl-blue); }
.btn-outline-primary { --bs-btn-color: var(--bl-blue); --bs-btn-border-color: var(--bl-blue); --bs-btn-hover-bg: var(--bl-blue); --bs-btn-hover-border-color: var(--bl-blue); --bs-btn-active-bg: var(--bl-blue-dark); }
.text-bg-primary { background-color: var(--bl-blue) !important; }
.text-primary { color: var(--bl-blue) !important; }
.bg-primary-soft { background: var(--bl-blue-soft) !important; }
.border-primary-soft { border-color: var(--bl-blue-line) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--bl-blue-mid); box-shadow: 0 0 0 .2rem rgba(11, 74, 162, .18); }
.form-check-input:checked { background-color: var(--bl-blue); border-color: var(--bl-blue); }
.form-range::-webkit-slider-thumb { background: var(--bl-blue); }
.form-range::-moz-range-thumb { background: var(--bl-blue); }
.nav-pills .nav-link.active { background: var(--bl-blue); }
.nav-pills .nav-link { color: var(--bl-blue); }
.text-bg-orange { background: #e8590c; color: #fff; }
.progress-bar { background-color: var(--bl-blue); }

/* Navbar */
.bl-navbar { background: #fff; border-top: 4px solid var(--bl-blue); border-bottom: 1px solid var(--bl-blue-line); }
.bl-navbar .navbar-brand { color: var(--bl-blue-dark); font-weight: 700; letter-spacing: -.01em; }
.bl-navbar .nav-link { color: var(--bl-ink); font-weight: 500; white-space: nowrap; }
@media (min-width: 992px) and (max-width: 1399.98px) { .admin-area .bl-navbar .nav-link { padding-left: .45rem; padding-right: .45rem; font-size: .92rem; } }
.bl-navbar .nav-link:hover, .bl-navbar .nav-link.active { color: var(--bl-blue); }
.bl-navbar .nav-link.active { box-shadow: inset 0 -2px 0 var(--bl-blue); }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .5rem; background: var(--bl-blue); color: #fff; margin-right: .35rem; }
.admin-area .bl-navbar { border-top-color: var(--bl-blue-dark); background: linear-gradient(#fff, #f7faff); }

.bl-footer { border-top: 1px solid var(--bl-blue-line); background: #f7faff; color: #4a5a72; flex-shrink: 0; }

/* Cards & surfaces */
.card { border-color: var(--bl-blue-line); }
.card-header { background: var(--bl-blue-soft); border-bottom-color: var(--bl-blue-line); font-weight: 600; color: var(--bl-blue-dark); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.65rem; font-weight: 700; margin: 0; color: var(--bl-blue-dark); }
.page-head p { margin: .25rem 0 0; color: #51627c; }

.kpi { border: 1px solid var(--bl-blue-line); border-radius: .7rem; padding: 1rem 1.1rem; background: #fff; height: 100%; }
.kpi .kpi-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #5a6b85; font-weight: 600; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--bl-blue-dark); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: .82rem; color: #5a6b85; }
.kpi.kpi-good { border-left: 4px solid #198754; }
.kpi.kpi-warn { border-left: 4px solid #e0a800; }
.kpi.kpi-bad  { border-left: 4px solid #dc3545; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--bl-blue-soft) 0%, #fff 70%); border: 1px solid var(--bl-blue-line); border-radius: 1rem; padding: 3rem 2rem; }
.hero h1 { font-weight: 800; color: var(--bl-blue-dark); letter-spacing: -.02em; }
.c-tile { border: 1px solid var(--bl-blue-line); border-radius: .8rem; padding: 1.2rem; height: 100%; background: #fff; }
.c-tile .c-icon { width: 2.6rem; height: 2.6rem; border-radius: .6rem; display: grid; place-items: center; background: var(--bl-blue-soft); color: var(--bl-blue); font-size: 1.3rem; margin-bottom: .7rem; }

/* Auth */
.auth-wrap { max-width: 440px; margin: 2rem auto; }
.auth-card { border-top: 4px solid var(--bl-blue); }

/* Score bars */
.score-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 3fr 3rem; gap: .75rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--bl-blue-line); }
.score-row:last-child { border-bottom: 0; }
.score-bar { height: .7rem; background: #eef3fb; border-radius: 1rem; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--bl-blue); border-radius: 1rem; }
.score-bar span.low { background: #dc3545; } .score-bar span.mid { background: #e0a800; }
.grade-badge { font-size: 2.2rem; font-weight: 800; width: 4.2rem; height: 4.2rem; border-radius: 50%; display: grid; place-items: center; color: #fff; }

/* Tables */
.table-fin { font-variant-numeric: tabular-nums; font-size: .9rem; }
.table-fin th { color: var(--bl-blue-dark); background: var(--bl-blue-soft) !important; white-space: nowrap; }
.table-fin td.num, .table-fin th.num { text-align: right; white-space: nowrap; }
.table-fin tr.total td { font-weight: 700; border-top: 2px solid var(--bl-blue); }
.neg { color: #c1121f; }
.table-scroll { max-height: 420px; overflow: auto; }

/* Simulator */
.sim-inputs .form-label { font-size: .82rem; font-weight: 600; margin-bottom: .15rem; color: #34465f; }
.sim-inputs .input-group-text { font-size: .8rem; min-width: 3.2rem; justify-content: center; background: var(--bl-blue-soft); color: var(--bl-blue-dark); }
.sim-inputs fieldset { border: 1px solid var(--bl-blue-line); border-radius: .7rem; padding: .8rem 1rem .4rem; margin-bottom: 1rem; }
.sim-inputs legend { float: none; width: auto; font-size: .85rem; font-weight: 700; color: var(--bl-blue); padding: 0 .4rem; margin: 0; text-transform: uppercase; letter-spacing: .04em; }
.sticky-panel { position: sticky; top: 1rem; }
.chart-box { position: relative; width: 100%; height: 260px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .8rem; margin-top: .4rem; }
.chart-legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; margin-right: .3rem; vertical-align: -1px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--bl-blue-dark); color: #fff; padding: .35rem .55rem; border-radius: .4rem; font-size: .75rem; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; z-index: 5; }

/* Wizard */
.wizard-nav .nav-link { border: 1px solid var(--bl-blue-line); margin: 0 .35rem .5rem 0; border-radius: 2rem; font-size: .9rem; }
.wizard-nav .nav-link .step-no { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--bl-blue-soft); color: var(--bl-blue); font-size: .75rem; font-weight: 700; margin-right: .35rem; }
.wizard-nav .nav-link.active .step-no { background: #fff; }
.doc-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem .8rem; border: 1px solid var(--bl-blue-line); border-radius: .6rem; margin-bottom: .5rem; }
.doc-item.done { background: #f2f9f4; border-color: #b9dfc6; }

/* Cookie banner */
.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1080; background: #fff; border-top: 3px solid var(--bl-blue); box-shadow: 0 -6px 24px rgba(7, 50, 111, .12); padding: 1rem 0; }

/* =================== PRINT =================== */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { font-size: 10.5pt; color: #000; }
  .print-only { display: block !important; }
  main.container-xl { max-width: 100% !important; padding: 0 !important; }
  .card { break-inside: auto; border-color: #9fb8de !important; }
  .card-header, .kpi, .score-row, tr, .doc-item, .sig-line { break-inside: avoid; }
  .card-header { break-after: avoid; }
  .col-lg-3, .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-6, .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-4, .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-lg-8 { flex: 0 0 100%; max-width: 100%; }
  .card-header { background: #e9f1fd !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-fin th, .score-bar span, .grade-badge, .kpi, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-scroll { max-height: none; overflow: visible; }
  .page-break { break-before: page; }
  a[href]:after { content: none !important; }
  .chart-box { height: 220px; }
  .kpi .kpi-value { font-size: 1.1rem; }
  .kpi { padding: .6rem .7rem; }
  .print-header { border-bottom: 3px solid var(--bl-blue); padding-bottom: .4rem; margin-bottom: 1rem; display: flex !important; justify-content: space-between; }
  .sig-line { border-top: 1px solid #000; padding-top: .25rem; margin-top: 2.5rem; }
}
.print-header { display: none; }
