/*
 * GMA Commercial Suite - layout and components. Colours, fonts and Bootstrap overrides come from theme.css
 * (load order: bootstrap -> vendor plugins -> theme.css -> app.css). Use the var(--...) tokens, never raw colours.
 */

/* ---------------------------------------------------------------- application shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { --bs-offcanvas-width: var(--sidebar-w); --bs-offcanvas-bg: var(--navy); --bs-offcanvas-color: #fff;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--navy); color: #fff; display: flex; flex-direction: column; }
/* Bootstrap's .offcanvas-lg forces a transparent background at >= 992px; the sidebar stays navy */
.app-shell .sidebar.offcanvas-lg { background-color: var(--navy) !important; }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transition: width .18s ease, flex-basis .18s ease; }
  .sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
  .sb-collapsed .sidebar .nav-label, .sb-collapsed .sidebar .brand-text, .sb-collapsed .sidebar .nav-section span { display: none; }
  .sb-collapsed .sidebar .nav-section { height: 1px; margin: 8px 14px; padding: 0; background: rgba(255, 255, 255, .12); }
  .sb-collapsed .sidebar .nav-link, .sb-collapsed .sidebar .sidebar-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
  .sb-collapsed .sidebar .sidebar-toggle .bi { transform: rotate(180deg); }
  .sb-collapsed .sidebar .brand { justify-content: center; padding: 0; }
}
.sidebar-head { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; flex: 0 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-logo { flex: 0 0 32px; border-radius: 8px; }
.brand-text { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--border-strong); }
.brand-text strong { color: #fff; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 8px 0; scrollbar-width: thin; scrollbar-color: var(--navy-2) transparent; }
.sidebar .nav-section { padding: 16px 20px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-label); list-style: none; }
.sidebar .nav-section:first-child { padding-top: 4px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 12px; color: var(--border-strong); padding: 8px 20px; border-left: 3px solid transparent;
  font-weight: 500; white-space: nowrap; }
