/* Bridge: IFP theme shell + existing Bootstrap / DataTables pages */

html,
body.theme-app {
  font-family: var(--font);
  background: var(--bg);
}

.theme-app .form-control,
.theme-app .btn,
.theme-app .table,
.theme-app .card,
.theme-app .dropdown-menu,
.theme-app input,
.theme-app select,
.theme-app textarea,
.theme-app label,
.theme-app .dataTables_wrapper,
.theme-app .breadcrumb {
  font-family: var(--font);
}

.theme-app [class^="bi-"]::before,
.theme-app .bi::before {
  font-family: "bootstrap-icons" !important;
}

/* Sidebar + nav items: see public/css/sidebar.css */

/* ==========================================================
   Application shell — top bar, breadcrumb, footer
   ========================================================== */
.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-left { flex: 1; }
.topbar-right { flex: none; }
.topbar-title {
  margin: 0;
  min-width: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
}
.topbar-icon-btn:hover,
.topbar-icon-btn[aria-expanded="true"] {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--heading);
  text-decoration: none;
}
.topbar-icon-btn svg { width: 20px; height: 20px; }
.topbar-notifications { position: relative; }
.topbar-notifications .badge-count {
  position: absolute;
  top: -5px;
  right: -7px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: content-box;
}
.topbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--border);
}
.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font);
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-md);
  color: var(--text);
}
.topbar-profile:hover,
.topbar-profile[aria-expanded="true"] { background: var(--surface-muted); border-color: var(--border); }
.topbar-profile img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.topbar-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ifp-navy);
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 700;
  flex-shrink: 0;
}
.topbar-profile img[hidden],
.topbar-avatar-fallback[hidden] { display: none; }
.topbar-profile .name { font-size: var(--fs-md); font-weight: 600; color: var(--heading); text-align: left; line-height: 1.25; }
.topbar-profile .status { font-size: var(--fs-xs); color: var(--text-secondary); text-align: left; line-height: 1.25; text-transform: capitalize; }
.topbar-profile.dropdown-toggle::after { color: var(--text-secondary); margin-left: 2px; }

/* Breadcrumb strip */
.app-breadcrumb {
  padding: 14px var(--content-pad) 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.app-breadcrumb .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  border: 0;
}
.app-breadcrumb .breadcrumb-item { display: inline-flex; align-items: center; gap: 4px; }
.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--border-strong); }
.app-breadcrumb .breadcrumb-item.active { color: var(--heading); font-weight: 600; }
.app-breadcrumb a { color: var(--text-secondary); }
.app-breadcrumb a:hover { color: var(--accent); }

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 14px var(--content-pad);
  border-top: 1px solid var(--divider);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* KPI grid helper */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ==========================================================
   Dropdowns
   ========================================================== */
.theme-app .dropdown-menu {
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-md);
}
.theme-app .dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.theme-app .dropdown-item:hover,
.theme-app .dropdown-item:focus { background: var(--surface-muted); color: var(--heading); }
.theme-app .dropdown-item.active,
.theme-app .dropdown-item:active { background: var(--ifp-blue-50); color: var(--info-text); }
.theme-app .dropdown-header {
  padding: 8px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  background: transparent;
}
.theme-app .dropdown-divider { border-top-color: var(--divider); margin: 6px 0; }
.app-topbar .dropdown-menu-lg { min-width: 300px; }
.app-topbar .dropdown-menu .dropdown-header { border-bottom: 1px solid var(--divider); margin: -6px -6px 6px; padding: 10px 14px; }

@media (max-width: 991.98px) {
  :root { --content-pad: 16px; }
}

/* ==========================================================
   Cards (Bootstrap pages inside .app-content)
   ========================================================== */
.app-content .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
/* Bootstrap-structured cards get their spacing from header/body/footer */
.app-content .card:has(> .card-body, > .card-header, > .card-footer, > .table-responsive, > .list-group) { padding: 0; }
.app-content .card-header {
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--heading);
}
.app-content .card-header:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.app-content .card-body { padding: 20px; }
.app-content .card-footer {
  padding: 12px 20px;
  background: var(--surface-muted);
  border-top: 1px solid var(--divider);
}
.app-content .card-footer:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.app-content .card-title { color: var(--heading); }
.app-content .table { font-size: var(--fs-md); }
.app-content .table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.app-content .card,
.app-content .card-body {
  max-width: 100%;
  min-width: 0;
}

/* ==========================================================
   Buttons — primary (blue), secondary (white), destructive (red)
   ========================================================== */
.theme-app .btn {
  border-radius: var(--radius-md);
  font-weight: 600;
  line-height: 1.4;
  box-shadow: none;
}
.theme-app .btn:focus,
.theme-app .btn.focus { outline: 0; box-shadow: var(--focus-ring); }
.theme-app .btn.disabled,
.theme-app .btn:disabled { opacity: .55; cursor: not-allowed; }