.sidebar .nav-link .bi { font-size: 17px; flex: 0 0 20px; text-align: center; }
.sidebar .nav-link:hover, .sidebar .nav-link:focus-visible { background: var(--navy-2); color: #fff; }
.sidebar .nav-link.active { background: var(--navy-2); color: #fff; border-left-color: var(--teal); }
.sidebar .nav-link.active .bi { color: var(--teal); }
.sidebar-foot { flex: 0 0 auto; border-top: 1px solid rgba(255, 255, 255, .08); padding: 8px 0; display: flex; flex-direction: column; }
.sidebar-toggle { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; color: var(--muted-light); padding: 8px 20px; font: inherit; }
.sidebar-toggle:hover { color: #fff; background: var(--navy-2); }
.sidebar-toggle .bi { flex: 0 0 20px; transition: transform .18s ease; }
.sidebar .version { font-size: 11px; color: var(--sidebar-label); padding: 2px 20px 4px 52px; }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.crumbs { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal-dark); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.crumbs .sep { margin: 0 6px; color: var(--muted); }
.topbar-search { position: relative; flex: 0 1 360px; }
.topbar-search .bi-search { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.topbar-search .form-control { padding-left: 30px; padding-right: 56px; background: var(--bg); }
.topbar-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.alerts-count { position: absolute; top: 0; right: -2px; font-size: 10px; padding: 1px 5px; color: #fff; background: var(--danger); }
.user-menu { --bs-btn-padding-x: 6px; --bs-btn-font-weight: 500; --bs-btn-hover-bg: var(--neutral-bg); color: var(--text); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; }
.content { flex: 1 1 auto; padding: 24px; outline: none; }
.app-footer { padding: 12px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: #fff; }
.flash-stack { margin-bottom: 16px; }
.impersonation-bar { background: var(--warning-line); color: var(--warning-deep); padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
@media (max-width: 991.98px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px; }
  .sidebar .nav-link { padding: 10px 20px; }
}

/* ---------------------------------------------------------------- page building blocks */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-header h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.page-header .count { font-size: 14px; font-weight: 500; color: var(--neutral); background: var(--neutral-bg); border-radius: 999px; padding: 1px 10px; }
.page-header p.muted { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.row > [class*="col"] > .card { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; align-items: end; }
.grid-2 > .card, .grid-4 > .card { margin-bottom: 0; }
@media (max-width: 767.98px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }
.empty-state { text-align: center; padding: 48px 16px; background: #fff; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-icon { font-size: 32px; color: var(--border-strong); display: block; margin-bottom: 8px; }
.empty-title { font-weight: 600; font-size: 16px; margin: 0 0 4px; color: var(--navy); }

/* filter bar: sticky under the topbar */
.filter-bar { position: sticky; top: var(--topbar-h); z-index: 1010; background: var(--bg); padding: 8px 0 12px; margin-bottom: 4px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar > .filter-row, .filter-bar > .filter-chips { flex: 1 1 100%; }
.filter-bar > input[type=search] { flex: 1 1 260px; width: auto; }
.filter-bar > .form-select, .filter-bar > .form-control:not([type=search]) { width: auto; max-width: 220px; }
.filter-bar .narrow { width: 120px; }
.filter-bar > .check, .filter-row > .check { display: inline-flex; gap: 6px; align-items: center; margin: 0 4px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row > .form-select { width: auto; max-width: 220px; }
.filter-row .select2-container { min-width: 180px; max-width: 260px; }
.filter-search { position: relative; flex: 1 1 260px; }
.filter-search .bi-search { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-search .form-control { padding-left: 32px; }
.filter-dates { display: flex; gap: 6px; align-items: center; }
.filter-dates .form-select { width: auto; }
.filter-dates .form-control { width: 128px; }
.filter-row .form-check { margin: 0 4px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; font-size: 12px;
  background: var(--teal-tint); border: 1px solid var(--teal-line); color: var(--teal-darker); }
.chip-label { font-weight: 600; }
.chip-remove { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 50%; color: var(--teal-darker); text-decoration: none; }
.chip-remove:hover { background: var(--teal-line); color: var(--navy); }

@media (max-width: 575.98px) {
  .topbar-search { display: none; }                 /* search stays one tap away in the menu and on Ctrl+K */
  .filter-row > *, .filter-row > .form-select, .filter-bar > input[type=search], .filter-bar > .form-select, .filter-bar > .form-control { flex: 1 1 100%; max-width: none; width: 100%; }
  .filter-row .select2-container { max-width: none; }
  .filter-dates { flex-wrap: wrap; }
  .filter-dates .form-select { flex: 1 1 100%; }
  .filter-dates .form-control { flex: 1 1 0; width: auto; min-width: 0; }
  .filter-row > .btn, .filter-row > .form-check { flex: 0 0 auto; width: auto; }
  .bulk-bar .form-control, .bulk-bar .form-select { flex: 1 1 100%; }
  .page-header .actions { width: 100%; }
}

/* data tables */
.table-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.table-scroll { overflow: auto; max-height: calc(100vh - 250px); min-height: 120px; border-radius: var(--radius) var(--radius) 0 0; }
.table { --bs-table-hover-bg: var(--teal-tint); --bs-table-striped-bg: var(--zebra); margin-bottom: 0; font-size: 14px; }
table.data { width: 100%; }
table.data > thead > tr > th { position: sticky; top: 0; z-index: 1; background: var(--neutral-bg); color: var(--neutral); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.data > thead th a { color: inherit; text-decoration: none; }
table.data > thead th a:hover { color: var(--teal-dark); }
.sort-icon { font-size: 11px; color: var(--border-strong); margin-left: 2px; }
.sort-icon.active { color: var(--teal-dark); }
table.data > tbody > tr > td { padding: 8px 10px; vertical-align: middle; border-color: var(--border); }
.table-card table.data > tbody > tr > td { white-space: nowrap; }          /* list pages: one line per record, scroll sideways */
table.data > tbody > tr:nth-child(even) > td { background-color: var(--zebra); }
table.data > tbody > tr:hover > td { background-color: var(--teal-tint); }
.row-deleted td { opacity: .6; text-decoration: line-through; }
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 250px); }
.table-wrap + .pager { background: #fff; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); margin-top: -4px; }
.card table.data > thead > tr > th { position: static; }
nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
nav.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
nav.tabs a:hover { color: var(--teal-dark); }
nav.tabs a.active { color: var(--navy); border-bottom-color: var(--teal); font-weight: 600; }
.check-col { width: 36px; text-align: center; }
.actions-col { width: 72px; text-align: right; white-space: nowrap; }
.row-action { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--muted); }
.row-action:hover { background: var(--neutral-bg); color: var(--teal-dark); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 12px; flex-wrap: wrap; border-top: 1px solid var(--border); font-size: 13px; }
.pager .per-page a, .pager .per-page strong { margin: 0 3px; }
.table-card.dt-ready .pager { display: none; }
/* DataTables 2 */
div.dt-container .dt-layout-row { margin: 0; }
div.dt-container .dt-layout-row:last-child { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13px; }
div.dt-container .dt-length select { width: auto; display: inline-block; margin-right: 4px; }
div.dt-container .dt-info { display: inline-block; margin-left: 16px; color: var(--muted); }
div.dt-container .dt-paging .pagination { margin: 0; }
div.dt-container div.dt-processing { display: none !important; }
table.dataTable th.dt-orderable-asc, table.dataTable th.dt-orderable-desc { cursor: pointer; }
table.dataTable > thead > tr > th.dt-orderable-asc span.dt-column-order, table.dataTable > thead > tr > th.dt-orderable-desc span.dt-column-order,
table.dataTable > thead > tr > th.dt-ordering-asc span.dt-column-order, table.dataTable > thead > tr > th.dt-ordering-desc span.dt-column-order { right: 4px; }
table.dataTable > thead > tr > th.num span.dt-column-title { margin-right: 14px; }
/* skeleton loading while DataTables fetches a page */
.table-card.is-loading tbody td { color: transparent !important; position: relative; }
.table-card.is-loading tbody td > * { visibility: hidden; }
.table-card.is-loading tbody td::after { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 10px; margin-top: -5px; border-radius: 4px;
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--border) 37%, var(--skeleton) 63%); background-size: 400% 100%; animation: gma-shimmer 1.2s ease infinite; }
.table-card.is-loading tbody td.check-col::after, .table-card.is-loading tbody td.actions-col::after { left: 8px; right: 8px; }
@keyframes gma-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .table-card.is-loading tbody td::after { animation: none; } }

/* bulk-select bar */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.bulk-bar .form-select { width: auto; }
.bulk-bar .form-control { flex: 1 1 260px; width: auto; }
.bulk-bar.has-selection { background: var(--teal-tint); border-color: var(--teal-line); position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 1005; box-shadow: var(--shadow-md); }
.bulk-count { min-width: 90px; }

/* detail pages */
.record-tabs { margin-bottom: 16px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.record-tabs .nav-link { white-space: nowrap; }
dl { margin: 0; }
.dl-row { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.dl-row:last-child { border-bottom: 0; }
.dl-row dt { color: var(--muted); font-weight: 500; }
.dl-row dd { margin: 0; }
.status-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.status-form.card { padding: 10px 12px; flex-direction: row; align-items: center; }
.status-form .form-select { width: auto; }
.status-form .form-control { flex: 1 1 240px; width: auto; }
.alert .status-form { margin: 0; }
.diff { margin: 0; padding-left: 16px; }
.calc-hint { color: var(--teal-dark); cursor: help; margin-left: 4px; font-size: 13px; }

/* forms */
.form-section { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.form-section legend { float: none; width: auto; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--navy); padding: 0 6px; margin: 0 0 4px -6px; }
.save-bar { position: sticky; bottom: 0; z-index: 1010; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--border);
  padding: 12px 24px; margin: 0 -24px -24px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; box-shadow: 0 -4px 12px rgba(15, 23, 42, .05); }
.save-hint { margin-right: auto; font-size: 12px; }
@media (max-width: 991.98px) { .save-bar { margin: 0 -16px -16px; padding: 12px 16px; } }
.add-line { margin-top: 12px; }
/* Select2 + Flatpickr inside Bootstrap forms */
.select2-container--bootstrap-5 .select2-selection { border-color: var(--border-strong); font-size: 14px; min-height: 35px; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: var(--teal); box-shadow: 0 0 0 .2rem rgba(14, 165, 160, .2); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background-color: var(--teal-dark); color: #fff; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected { background-color: var(--teal-tint); color: var(--navy); }
.is-invalid + .select2-container--bootstrap-5 .select2-selection { border-color: var(--danger); }
.flatpickr-calendar { font-family: var(--font); box-shadow: var(--shadow-md); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.flatpickr-day.today { border-color: var(--teal); }
.flatpickr-input[readonly] { background-color: #fff; }

/* attachments dropzone */
.upload-form { margin-top: 16px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--neutral); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; margin: 0; }
.dropzone .bi { font-size: 28px; color: var(--teal); }
.dropzone:hover, .dropzone.drag-over { border-color: var(--teal); background: var(--teal-tint); }
.dropzone.has-file { border-style: solid; border-color: var(--teal); }
.dz-help { font-size: 12px; }

/* shortcuts dialog */
.shortcuts td:first-child { white-space: nowrap; width: 45%; }

/* ======================================================================== page components (earlier chunks) */
/* Bulk status bar (Chunk 7) */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.check-col { width: 32px; text-align: center; }

/* Timeline widget (Chunk 7) */
.timeline .ev-kind { display: inline-block; min-width: 92px; font-weight: 600; color: var(--navy); }
.timeline li.ev-status { border-left-color: var(--teal); }
.timeline li.ev-create { border-left-color: var(--success); }
.timeline li.ev-delete { border-left-color: var(--danger); }
.timeline li.ev-update, .timeline li.ev-document { border-left-color: var(--muted-light); }
.timeline .fields { color: var(--muted); font-size: 12px; }
.stale-days { font-weight: 600; color: var(--warning); }

/* Alerts (Chunk 8) */
.row-unread td { background: var(--teal-tint); }
.alerts-link { text-decoration: none; }

/* Search (Chunk 9) */
.topbar-search { flex: 1 1 280px; max-width: 420px; }
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.saved-searches .plain { margin: 0 0 12px; }
.save-search { display: flex; flex-direction: column; gap: 8px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; }
.big-search input[type=search] { font-size: 18px; padding: 10px 14px; }
.awb-number { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font: 12px/1.6 ui-monospace, monospace; background: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 12px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: #E2E8F0; stroke-width: 1; }
svg.chart .axis, svg.chart .legend { fill: #64748B; font: 11px "Inter", system-ui, sans-serif; }
svg.chart .ref { stroke: #0B3D5C; stroke-width: 1; stroke-dasharray: 4 4; }
svg.chart path.line { fill: none; stroke-width: 2.5; }
svg.chart path.series-0 { stroke: #94A3B8; } svg.chart rect.series-0 { fill: #94A3B8; }
svg.chart path.series-1 { stroke: #0B3D5C; } svg.chart rect.series-1 { fill: #0B3D5C; }
svg.chart path.series-2 { stroke: #0EA5A0; } svg.chart rect.series-2 { fill: #0EA5A0; }
svg.chart path.series-3 { stroke: #B45309; } svg.chart rect.series-3 { fill: #B45309; }
.palette-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: flex-start; justify-content: center; padding-top: 10vh; z-index: 1000; }
.palette-overlay.open { display: flex; }
.palette { width: min(680px, 92vw); background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.3); overflow: hidden; }
.palette-input { width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 18px; padding: 14px 16px; }
.palette-input:focus { outline: none; }
.palette-results { list-style: none; margin: 0; padding: 4px 0; max-height: 55vh; overflow-y: auto; }
.palette-item { padding: 8px 16px; cursor: pointer; }
.palette-item.active { background: var(--teal-tint); border-left: 3px solid var(--teal); padding-left: 13px; }
.palette-top { display: flex; gap: 8px; align-items: baseline; }
.palette-type { font-size: 11px; text-transform: uppercase; color: var(--teal-dark); min-width: 110px; }
.palette-status { margin-left: auto; font-size: 12px; color: var(--muted); }
.palette-sub { color: var(--muted); font-size: 12px; margin-left: 118px; }
.palette-empty { padding: 12px 16px; color: var(--muted); }
.palette-hint { padding: 8px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); background: var(--bg); }
@media (max-width: 900px) { .search-layout { grid-template-columns: 1fr; } .palette-sub { margin-left: 0; } }

/* Dashboard (Chunk 10) */
.attention { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 13px; }
.chip strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.chip-warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }
.chip-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chip-clear { color: var(--muted); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.kpi-link:hover { border-color: var(--teal); box-shadow: 0 2px 8px rgba(14,165,160,.15); }
.kpi .ccy { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-good { color: var(--success); }
.delta-bad { color: var(--danger); }
.delta-flat, .delta-new { color: var(--muted); }
.kpi-note { font-size: 11px; color: var(--warning); }
.movement { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--navy); color: var(--border);
  border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; }
.movement-title { font-weight: 700; color: #fff; margin-right: 8px; }
.movement .mv { color: var(--border); text-decoration: none; }
.movement a.mv:hover { color: #fff; text-decoration: underline; }
.movement .mv strong { color: #fff; font-variant-numeric: tabular-nums; }
.movement .muted { color: var(--sidebar-label); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid .card { margin-bottom: 0; }
.chart-card h2 .muted { font-weight: 400; font-size: 12px; }
.chart-empty { padding: 40px 0; text-align: center; }
.stale-list li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); }
.report-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 10px; background: #fff; border: 1px solid var(--border);
  text-decoration: none; color: var(--navy); }
.tile:hover { border-color: var(--teal); }
.tile-code { font-size: 11px; color: var(--teal-dark); font-weight: 700; letter-spacing: .05em; }
.tile-label { font-weight: 600; }
svg.chart polyline.line { fill: none; stroke-width: 2.5; }
svg.chart circle.dot { stroke: none; }
svg.chart .slice, svg.chart .bar { stroke: #fff; stroke-width: 1; }
svg.chart circle.ring { fill: none; }
svg.chart .donut-total { fill: #0B3D5C; font: 700 20px "Inter", system-ui, sans-serif; }
svg.chart polyline.series-0, svg.chart circle.ring.series-0 { stroke: #94A3B8; }
svg.chart polyline.series-1, svg.chart circle.ring.series-1 { stroke: #0B3D5C; }
svg.chart polyline.series-2, svg.chart circle.ring.series-2 { stroke: #0EA5A0; }
svg.chart polyline.series-3, svg.chart circle.ring.series-3 { stroke: #B45309; }
svg.chart polyline.series-4, svg.chart circle.ring.series-4 { stroke: #1D4ED8; }
svg.chart polyline.series-5, svg.chart circle.ring.series-5 { stroke: #B91C1C; }
svg.chart .series-0:not(polyline):not(.ring) { fill: #94A3B8; }
svg.chart .series-1:not(polyline):not(.ring) { fill: #0B3D5C; }
svg.chart .series-2:not(polyline):not(.ring) { fill: #0EA5A0; }
svg.chart .series-3:not(polyline):not(.ring) { fill: #B45309; }
svg.chart .series-4:not(polyline):not(.ring) { fill: #1D4ED8; }
svg.chart .series-5:not(polyline):not(.ring) { fill: #B91C1C; }
svg.chart path.line.series-0, svg.chart path.line.series-1, svg.chart path.line.series-2, svg.chart path.line.series-3 { fill: none; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
@media print { .attention, .report-tiles { display: none; } .movement, .movement .mv, .movement .mv strong, .movement-title, .movement .muted { background: none; color: var(--text); } .movement { border: 1px solid var(--border-strong); } }

/* Logs + admin (Chunk 11) */
.small { font-size: 12px; }
pre.code { background: var(--text); color: var(--border); padding: 12px; border-radius: 8px; overflow-x: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.diff-table tr.changed td { background: var(--warning-bg); }
.diff-table td { word-break: break-word; max-width: 420px; }
.temp-password .temp-value { font-size: 26px; letter-spacing: .06em; margin: 16px 0; }
.temp-password code { background: var(--teal-tint); border: 1px dashed var(--teal); padding: 8px 14px; border-radius: 8px; user-select: all; }

/* Reports (Chunk 12) */
.report-form { display: flex; flex-direction: column; gap: 10px; }
.period-filter { display: flex; flex-direction: column; gap: 10px; }
.seg-group { display: flex; flex-wrap: wrap; gap: 4px; }
.seg { padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--navy);
  background: #fff; font-size: 13px; }
.seg:hover { border-color: var(--teal); }
.seg.active { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; font-weight: 600; }
.period-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.period-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.period-row label.check { flex-direction: row; align-items: center; font-weight: 400; font-size: 13px; }
.report-catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.report-catalog .card { margin-bottom: 0; }
.catalog-list li { display: flex; gap: 8px; align-items: center; border-bottom: 1px dashed var(--border); padding: 6px 0; }
.catalog-list a { text-decoration: none; color: var(--navy); font-weight: 600; flex: 1; }
.catalog-list a.not-built { color: var(--muted); font-weight: 400; }
@media print { .report-form, .report-toolbar, .topbar, .sidebar { display: none !important; } }

/* Enhancement Budget (Chunk 18) */
html.js .no-js-only { display: none !important; }
html:not(.js) .js-only { display: none !important; }
.version-pill { font-size: 12px; }
.enh-readonly { min-height: 35px; display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--neutral-bg); color: var(--text); font-weight: 600; }
.enh-grid-card { padding: 0; overflow: hidden; }
.enh-grid-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.enh-grid-card > .form-text { padding: 8px 16px 12px; }
.enh-grid .row-no { width: 40px; color: var(--muted); text-align: right; }
.enh-grid .item-col { width: 30%; min-width: 220px; }
.enh-grid .amount-col { width: 170px; }
.enh-grid .share-col { width: 110px; }
.enh-grid td { vertical-align: middle; }
.enh-grid tr.is-removed { display: none; }
.enh-grid tr.row-error > td { background-color: var(--danger-bg) !important; }
.enh-grid tr.is-new > td { background-color: var(--teal-tint); }
.row-action { background: none; border: 0; padding: 0; }
.row-action-danger:hover { color: var(--danger); }
.custom-area .input-group-text { background: var(--teal-tint); color: var(--teal-dark); border-color: var(--border-strong); }
.enh-start { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; }
.enh-start .form-select, .enh-start .select2-container { flex: 1 1 300px; max-width: 520px; }
.enh-footer { position: sticky; bottom: 0; z-index: 1010; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border); padding: 12px 24px; margin: 16px -24px -24px; box-shadow: 0 -4px 12px rgba(15, 23, 42, .06); }
@media (max-width: 991.98px) { .enh-footer { margin: 16px -16px -16px; padding: 12px 16px; } }
.enh-totals { display: flex; flex-wrap: wrap; gap: 12px; }
.enh-total { display: flex; flex-direction: column; padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card); min-width: 150px; }
.enh-total .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.enh-total .val { font-size: 16px; font-weight: 700; color: var(--navy); }
.enh-total .sub { font-size: 11px; color: var(--muted); }
.enh-remaining.is-ok { border-color: var(--success-soft); background: var(--success-bg); }
.enh-remaining.is-ok .val { color: var(--success); }
.enh-remaining.is-low { border-color: var(--warning-line); background: var(--warning-bg); }
.enh-remaining.is-low .val, .enh-remaining.is-low .sub { color: var(--warning-ink); }
.enh-remaining.is-over { border-color: var(--danger-line); background: var(--danger-bg); }
.enh-remaining.is-over .val, .enh-remaining.is-over .sub { color: var(--danger); }
.enh-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.enh-over-msg { flex: 1 1 100%; text-align: right; color: var(--danger); font-size: 13px; font-weight: 600; }
.enh-history-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 16px; margin-top: 4px; }
.enh-history .delta.up { color: var(--success); } .enh-history .delta.down { color: var(--danger); }
@media print { .enh-footer .enh-actions, .enh-grid-head .actions, .enh-grid .actions-col { display: none !important; } .enh-footer { position: static; box-shadow: none; } }

/* Master data + Settings */
.masters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.master-tile { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); margin: 0; }
.master-tile:hover { border-color: var(--teal); box-shadow: var(--shadow-md); }
.master-tile > .bi { font-size: 22px; color: var(--teal); }
.master-title { font-weight: 600; color: var(--navy); font-size: 15px; }
.master-note { font-size: 12px; color: var(--muted); }
.masters-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.masters-nav { padding: 6px; position: sticky; top: calc(var(--topbar-h) + 12px); }
.masters-nav .nav-link { color: var(--text); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.masters-nav .nav-link .bi { color: var(--muted); width: 18px; }
.masters-nav .nav-link:hover { background: var(--teal-tint); }
.masters-nav .nav-link.active { background: var(--teal-tint); color: var(--teal-darker); font-weight: 600; }
.row-inactive td { color: var(--muted); }
@media (max-width: 991.98px) { .masters-layout { grid-template-columns: 1fr; } .masters-nav { position: static; } }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); gap: 8px 24px; padding: 12px 0;
  border-bottom: 1px dashed var(--border); align-items: start; }
.setting-row:last-child { border-bottom: 0; }
.setting-row.has-error { background: var(--danger-bg); margin: 0 -16px; padding: 12px 16px; }
.setting-meta { font-size: 11px; margin-top: 2px; }
@media (max-width: 767.98px) { .setting-row { grid-template-columns: 1fr; } }

/* Timeline (Chunk 7 widget, Bootstrap era) */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--teal); margin-left: 6px; }
.timeline .when { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.timeline .remark { color: var(--muted); font-style: italic; margin-top: 2px; }

/* Dashboard charts: Chart.js on screen, the server SVG for print / no JavaScript */
.chart-canvas { position: relative; height: 260px; }
.chart-card.chart-live .chart-svg { display: none; }
.chart-card h2 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }

/* Shell on paper (reports use report.css; this covers printing any app page) */
@media print {
  .sidebar, .topbar, .app-footer, .filter-bar, .actions, .status-form, .save-bar, .record-tabs, .upload-form, .bulk-bar,
  .actions-col, .check-col, .pager, .dt-layout-row:last-child, .flash-stack, .skip-link { display: none !important; }
  .content { padding: 0; }
  .table-scroll { max-height: none; overflow: visible; }
  table.data > thead > tr > th { position: static; }
  .card, .table-card { box-shadow: none; }
  .chart-card.chart-live .chart-svg { display: block; }
  .chart-canvas { display: none; }
}

/* Calculated amounts (data-product, e.g. Amount (BDT) on TT): tinted while the value is the live product */
.form-control.is-calculated { background-color: var(--teal-tint); border-color: var(--teal-line); }