.theme-app .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.theme-app .btn-primary:hover,
.theme-app .btn-primary:focus,
.theme-app .btn-primary:not(:disabled):not(.disabled):active,
.theme-app .btn-primary:not(:disabled):not(.disabled).active {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* Informational / secondary-emphasis actions (e.g. row "Edit") */
.theme-app .btn-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}
.theme-app .btn-info:hover,
.theme-app .btn-info:focus,
.theme-app .btn-info:not(:disabled):not(.disabled):active,
.theme-app .btn-info:not(:disabled):not(.disabled).active {
  background: var(--ifp-blue-100);
  border-color: var(--ifp-blue-200);
  color: var(--info-text);
}

.theme-app .btn-success {
  background: var(--success-strong);
  border-color: var(--success-strong);
  color: #fff;
}
.theme-app .btn-success:hover,
.theme-app .btn-success:focus,
.theme-app .btn-success:not(:disabled):not(.disabled):active {
  background: var(--success-text);
  border-color: var(--success-text);
  color: #fff;
}

.theme-app .btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: var(--ifp-navy);
}
.theme-app .btn-warning:hover,
.theme-app .btn-warning:focus,
.theme-app .btn-warning:not(:disabled):not(.disabled):active {
  background: var(--warning-strong);
  border-color: var(--warning-strong);
  color: var(--ifp-navy);
}

.theme-app .btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.theme-app .btn-danger:hover,
.theme-app .btn-danger:focus,
.theme-app .btn-danger:not(:disabled):not(.disabled):active {
  background: var(--danger-strong);
  border-color: var(--danger-strong);
  color: #fff;
}
.theme-app .btn-danger:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .25); }

.theme-app .btn-secondary,
.theme-app .btn-light {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.theme-app .btn-secondary:hover,
.theme-app .btn-light:hover,
.theme-app .btn-secondary:focus,
.theme-app .btn-light:focus,
.theme-app .btn-secondary:not(:disabled):not(.disabled):active,
.theme-app .btn-light:not(:disabled):not(.disabled):active,
.theme-app .btn-secondary:not(:disabled):not(.disabled).active,
.theme-app .btn-light:not(:disabled):not(.disabled).active {
  background: var(--surface-muted);
  border-color: #AEBACB;
  color: var(--heading);
}

.theme-app .btn-dark {
  background: var(--ifp-navy);
  border-color: var(--ifp-navy);
  color: #fff;
}
.theme-app .btn-dark:hover,
.theme-app .btn-dark:focus,
.theme-app .btn-dark:not(:disabled):not(.disabled):active {
  background: var(--ifp-navy-700);
  border-color: var(--ifp-navy-700);
  color: #fff;
}

.theme-app .btn-outline-primary,
.theme-app .btn-outline-info {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}
.theme-app .btn-outline-primary:hover,
.theme-app .btn-outline-info:hover,
.theme-app .btn-outline-primary:not(:disabled):not(.disabled):active,
.theme-app .btn-outline-info:not(:disabled):not(.disabled):active,
.theme-app .btn-outline-primary:not(:disabled):not(.disabled).active,
.theme-app .btn-outline-info:not(:disabled):not(.disabled).active {
  background: var(--ifp-blue-50);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.theme-app .btn-outline-secondary,
.theme-app .btn-outline-dark,
.theme-app .btn-outline-light {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.theme-app .btn-outline-secondary:hover,
.theme-app .btn-outline-dark:hover,
.theme-app .btn-outline-light:hover,
.theme-app .btn-outline-secondary:not(:disabled):not(.disabled):active,
.theme-app .btn-outline-dark:not(:disabled):not(.disabled):active,
.theme-app .btn-outline-secondary:not(:disabled):not(.disabled).active,
.theme-app .btn-outline-dark:not(:disabled):not(.disabled).active {
  background: var(--surface-muted);
  border-color: #AEBACB;
  color: var(--heading);
}
.theme-app .btn-outline-success {
  background: var(--surface);
  border-color: var(--success-border);
  color: var(--success-text);
}
.theme-app .btn-outline-success:hover,
.theme-app .btn-outline-success:not(:disabled):not(.disabled):active {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success-text);
}
.theme-app .btn-outline-warning {
  background: var(--surface);
  border-color: var(--warning-border);
  color: var(--warning-text);
}
.theme-app .btn-outline-warning:hover,
.theme-app .btn-outline-warning:not(:disabled):not(.disabled):active {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning-text);
}
.theme-app .btn-outline-danger {
  background: var(--surface);
  border-color: var(--danger-border);
  color: var(--danger-text);
}
.theme-app .btn-outline-danger:hover,
.theme-app .btn-outline-danger:not(:disabled):not(.disabled):active {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}
.theme-app .btn-link { color: var(--accent); font-weight: 600; box-shadow: none; }
.theme-app .btn-link:hover { color: var(--accent-hover); }

/* ==========================================================
   Text & background utilities — semantic colours
   ========================================================== */
.theme-app .text-primary,
.theme-app a.text-primary { color: var(--accent) !important; }
.theme-app .text-info { color: var(--info-text) !important; }
.theme-app .text-success { color: var(--success-text) !important; }
.theme-app .text-warning { color: var(--warning-text) !important; }
.theme-app .text-danger { color: var(--danger) !important; }
.theme-app .text-dark { color: var(--heading) !important; }
.theme-app .text-secondary { color: var(--text-secondary) !important; }
.theme-app .text-muted { color: var(--text-muted) !important; }

.theme-app .bg-primary,
.theme-app .bg-gradient-primary { background: var(--accent) !important; color: #fff; }
.theme-app .bg-info,
.theme-app .bg-gradient-info { background: var(--info-bg) !important; color: var(--info-text); }
.theme-app .bg-success,
.theme-app .bg-gradient-success { background: var(--success-strong) !important; color: #fff; }
.theme-app .bg-warning,
.theme-app .bg-gradient-warning { background: var(--warning) !important; color: var(--ifp-navy); }
.theme-app .bg-danger,
.theme-app .bg-gradient-danger { background: var(--danger) !important; color: #fff; }
.theme-app .bg-dark { background: var(--ifp-navy) !important; color: #fff; }
.theme-app .bg-light { background: var(--surface-muted) !important; }
.theme-app .border-primary { border-color: var(--accent) !important; }
.theme-app .border-success { border-color: var(--success) !important; }
.theme-app .border-warning { border-color: var(--warning) !important; }
.theme-app .border-danger { border-color: var(--danger) !important; }
.theme-app code { color: var(--info-text); }

/* ==========================================================
   Badges — always paired with a text label
   ========================================================== */
.theme-app .badge {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .01em;
  vertical-align: middle;
}
.theme-app .badge-pill { border-radius: 999px; }
.theme-app .badge-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.theme-app .badge-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.theme-app .badge-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.theme-app .badge-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.theme-app .badge-danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }
.theme-app .badge-secondary,
.theme-app .badge-light { background: var(--neutral-bg); color: var(--neutral-text); border-color: var(--neutral-border); }
.theme-app .badge-dark { background: var(--ifp-navy); color: #fff; border-color: var(--ifp-navy); }
.theme-app a.badge:hover { text-decoration: none; filter: brightness(.97); }

/* ==========================================================
   Alerts
   ========================================================== */
.theme-app .alert {
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}
.theme-app .alert-success { background: var(--success-bg); border-color: var(--success-border); border-left-color: var(--success); color: var(--success-text); }
.theme-app .alert-info,
.theme-app .alert-primary { background: var(--info-bg); border-color: var(--info-border); border-left-color: var(--info); color: var(--info-text); }
.theme-app .alert-warning { background: var(--warning-bg); border-color: var(--warning-border); border-left-color: var(--warning); color: var(--warning-text); }
.theme-app .alert-danger { background: var(--danger-bg); border-color: var(--danger-border); border-left-color: var(--danger); color: var(--danger-text); }
.theme-app .alert-secondary,
.theme-app .alert-light,
.theme-app .alert-dark { background: var(--surface-muted); border-color: var(--border); border-left-color: var(--neutral); color: var(--text); }
.theme-app .alert .alert-link { color: inherit; font-weight: 700; text-decoration: underline; }
.theme-app .alert .close { color: inherit; opacity: .6; text-shadow: none; }
.theme-app .alert .close:hover { opacity: 1; }

/* ==========================================================
   Pagination (Laravel + DataTables)
   ========================================================== */
.theme-app .pagination {
  margin-top: 1rem;
  margin-bottom: 0;
  flex-wrap: wrap;
  gap: 4px;
}
.theme-app .page-link {
  min-width: 32px;
  padding: 0.35rem 0.65rem;
  margin-left: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md) !important;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.25;
  text-align: center;
}
.theme-app .page-link:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--heading);
}
.theme-app .page-link:focus { box-shadow: var(--focus-ring); }
.theme-app .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.theme-app .page-item.disabled .page-link {
  color: var(--text-placeholder);
  background: var(--surface);
  border-color: var(--border-light);
}

/* Safety: if any Tailwind pagination view is rendered without Tailwind CSS, do not let SVGs explode */
.theme-app nav[role="navigation"] svg.w-5,
.theme-app nav[role="navigation"] svg.h-5,
.theme-app .pagination svg {
  width: 1rem !important;
  height: 1rem !important;
  max-width: 1rem;
  max-height: 1rem;
  display: inline-block;
  vertical-align: middle;
}

/* ==========================================================
   Tables
   ========================================================== */
.theme-app .table th,
.theme-app .table td {
  padding: .65rem .85rem;
  vertical-align: middle;
  border-top-color: var(--divider);
}
.theme-app .table thead th {
  background: var(--surface-muted);
  color: var(--text-secondary);
  border-top: 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.theme-app .table-sm th,
.theme-app .table-sm td { padding: .4rem .6rem; }
.theme-app .table-bordered,
.theme-app .table-bordered th,
.theme-app .table-bordered td { border-color: var(--divider); }
.theme-app .table-bordered { border-color: var(--border); }
.theme-app .table-bordered thead th,
.theme-app .table-bordered thead td { border-bottom-width: 1px; border-bottom-color: var(--border); }
.theme-app .table-striped tbody tr:nth-of-type(odd) { background: var(--surface-muted); }
.theme-app .table-hover tbody tr:hover,
.app-content .table tbody tr:hover { background: var(--row-hover); color: inherit; }
.theme-app .table tfoot th,
.theme-app .table tfoot td { background: var(--surface-muted); font-weight: 600; color: var(--heading); }
.theme-app .table .thead-dark th { background: var(--ifp-navy); color: #fff; border-color: var(--ifp-navy-700); }
.theme-app .table .thead-light th { background: var(--surface-muted); color: var(--text-secondary); }
.theme-app .table-active,
.theme-app .table-active > td,
.theme-app .table-active > th { background: var(--ifp-blue-50); }
.theme-app .table-success, .theme-app .table-success > td { background: var(--success-bg); }
.theme-app .table-warning, .theme-app .table-warning > td { background: var(--warning-bg); }
.theme-app .table-danger, .theme-app .table-danger > td { background: var(--danger-bg); }
.theme-app .table-info, .theme-app .table-info > td { background: var(--info-bg); }
/* "No records" rows */
.app-content .table td[colspan].text-center { padding: 24px 16px; color: var(--text-secondary); }

/* DataTables chrome */
.theme-app .dataTables_wrapper .dataTables_length,
.theme-app .dataTables_wrapper .dataTables_filter,
.theme-app .dataTables_wrapper .dataTables_info {
  font-size: var(--fs-md);
  color: var(--text-secondary);
}
.theme-app .dataTables_wrapper .dataTables_length select,
.theme-app .dataTables_wrapper .dataTables_filter input {
  height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
}
.theme-app .dataTables_wrapper .dataTables_length select { width: 72px; padding-right: 24px; }
.theme-app .dataTables_wrapper .dataTables_filter input { min-width: 200px; margin-left: 6px; }
.theme-app .dataTables_wrapper .dataTables_length select:focus,
.theme-app .dataTables_wrapper .dataTables_filter input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.theme-app .dataTables_wrapper .dataTables_info { padding-top: .85rem; }
.theme-app .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.theme-app .dataTables_wrapper .dataTables_processing {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--heading);
  font-weight: 600;
}
.theme-app table.dataTable td.dataTables_empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface);
}
.theme-app table.dataTable thead .sorting::before,
.theme-app table.dataTable thead .sorting::after,
.theme-app table.dataTable thead .sorting_asc::before,
.theme-app table.dataTable thead .sorting_asc::after,
.theme-app table.dataTable thead .sorting_desc::before,
.theme-app table.dataTable thead .sorting_desc::after { color: var(--text-secondary); }
.theme-app table.dataTable thead .sorting_asc,
.theme-app table.dataTable thead .sorting_desc { color: var(--heading); }
.theme-app .dt-buttons .btn { margin-right: 4px; }

/* ==========================================================
   Forms & filters
   ========================================================== */
.theme-app .form-control,
.theme-app .custom-select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.theme-app input.form-control:not([type="file"]):not(.form-control-sm):not(.form-control-lg),
.theme-app select.form-control:not([multiple]):not([size]):not(.form-control-sm):not(.form-control-lg),
.theme-app .custom-select:not([multiple]):not([size]):not(.custom-select-sm):not(.custom-select-lg) {
  height: var(--control-height);
}
.theme-app .form-control:hover:not(:disabled):not([readonly]),
.theme-app .custom-select:hover:not(:disabled) { border-color: #AEBACB; }
.theme-app .form-control:focus,
.theme-app .custom-select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  color: var(--text);
}
.theme-app .form-control:disabled,
.theme-app .form-control[readonly],
.theme-app .custom-select:disabled {
  background-color: var(--surface-muted);
  color: var(--text-secondary);
}
.theme-app .form-control.is-invalid,
.theme-app .custom-select.is-invalid,
.theme-app .was-validated .form-control:invalid { border-color: var(--danger); }
.theme-app .form-control.is-invalid:focus,
.theme-app .custom-select.is-invalid:focus,
.theme-app .was-validated .form-control:invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); }
.theme-app .form-control.is-valid,
.theme-app .was-validated .form-control:valid { border-color: var(--success); }
.theme-app .invalid-feedback { color: var(--danger-text); font-weight: 500; }
.theme-app .valid-feedback { color: var(--success-text); font-weight: 500; }
.theme-app label { margin-bottom: .35rem; }
.theme-app .input-group-text {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.theme-app .input-group > .form-control:focus { z-index: 3; }
.theme-app .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--accent);
  border-color: var(--accent);
}
.theme-app .custom-control-input:focus ~ .custom-control-label::before { box-shadow: var(--focus-ring); }
.theme-app .custom-control-input:focus:not(:checked) ~ .custom-control-label::before { border-color: var(--accent); }
.theme-app input[type="checkbox"],
.theme-app input[type="radio"],
.theme-app input[type="range"] { accent-color: var(--accent); }
.theme-app .custom-file-label { border-color: var(--border-strong); border-radius: var(--radius-md); }
.theme-app .form-text { color: var(--text-secondary); }

/* Select2 */
.theme-app .select2-container--default .select2-selection--single,
.theme-app .select2-container--default .select2-selection--multiple {
  font-family: var(--font);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  min-height: var(--control-height);
}
.theme-app .select2-container--default .select2-selection--single { height: var(--control-height); }
.theme-app .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: calc(var(--control-height) - 2px); padding-left: 12px; }
.theme-app .select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(var(--control-height) - 2px); }
.theme-app .select2-container--default.select2-container--focus .select2-selection--multiple,
.theme-app .select2-container--default.select2-container--focus .select2-selection--single,
.theme-app .select2-container--default.select2-container--open .select2-selection--single,
.theme-app .select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.theme-app .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--ifp-blue-50);
  border: 1px solid var(--ifp-blue-100);
  border-radius: var(--radius-sm);
  color: var(--info-text);
}
.theme-app .select2-dropdown {
  border-color: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.theme-app .select2-container--default .select2-results__option--highlighted[aria-selected],
.theme-app .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--accent);
  color: #fff;
}
.theme-app .select2-container--default .select2-search--dropdown .select2-search__field {
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ==========================================================
   Modals, tabs, list groups, progress
   ========================================================== */
.theme-app .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.theme-app .modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--divider);
  align-items: center;
}
.theme-app .modal-title { color: var(--heading); }
.theme-app .modal-body { padding: 20px; }
.theme-app .modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--divider);
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.theme-app .modal-backdrop { background-color: var(--ifp-navy); }
.theme-app .modal-backdrop.show { opacity: .45; }
.theme-app .close { color: var(--text-secondary); text-shadow: none; opacity: .8; }
.theme-app .close:hover { color: var(--heading); opacity: 1; }

.theme-app .nav-tabs { border-bottom: 1px solid var(--border); }
.theme-app .nav-tabs .nav-link {
  margin-bottom: -1px;
  padding: .6rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
}
.theme-app .nav-tabs .nav-link:hover { color: var(--heading); border-bottom-color: var(--border-strong); }
.theme-app .nav-tabs .nav-link.active,
.theme-app .nav-tabs .nav-item.show .nav-link {
  color: var(--accent);
  background: transparent;
  border-bottom-color: var(--accent);
}
.theme-app .nav-pills .nav-link { color: var(--text-secondary); font-weight: 600; border-radius: var(--radius-md); }
.theme-app .nav-pills .nav-link.active,
.theme-app .nav-pills .show > .nav-link { background: var(--accent); color: #fff; }

.theme-app .list-group-item { border-color: var(--divider); color: var(--text); }
.theme-app .list-group-item.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.theme-app .list-group-item-action:hover { background: var(--surface-muted); }

.theme-app .progress { background: var(--track); border-radius: 999px; }
.theme-app .progress-bar { background-color: var(--accent); }

/* Keyboard focus visibility */
.theme-app a:focus-visible,
.theme-app button:focus-visible,
.theme-app [role="button"]:focus-visible,
.theme-app [tabindex]:focus-visible,
.theme-app summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-app .form-control:focus-visible,
.theme-app .custom-select:focus-visible { outline: 0; }

.theme-app .btn,
.theme-app .drawer-close,
.theme-app .topbar-icon-btn {
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.theme-app .btn:active,
.theme-app .drawer-close:active {
  transform: scale(.98);
}

/* ---------- Home dashboard visuals ---------- */
.dashboard-section .section-heading { margin-bottom: 20px; }
.dashboard-section .section-heading h2 {
  margin: 0 0 4px;
  font-size: var(--fs-2xl);
  font-weight: 700;
}
.subsection-title {
  font-size: var(--fs-md);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  font-weight: 700;
  margin: 0 0 12px;
}

.inventory-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.summary-card { padding: 20px; }
.summary-card .label {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-secondary);
  font-weight: 600;
}
.summary-card .value {
  font-size: var(--fs-4xl);
  font-weight: 700;
  margin-top: 6px;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}
.barrel-status-row { display: flex; flex-wrap: wrap; gap: 8px; }

.tank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tank-card { padding: 18px; }
.tank-card-body { display: flex; gap: 16px; align-items: flex-start; }
.tank-card-meta { flex: 1; min-width: 0; }
.tank-card-title { font-weight: 700; font-size: var(--fs-base); }
.tank-card-site { font-size: var(--fs-sm); margin-top: 2px; }
.tank-card-qty { font-size: var(--fs-md); margin: 8px 0; }
.tank-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Compact tank farm (dashboard — typically 6 fixed tanks) */
.tank-farm-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1199.98px) {
  .tank-farm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
  .tank-farm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.tank-compact-card {
  padding: 14px 12px;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.tank-compact-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--ifp-blue-200);
}
.tank-compact-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

/* ==========================================================================
   Industrial oil tank — shared PNG + oil fill by %
   Green ≥80% · Yellow 50–79.9% · Red <50%
   ========================================================================== */
.ind-tank {
  --tank-fill: var(--ifp-navy-700);
  width: 96px;
  margin: 0 auto;
  line-height: 0;
}
.ind-tank--high { --tank-fill: var(--ifp-navy-700); }
.ind-tank--mid  { --tank-fill: var(--ifp-navy-700); }
.ind-tank--low  { --tank-fill: var(--ifp-navy-700); }

.ind-tank-frame {
  position: relative;
  width: 96px;
  height: 96px;
  overflow: hidden;
}

/* Oil level behind transparent tank body */
.ind-tank-fill {
  display: block !important;
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 14%;
  height: var(--fill, 0%);
  max-height: 68%;
  background: var(--tank-fill);
  z-index: 1;
  transition: height 0.85s ease;
  pointer-events: none;
  border-radius: 0;
}

.ind-tank-fill-wave {
  display: none !important;
}

.ind-tank-img {
  position: relative;
  z-index: 2;
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  opacity: 1;
}

.tank-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 6px;
}
.badge-tank-status {
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
}
.badge-tank-status--high,
.badge-tank-high {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
  border-radius: 999px;
}
.badge-tank-status--mid,
.badge-tank-mid {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
  border-radius: 999px;
}
.badge-tank-status--low,
.badge-tank-low {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  border-radius: 999px;
}

.tank-bar--high .bar-fill { background: var(--success) !important; }
.tank-bar--mid .bar-fill  { background: var(--warning) !important; }
.tank-bar--low .bar-fill  { background: var(--danger) !important; }

.tank-compact-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
  min-height: 96px;
}
.tank-compact-title { font-weight: 700; font-size: var(--fs-base); }
.tank-compact-sub { font-size: var(--fs-sm); line-height: 1.3; }
.tank-compact-meta { text-align: center; }

/* Hide old CSS/SVG tank experiments */
.oil-tank-svg,
.ind-tank-rail,
.ind-tank-roof,
.ind-tank-shell,
.ind-tank-liquid,
.ind-tank-pipe,
.ind-tank-valve,
.ind-tank-ladder,
.ind-tank-base,
.ind-tank-hazard,
.ind-tank-rivets,
.tank-compact-cap,
.tank-cylinder { display: none !important; }

/* Barrel yard summary (dashboard) */
.barrel-segment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 991.98px) {
  .barrel-segment-grid { grid-template-columns: 1fr; }
}
.barrel-segment-card {
  padding: 16px;
}
.barrel-segment-card--wide {
  grid-column: 1 / -1;
}
.barrel-segment-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.barrel-segment-title { font-weight: 700; font-size: var(--fs-base); }
.barrel-segment-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  line-height: 0;
}
.barrel-segment-icon .ind-tank,
.barrel-segment-icon .ind-tank-frame,
.barrel-segment-icon .ind-tank-img {
  width: 64px;
  height: 64px;
}
.barrel-segment-icon .ind-tank { margin: 0; }
.barrel-segment-counts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.barrel-count-pill {
  flex: 1;
  min-width: 100px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.barrel-count-pill:hover {
  background: var(--bg);
  text-decoration: none;
}
.barrel-count-pill .count {
  display: block;
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.1;
}
.barrel-count-pill .label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.barrel-segment-hero-count {
  font-size: var(--fs-display);
  font-weight: 700;
  line-height: 1;
  margin: 8px 0 12px;
}
.barrel-segment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.barrel-category-rows {
  display: grid;
  gap: 6px;
}
.barrel-category-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}
.barrel-category-row:hover {
  background: var(--bg);
  text-decoration: none;
}
.barrel-category-name { font-size: var(--fs-md); font-weight: 600; }
.barrel-category-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.barrel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}
.barrel-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  text-align: center;
}
.barrel-visual { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.barrel-neck {
  width: 18px;
  height: 8px;
  border: 2px solid var(--border-light);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: var(--track);
}
.barrel-body {
  position: relative;
  width: 52px;
  height: 76px;
  border: 2px solid var(--border-light);
  border-radius: 4px 4px 14px 14px;
  overflow: hidden;
  background: var(--surface-muted);
}
.barrel-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  height: 0;
  transition: height 900ms var(--ease);
}
.barrel-code { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 6px; }
.barrel-qty { font-size: var(--fs-xs); margin-top: 4px; }

.drawer-gauge-row {
  display: flex;
  align-items: center;
  gap: 20px;
}
.drawer-stat-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-secondary);
  font-weight: 600;
}
.drawer-stat-value {
  font-size: var(--fs-xl);
  font-weight: 700;
}

.theme-app .container-fluid.page-enter > .row,
.theme-app .container-fluid.page-enter > .card {
  animation: fadeInUp var(--dur) var(--ease) both;
}

.table-card { animation: fadeInUp var(--dur) var(--ease) both; }

/* ---------- Barcode page (monochrome palette) ---------- */
.barcode-page .section-heading h2 { font-weight: 700; letter-spacing: -.01em; }
.barcode-workbench .card-header { background: var(--bg); }
.barcode-value-display {
  display: inline-block;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
}
.barcode-sticker {
  border: 1px dashed var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: left;
  min-height: 100%;
}
.barcode-sticker-name {
  font-size: var(--fs-md);
  margin: 0 0 8px;
  color: var(--text);
}
.barcode-sticker-svg { overflow: hidden; }
.barcode-sticker-svg svg { max-width: 100%; height: auto; }
.barcode-sticker-code {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 8px 0 0;
  letter-spacing: .02em;
  color: var(--text);
  word-break: break-all;
}

/* ---------- Nav progress (perceived performance) ---------- */
#nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 2000;
  opacity: 0;
  transition: width .25s var(--ease), opacity .2s var(--ease);
  pointer-events: none;
}
#nav-progress.is-active {
  opacity: 1;
  width: 78%;
}
#nav-progress.is-done {
  width: 100%;
  opacity: 0;
}

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 991.98px) {
  .app-topbar { padding: 0 12px; height: 56px; }
  .app-content { padding: 16px 12px; }
  .app-breadcrumb { padding: 10px 12px 0; overflow-x: auto; }
  .app-footer { padding: 14px 12px; }
  .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .kpi-card .value { font-size: var(--fs-3xl); }
  .app-content .card:has(> .card-body, > .card-header, > .card-footer, > .table-responsive, > .list-group) { padding: 0; }
  .app-content .card-body { padding: 14px; }
  .app-content .table-responsive,
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .form-row > [class*="col-"] { margin-bottom: 10px; }
  .btn-block-sm { display: block; width: 100%; }
  .topbar-profile .name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer { width: min(100vw, 420px); }
}

@media (max-width: 575.98px) {
  .kpi-grid { grid-template-columns: 1fr !important; }
  .app-content .btn { min-height: 40px; }
  .barcode-sticker { padding: 10px; }
}

/* Barrel passport timeline (page) */
.barrel-timeline .barrel-stage { border-left: 3px solid var(--border); }
.barrel-timeline .barrel-stage-verified { border-left-color: var(--success); background: var(--success-bg); }
.barrel-timeline .barrel-stage-current { border-left-color: var(--warning); }
.barrel-passport-header .progress { background: var(--track); border-radius: 4px; overflow: hidden; }
.barrel-passport-header .progress-bar { background: var(--accent); }

/* Tanker yard kanban board */
.tanker-yard-board .kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: flex-start;
}
.tanker-yard-board .kanban-column {
  flex: 0 0 240px;
  min-width: 220px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.tanker-yard-board .kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-weight: 600;
  font-size: var(--fs-md);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--heading);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.tanker-yard-board .kanban-column-body {
  min-height: 120px;
  padding: 8px;
}
.tanker-yard-board .kanban-column-body.is-drag-over {
  background: var(--ifp-blue-50);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.tanker-yard-board .kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s ease;
}
.tanker-yard-board .kanban-card:hover {
  box-shadow: var(--shadow-md);
}
.tanker-yard-board .kanban-card.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}
.tanker-yard-board .kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.tanker-yard-board .kanban-card-ref code { font-size: var(--fs-sm); }
.tanker-yard-board .kanban-card-vehicle { font-size: var(--fs-base); margin-bottom: 4px; }
.tanker-yard-board .kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.tanker-yard-board .kanban-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.tanker-yard-board .kanban-empty {
  text-align: center;
  padding: 16px 8px;
}

/* Tanker timeline (detail page) */
.tanker-timeline .tanker-stage { border-left: 3px solid var(--border); }
.tanker-timeline .tanker-stage-completed { border-left-color: var(--success); }
.tanker-timeline .tanker-stage-current { border-left-color: var(--warning); background: var(--warning-bg); }
.tanker-passport-header .progress { background: var(--track); border-radius: 4px; overflow: hidden; }
.tanker-passport-header .progress-bar { background: var(--accent); }

/* ---------- Trace journey right drawer (graphic overlay) ---------- */
.drawer.drawer-journey {
  width: min(420px, 40vw);
  max-width: 480px;
}
@media (max-width: 991.98px) {
  .drawer.drawer-journey {
    width: min(460px, 96vw);
    max-width: none;
  }
}
@media (min-width: 992px) {
  body.drawer-open .drawer-backdrop {
    pointer-events: none;
    background: transparent;
  }
  .drawer.drawer-journey.show {
    pointer-events: auto;
  }
  body.drawer-open {
    overflow: auto;
  }
}
.drawer-kicker {
  font-size: var(--fs-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.trace-journey-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.trace-journey-meta .meta-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.trace-journey-meta .meta-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
}
.trace-journey-meta .meta-value {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
}
.trace-journey-progress {
  margin-bottom: 20px;
}
.trace-journey-progress .bar-track {
  height: 6px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.trace-journey-progress .bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width var(--dur-slow) var(--ease);
}

/* Vertical path graphic: gate-in → departments → gate-out */
.trace-path {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
}
.trace-path::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 10px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--border) 70%);
  opacity: .55;
}
.trace-path-node {
  position: relative;
  padding: 0 0 18px 44px;
  opacity: 0;
  transform: translateX(10px);
  animation: slideInRight var(--dur-slow) var(--ease) both;
}
.trace-path-node:nth-child(1) { animation-delay: .05s; }
.trace-path-node:nth-child(2) { animation-delay: .1s; }
.trace-path-node:nth-child(3) { animation-delay: .15s; }
.trace-path-node:nth-child(4) { animation-delay: .2s; }
.trace-path-node:nth-child(5) { animation-delay: .25s; }
.trace-path-node:nth-child(6) { animation-delay: .3s; }
.trace-path-node:nth-child(7) { animation-delay: .35s; }
.trace-path-node:nth-child(8) { animation-delay: .4s; }
.trace-path-node:last-child { padding-bottom: 0; }

.trace-path-dot {
  position: absolute;
  left: 6px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  z-index: 1;
}
.trace-path-node.is-verified .trace-path-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.trace-path-node.is-current .trace-path-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent);
  animation: pulseDot 1.6s ease-in-out infinite;
}
.trace-path-node.is-pending .trace-path-dot {
  color: var(--text-secondary);
  background: var(--bg);
}

.trace-path-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 12px;
}
.trace-path-node.is-verified .trace-path-card {
  border-color: color-mix(in oklch, var(--accent) 35%, var(--border));
  background: var(--bg);
}
.trace-path-node.is-current .trace-path-card {
  border-color: var(--accent);
}
.trace-path-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.trace-path-title strong {
  font-size: var(--fs-md);
  line-height: 1.3;
}
.trace-path-org {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.trace-path-status {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  white-space: nowrap;
}
.trace-path-acts {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.trace-path-acts li {
  padding: 6px 0;
  border-top: 1px solid var(--divider);
  font-size: var(--fs-sm);
}
.trace-path-acts li:first-child { border-top: 0; padding-top: 0; }
.trace-path-acts .act-title { font-weight: 600; }
.trace-path-acts .act-meta {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  margin-top: 1px;
}
.trace-journey-empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--fs-md);
}
.trace-journey-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

@media (max-width: 991.98px) {
  .drawer.drawer-journey { width: min(100vw, 100%); }
}

/* Dashboard chart panels (local Chart.js) */
#panel-sales-purchases .card-body,
#panel-month-overview .card-body,
#panel-cashflow .card-body {
  background: var(--surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
#panel-sales-purchases canvas,
#panel-month-overview canvas,
#panel-cashflow canvas {
  max-height: 320px;
}

/* Bootstrap category / form modals must sit above theme drawer (1040/1041)
   and any leftover stacking from animated cards (fadeInUp uses transform). */
.theme-app .modal-backdrop {
  z-index: 2050 !important;
}
.theme-app .modal {
  z-index: 2060 !important;
}
.theme-app #categoryCreateModal {
  z-index: 2070 !important;
}
