/* ==========================================================================
   App shell — sidebar, topbar controls, footer, dark mode, responsive
   ========================================================================== */

:root {
  --cda-surface: #fff;
  --cda-border: #E2E6EA;
  --cda-sidebar-width: 240px;
  --cda-sidebar-width-collapsed: 64px;

  /* Brand + status colors. These are used unconditionally by the sidebar,
     topbar, and footer (not just inside the dark-theme block below), and
     login.php pulls them in too even though it never sets data-theme — so
     they must have real defaults here, not only dark-mode overrides. */
  --cda-navy-900: #0F2A47;
  --cda-navy-700: #17365D;
  --cda-navy-500: #2E5A8F;
  --cda-slate-100: #F4F6F8;
  --cda-slate-200: #E2E6EA;
  --cda-slate-400: #6B7684;
  --cda-ink: #1B2430;
  --cda-status-info: #2E6E8A;

  /* Semantic accent colors — reused by KPI cards, badges, and Chart.js */
  --cda-accent-verified: #1E8F5F;
  --cda-accent-verified-soft: rgba(30, 143, 95, .12);
  --cda-accent-critical: #B3261E;
  --cda-accent-critical-soft: rgba(179, 38, 30, .1);
  --cda-accent-warning: #C77D22;
  --cda-accent-warning-soft: rgba(199, 125, 34, .12);
  --cda-accent-info: #2E5F94;
  --cda-accent-info-soft: rgba(46, 95, 148, .1);
  --cda-accent-neutral: #4A5568;
  --cda-accent-neutral-soft: rgba(74, 85, 104, .08);

  /* Structural "section" colors for the reconciliation grid's grouped
     header bands (Vessel / ERP / Payment & Audit) — deliberately a
     different, cooler register from the semantic pass/fail accents above,
     so a colored column-group header is never mistaken for a variance
     warning inside a data cell. */
  --cda-band-vessel: #17365D;
  --cda-band-vessel-soft: rgba(23, 54, 93, .08);
  --cda-band-erp: #0F766E;
  --cda-band-erp-soft: rgba(15, 118, 110, .08);
  --cda-band-result: #6D28D9;
  --cda-band-result-soft: rgba(109, 40, 217, .08);

  --cda-shadow-sm: 0 1px 2px rgba(15, 42, 71, .06), 0 1px 1px rgba(15, 42, 71, .04);
  --cda-shadow-md: 0 6px 16px -4px rgba(15, 42, 71, .12), 0 2px 6px rgba(15, 42, 71, .06);
}

html {
  height: 100%;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }

body {
  min-height: 100%;
  background: var(--cda-slate-100);
  font-size: .9rem;
}

/* ---- Dark theme token overrides ------------------------------------- */
html[data-theme="dark"] {
  --cda-slate-100: #10161F;
  --cda-slate-200: #232B3A;
  --cda-slate-400: #8891A0;
  --cda-surface: #1A2130;
  --cda-border: #2A3242;
  --cda-ink: #E7EAEE;
  --cda-navy-900: #0F2A47;
  --cda-navy-700: #17365D;
}

html[data-theme="dark"] .cda-panel,
html[data-theme="dark"] .cda-kpi {
  background: var(--cda-surface);
  border: 1px solid var(--cda-border);
}
html[data-theme="dark"] {
  --cda-accent-verified-soft: rgba(30, 143, 95, .22);
  --cda-accent-critical-soft: rgba(179, 38, 30, .22);
  --cda-accent-warning-soft: rgba(199, 125, 34, .22);
  --cda-accent-info-soft: rgba(46, 95, 148, .22);
  --cda-accent-neutral-soft: rgba(154, 165, 177, .16);
  --cda-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --cda-shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
}
html[data-theme="dark"] .cda-kpi__progress-track { background: var(--cda-slate-200); }
html[data-theme="dark"] .cda-panel__eyebrow,
html[data-theme="dark"] .cda-section-heading__eyebrow { opacity: .7; }
html[data-theme="dark"] .cda-table tfoot td { background: var(--cda-slate-200); }
html[data-theme="dark"] .table { color: var(--cda-ink); }
html[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--cda-surface);
  color: var(--cda-ink);
  border-color: var(--cda-border);
}
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .table-light > * {
  background-color: var(--cda-slate-200) !important;
  color: var(--cda-ink) !important;
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  background-color: var(--cda-surface);
  color: var(--cda-ink);
  border-color: var(--cda-border);
}
html[data-theme="dark"] .form-control:focus { color: var(--cda-ink); }
html[data-theme="dark"] .form-control::placeholder { color: var(--cda-slate-400); }
html[data-theme="dark"] .dropdown-menu { background-color: var(--cda-surface); border-color: var(--cda-border); }
html[data-theme="dark"] .dropdown-item { color: var(--cda-ink); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background-color: var(--cda-slate-200); color: var(--cda-ink); }
html[data-theme="dark"] .dropdown-divider { border-color: var(--cda-border); }
html[data-theme="dark"] .alert-success { background: #163326; color: #7BD9A8; border-color: transparent; }
html[data-theme="dark"] .alert-danger  { background: #3A1A18; color: #F1948A; border-color: transparent; }
html[data-theme="dark"] .alert-warning { background: #3A2E13; color: #F0C674; border-color: transparent; }
html[data-theme="dark"] .text-muted { color: var(--cda-slate-400) !important; }
html[data-theme="dark"] body { background: var(--cda-slate-100); }
html[data-theme="dark"] .cda-footer { background: var(--cda-surface); }

/* ==========================================================================
   Shell — unified navy header + sidebar (Power BI-style app chrome), light
   canvas, and a slim footer. Header and sidebar share the same background
   and a hairline separator so they read as one continuous surface instead
   of two disconnected bars.
   ========================================================================== */
.cda-shell {
  display: flex;
  min-height: 100vh;
}

.cda-sidebar {
  width: var(--cda-sidebar-width);
  flex-shrink: 0;
  background: var(--cda-navy-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width .18s ease, transform .18s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1030;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.cda-sidebar__brand {
  height: 56px;
  padding: 0 1.1rem;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.cda-sidebar__brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--cda-navy-500), var(--cda-status-info));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: normal;
}

.cda-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .85rem .6rem;
}
.cda-sidebar__section {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  opacity: .45;
  padding: .9rem .6rem .35rem;
  white-space: nowrap;
}
.cda-sidebar__section:first-child { padding-top: .3rem; }
.cda-sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .65rem;
  border-radius: 7px;
  color: rgba(255, 255, 255, .75);
  text-decoration: none;
  font-size: .87rem;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: .15rem;
  transition: background .15s ease, color .15s ease;
}
.cda-sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.cda-sidebar__link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.cda-sidebar__link.is-active {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-weight: 600;
}
.cda-sidebar__link.is-active::before {
  content: "";
  position: absolute;
  left: -.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--cda-status-info);
}
.cda-sidebar__label { overflow: hidden; text-overflow: ellipsis; }

/* Collapsed state (desktop) — icon rail only */
html.is-sidebar-collapsed .cda-sidebar { width: var(--cda-sidebar-width-collapsed); }
html.is-sidebar-collapsed .cda-sidebar__label,
html.is-sidebar-collapsed .cda-sidebar__section,
html.is-sidebar-collapsed .cda-sidebar__brand-text { display: none; }
html.is-sidebar-collapsed .cda-sidebar__brand { justify-content: center; padding: 0 .5rem; }
html.is-sidebar-collapsed .cda-sidebar__link { justify-content: center; }
html.is-sidebar-collapsed .cda-sidebar__link.is-active::before { left: -.1rem; }

.cda-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ------------------------------------------------------------ */
.cda-sidebar-toggle {
  background: rgba(255, 255, 255, .1);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease;
}
.cda-sidebar-toggle:hover { background: rgba(255, 255, 255, .2); }
.cda-sidebar-toggle svg { width: 18px; height: 18px; }

.cda-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: nowrap;
  height: 56px;
  padding: 0 1.25rem;
  background: var(--cda-navy-900);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 2px 6px rgba(15, 42, 71, .18);
  position: sticky;
  top: 0;
  z-index: 1020;
  flex-shrink: 0;
}
.cda-appbar__left { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.cda-appbar__right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.cda-appbar__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .02em;
  color: #fff;
  line-height: 1.25;
}
.cda-appbar__title small {
  display: block;
  font-weight: 400;
  font-size: .72rem;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(255, 255, 255, .65);
}

/* ---- Net status pill ---------------------------------------------------- */
.cda-net-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.cda-net-status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cda-slate-400);
  flex-shrink: 0;
}
.cda-net-status.is-online .cda-net-status__dot { background: #37B24D; box-shadow: 0 0 0 3px rgba(55, 178, 77, .25); }
.cda-net-status.is-offline .cda-net-status__dot { background: #E03131; box-shadow: 0 0 0 3px rgba(224, 49, 49, .25); }
.cda-net-status.is-syncing .cda-net-status__dot { background: #F0B429; box-shadow: 0 0 0 3px rgba(240, 180, 41, .25); animation: cda-pulse 1.2s ease-in-out infinite; }
@keyframes cda-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ---- Small pill badge (role labels, status tags) ------------------------ */
.cda-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.cda-badge--info { background: rgba(46, 110, 138, .12); color: var(--cda-status-info); }

.cda-theme-switch {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  user-select: none;
  font-size: .78rem;
  margin: 0;
}
.cda-theme-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cda-theme-switch__track {
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  position: relative;
  transition: background .2s ease;
  flex-shrink: 0;
}
.cda-theme-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.cda-theme-switch input:checked ~ .cda-theme-switch__track { background: var(--cda-status-info); }
.cda-theme-switch input:checked ~ .cda-theme-switch__track .cda-theme-switch__thumb { transform: translateX(18px); }

.cda-lang-select {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: .78rem;
  padding: .35rem .5rem;
}
.cda-lang-select option { color: #111; }

.cda-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .3);
}
.cda-avatar-btn { padding-left: .4rem; padding-right: .6rem; }

.cda-avatar--lg {
  width: 72px;
  height: 72px;
  border: 2px solid var(--cda-navy-700, #17365D);
}

.cda-footer {
  padding: .8rem 1.25rem;
  font-size: .78rem;
  color: var(--cda-slate-400);
  background: #fff;
  border-top: 1px solid var(--cda-slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

/* ---- Mobile off-canvas sidebar ----------------------------------------- */
.cda-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 1020;
}

@media (max-width: 900px) {
  .cda-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    width: 250px;
  }
  html[dir="rtl"] .cda-sidebar { left: auto; right: 0; transform: translateX(100%); }

  html.is-sidebar-open .cda-sidebar { transform: translateX(0); }
  html.is-sidebar-open .cda-sidebar-backdrop { display: block; }

  /* "Collapsed" is a desktop-only concept; ignore it on mobile so the
     off-canvas sidebar always shows full labels when opened. */
  html.is-sidebar-collapsed .cda-sidebar { width: 250px; }
  html.is-sidebar-collapsed .cda-sidebar__label,
  html.is-sidebar-collapsed .cda-sidebar__section,
  html.is-sidebar-collapsed .cda-sidebar__brand-text { display: block; }
  html.is-sidebar-collapsed .cda-sidebar__brand { justify-content: flex-start; padding: 0 1.1rem; }
  html.is-sidebar-collapsed .cda-sidebar__link { justify-content: flex-start; }

  .cda-appbar__title small { display: none; }
  .cda-lang-select { display: none; }
}

@media (max-width: 560px) {
  .cda-appbar { padding: 0 .65rem; }
  .cda-appbar__title { font-size: .82rem; }
  #cda-net-status-label { display: none; }
  .cda-footer { padding: .7rem 1rem; font-size: .72rem; }
}
/* ==========================================================================
   Dashboard — section headings, KPI cards, and chart panels
   ========================================================================== */

.cda-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.6rem 0 .75rem;
}
.cda-section-heading:first-of-type { margin-top: 0; }
.cda-section-heading__eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cda-status-info);
  margin: 0 0 .15rem;
}
.cda-section-heading__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cda-ink);
  margin: 0;
}
.cda-section-heading__meta {
  font-size: .76rem;
  color: var(--cda-slate-400);
}

/* ---- Page header ---------------------------------------------------- */
.cda-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .85rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--cda-border);
}
.cda-page-header__title {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--cda-ink);
  margin: 0 0 .3rem;
  letter-spacing: -.01em;
}
.cda-page-header__subtitle {
  font-size: .82rem;
  color: var(--cda-slate-400);
  margin: 0;
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.cda-page-header__subtitle svg { width: 14px; height: 14px; flex-shrink: 0; }
.cda-page-header__actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }

.cda-live-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .28rem .65rem .28rem .55rem;
  border-radius: 999px;
  background: var(--cda-accent-verified-soft);
  color: var(--cda-accent-verified);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.cda-live-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--cda-accent-verified-soft);
  animation: cda-pulse 1.6s ease-in-out infinite;
}

.cda-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .95rem;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cda-navy-700), var(--cda-navy-900));
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  box-shadow: var(--cda-shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease;
}
.cda-btn-primary:hover { color: #fff; box-shadow: var(--cda-shadow-md); transform: translateY(-1px); }
.cda-btn-primary svg { width: 15px; height: 15px; }

/* ---- KPI cards -------------------------------------------------------- */
.cda-kpi {
  position: relative;
  height: 100%;
  background: var(--cda-surface);
  border: 1px solid var(--cda-border);
  border-radius: 14px;
  padding: 1rem 1.05rem 1.05rem;
  box-shadow: var(--cda-shadow-sm);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
  --cda-kpi-accent: var(--cda-accent-neutral);
  --cda-kpi-accent-soft: var(--cda-accent-neutral-soft);
}
.cda-kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cda-kpi-accent);
  opacity: .85;
}
.cda-kpi:hover {
  box-shadow: var(--cda-shadow-md);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cda-kpi-accent) 35%, var(--cda-border));
}
.cda-kpi__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .65rem;
}
.cda-kpi__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cda-kpi-accent-soft);
  color: var(--cda-kpi-accent);
}
.cda-kpi__icon svg { width: 16px; height: 16px; }
.cda-kpi__label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cda-slate-400);
  line-height: 1.3;
}
.cda-kpi__value {
  font-size: 1.36rem;
  font-weight: 800;
  color: var(--cda-ink);
  letter-spacing: -.01em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}
.cda-kpi__foot {
  margin-top: .5rem;
  font-size: .72rem;
  color: var(--cda-slate-400);
}
.cda-kpi--variant-verified { --cda-kpi-accent: var(--cda-accent-verified); --cda-kpi-accent-soft: var(--cda-accent-verified-soft); }
.cda-kpi--variant-critical { --cda-kpi-accent: var(--cda-accent-critical); --cda-kpi-accent-soft: var(--cda-accent-critical-soft); }
.cda-kpi--variant-warning  { --cda-kpi-accent: var(--cda-accent-warning);  --cda-kpi-accent-soft: var(--cda-accent-warning-soft); }
.cda-kpi--variant-info     { --cda-kpi-accent: var(--cda-accent-info);     --cda-kpi-accent-soft: var(--cda-accent-info-soft); }

/* Mini progress bar used inside a KPI card to show a share of a total */
.cda-kpi__progress-track {
  margin-top: .55rem;
  height: 5px;
  border-radius: 999px;
  background: var(--cda-slate-200);
  overflow: hidden;
}
.cda-kpi__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--cda-kpi-accent);
  transition: width .5s ease;
}

/* ---- Chart / content panels -------------------------------------------- */
.cda-panel {
  background: var(--cda-surface);
  border: 1px solid var(--cda-border);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1.2rem;
  box-shadow: var(--cda-shadow-sm);
}
.cda-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .9rem;
}
.cda-panel__heading { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.cda-panel__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--cda-slate-100);
  color: var(--cda-navy-700);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cda-panel__icon svg { width: 15px; height: 15px; }
.cda-panel__title {
  font-size: .84rem;
  font-weight: 700;
  color: var(--cda-ink);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cda-panel__eyebrow {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cda-slate-400);
  margin: 0;
}
html[data-theme="dark"] .cda-panel__icon { background: var(--cda-slate-200); color: #fff; }

/* ---- Status legend list (verification / payment breakdown) ------------- */
.cda-legend-list { list-style: none; margin: 0; padding: 0; }
.cda-legend-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--cda-border);
  font-size: .8rem;
}
.cda-legend-list li:last-child { border-bottom: none; padding-bottom: 0; }
.cda-legend-list__label { display: flex; align-items: center; gap: .55rem; color: var(--cda-ink); min-width: 0; }
.cda-legend-list__dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.cda-legend-list__value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cda-ink); flex-shrink: 0; }
.cda-legend-list__bar-track {
  flex: 1 1 auto;
  height: 5px;
  border-radius: 999px;
  background: var(--cda-slate-200);
  margin: 0 .1rem;
  overflow: hidden;
  min-width: 30px;
}
.cda-legend-list__bar-fill { height: 100%; border-radius: 999px; }

/* Badge color variants (verification / payment status chips) */
.cda-badge--verified { background: var(--cda-accent-verified-soft); color: var(--cda-accent-verified); }
.cda-badge--critical  { background: var(--cda-accent-critical-soft); color: var(--cda-accent-critical); }
.cda-badge--warning   { background: var(--cda-accent-warning-soft);  color: var(--cda-accent-warning); }

@media (max-width: 560px) {
  .cda-page-header__title { font-size: 1.08rem; }
  .cda-kpi__value { font-size: 1.16rem; }
}

/* ---- Import page: template picker, dropzone, result panel (Imports::form) ---- */
.cda-panel__icon--success { background: var(--cda-accent-verified-soft); color: var(--cda-accent-verified); }
.cda-panel__icon--warning { background: var(--cda-accent-warning-soft);  color: var(--cda-accent-warning); }
.cda-panel__icon--critical { background: var(--cda-accent-critical-soft); color: var(--cda-accent-critical); }
.cda-panel__icon--info    { background: var(--cda-accent-info-soft);     color: var(--cda-accent-info); }

.cda-template-card {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem .9rem;
  border: 1px solid var(--cda-border);
  border-radius: 12px;
  background: var(--cda-slate-100);
  transition: border-color .15s ease, background .15s ease;
}
.cda-template-card + .cda-template-card { margin-top: .65rem; }
.cda-template-card:hover { border-color: var(--cda-navy-500); }
.cda-template-card__icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cda-accent-info-soft);
  color: var(--cda-accent-info);
}
.cda-template-card__icon svg { width: 18px; height: 18px; }
.cda-template-card__body { flex: 1 1 auto; min-width: 0; }
.cda-template-card__title { font-size: .85rem; font-weight: 700; color: var(--cda-ink); margin: 0 0 .15rem; }
.cda-template-card__desc { font-size: .74rem; color: var(--cda-slate-400); margin: 0; line-height: 1.4; }
.cda-template-card__action { flex-shrink: 0; }
html[data-theme="dark"] .cda-template-card { background: var(--cda-slate-200); }

.cda-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: 1.35rem 1rem;
  border: 1.5px dashed var(--cda-border);
  border-radius: 12px;
  background: var(--cda-slate-100);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.cda-dropzone:hover, .cda-dropzone.is-dragover { border-color: var(--cda-navy-500); background: var(--cda-accent-info-soft); }
.cda-dropzone__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cda-surface);
  color: var(--cda-navy-700);
  box-shadow: var(--cda-shadow-sm);
}
.cda-dropzone__icon svg { width: 17px; height: 17px; }
.cda-dropzone__title { font-size: .8rem; font-weight: 700; color: var(--cda-ink); }
.cda-dropzone__hint { font-size: .7rem; color: var(--cda-slate-400); }
.cda-dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cda-dropzone__files { margin-top: .35rem; font-size: .72rem; color: var(--cda-navy-700); font-weight: 700; }
html[data-theme="dark"] .cda-dropzone { background: var(--cda-slate-200); }
html[data-theme="dark"] .cda-dropzone__icon { background: var(--cda-slate-100); }
html[data-theme="dark"] .cda-dropzone__files { color: var(--cda-ink); }

.cda-error-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--cda-border);
  border-radius: 10px;
  background: var(--cda-slate-100);
  padding: .6rem .8rem;
  margin: .5rem 0 0;
  list-style: none;
  font-size: .74rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--cda-accent-critical);
}
.cda-error-list li { padding: .22rem 0; border-bottom: 1px dashed var(--cda-border); }
.cda-error-list li:last-child { border-bottom: none; }
html[data-theme="dark"] .cda-error-list { background: var(--cda-slate-200); }

.cda-results-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }


/* ---------------------------------------------------------------------- */
/* Reconciliation Review — side-by-side "matched evidence" comparison,     */
/* modelled on plagiarism-checker matched-source panes but for Vessel      */
/* Distribution vs. ERP Posting evidence (spec §18-19).                    */
/* ---------------------------------------------------------------------- */
.cda-compare-card {
  background: var(--cda-surface);
  border: 1px solid var(--cda-border);
  border-radius: 12px;
  box-shadow: var(--cda-shadow-sm);
  margin-bottom: .85rem;
  overflow: hidden;
}
.cda-compare-card__body { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .cda-compare-card__body { grid-template-columns: 1fr; } }

.cda-compare-side { padding: .85rem 1rem; }
.cda-compare-side--vessel { border-right: 1px solid var(--cda-border); }
@media (max-width: 860px) { .cda-compare-side--vessel { border-right: none; border-bottom: 1px solid var(--cda-border); } }
.cda-compare-side--missing {
  background: var(--cda-accent-critical-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cda-accent-critical);
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
  padding: 1.5rem 1rem;
}
.cda-compare-side__label {
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cda-slate-400);
  margin-bottom: .55rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.cda-compare-side__label .cda-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cda-compare-side--vessel .cda-dot { background: var(--cda-accent-info); }
.cda-compare-side--erp .cda-dot { background: var(--cda-accent-neutral); }

.cda-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .9rem; }
.cda-compare-field__label { font-size: .68rem; color: var(--cda-slate-400); margin: 0; }
.cda-compare-field__value {
  font-size: .82rem;
  font-weight: 600;
  color: var(--cda-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0 0 .35rem;
}
.cda-compare-field__value--match { color: var(--cda-accent-verified); }
.cda-compare-field__value--mismatch { color: var(--cda-accent-critical); font-weight: 800; }

.cda-compare-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.1rem;
  padding: .6rem 1rem;
  background: var(--cda-slate-100);
  border-top: 1px solid var(--cda-border);
}
html[data-theme="dark"] .cda-compare-card__footer { background: var(--cda-slate-200); }
.cda-compare-metric { font-size: .74rem; color: var(--cda-slate-400); white-space: nowrap; }
.cda-compare-metric strong { color: var(--cda-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cda-compare-metric strong.cda-metric-neg { color: var(--cda-accent-critical); }
.cda-compare-metric strong.cda-metric-pos { color: var(--cda-accent-verified); }

/* Standalone versions for the spreadsheet-style reconciliation table
   (app/Views/reconciliation/show.php) — variance cells colored directly,
   not nested inside a .cda-compare-metric wrapper like the old card view. */
.cda-metric-pos { color: var(--cda-accent-verified); }
.cda-metric-neg { color: var(--cda-accent-critical); font-weight: 600; }

/* Sticky-header spreadsheet table: bold grey TOTAL/FILTERED TOTAL row,
   matching the workbook's own total-row shading convention (light theme;
   the dark-theme equivalent is already defined near the top of this file). */
.cda-table tfoot td {
  background: var(--cda-slate-100);
  border-top: 2px solid var(--cda-navy-500, var(--cda-navy-700));
}

/* ---- Excel-style gridlined reconciliation table ------------------------
   Full cell borders (so it reads as a spreadsheet, not a plain striped
   list), a two-row grouped header banding Vessel Distribution / ERP
   Posting / Payment & Audit Result in distinct colors, and a thick double
   rule at each section boundary so the eye immediately sees where one
   source's data ends and the next begins — the layout question a first-time
   viewer actually has ("which columns came from where?"). */

/* A dedicated, more visible gridline color — deliberately more visible than
   --cda-border (#E2E6EA), which is used for panel/card outlines and reads
   as too faint once it's the ONLY thing separating dozens of small data
   cells from each other, the way real spreadsheet gridlines are meant to. */
:root { --cda-grid-line: #B9C2CC; }
html[data-theme="dark"] { --cda-grid-line: #3A4356; }

.cda-recon-table {
  border-collapse: collapse !important;
}
.cda-recon-table th,
.cda-recon-table td {
  border: 1px solid var(--cda-grid-line) !important;
  padding: .4rem .55rem;
}
.cda-recon-table thead th {
  vertical-align: middle;
}
/* Every data cell gets its own subtle fill so it reads as a distinct
   spreadsheet cell rather than borders floating over a flat background —
   this is what actually makes it look "boxed" the way Excel cells do. */
.cda-recon-table tbody td {
  background: var(--cda-surface, #fff);
}
html[data-theme="dark"] .cda-recon-table tbody td {
  background: var(--cda-surface);
}

/* Group band row (row 1 of the header) — solid color, white bold text. */
.cda-band-vessel { background: var(--cda-band-vessel); color: #fff; }
.cda-band-erp    { background: var(--cda-band-erp);    color: #fff; }
.cda-band-result { background: var(--cda-band-result); color: #fff; }

/* Column-name row (row 2 of the header) — a light tint of the same group
   color, dark text for readability at small sizes. */
.cda-col-vessel { background: var(--cda-band-vessel-soft); }
.cda-col-erp    { background: var(--cda-band-erp-soft); }
.cda-col-result { background: var(--cda-band-result-soft); }

/* The double-thick section dividers themselves — applied to the LAST
   column of each group, on every row (both header rows, every body row,
   and the TOTAL row), so the rule runs unbroken top to bottom. */
.cda-divider-thick {
  border-right: 4px double var(--cda-ink) !important;
}

/* TOTAL row gets its own strong color rather than plain grey, so it reads
   as "the important summary line" at a glance, not just another row. */
.cda-recon-table tfoot td {
  background: #FEF3C7;
  color: var(--cda-ink);
  border-top: 3px solid var(--cda-band-result);
  font-weight: 700;
}
html[data-theme="dark"] .cda-recon-table tfoot td {
  background: rgba(109, 40, 217, .18);
}

.cda-compare-remark { font-size: .76rem; color: var(--cda-ink); flex: 1 1 260px; margin: 0; }

.cda-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-bottom: 1rem;
}
.cda-filter-bar .form-select, .cda-filter-bar .form-control { max-width: 220px; }
.cda-status-pill {
  border: 1px solid var(--cda-border);
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--cda-surface);
  color: var(--cda-ink);
  text-decoration: none;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}
.cda-status-pill.is-active { background: var(--cda-navy-900); color: #fff; border-color: var(--cda-navy-900); }
.cda-status-pill:hover { border-color: var(--cda-navy-500); text-decoration: none; }

.cda-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--cda-slate-400);
}

/* ---------------------------------------------------------------------- */
/* Dual-upload (side-by-side Vessel Distribution + ERP Ledger)             */
/* ---------------------------------------------------------------------- */
.cda-upload-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .cda-upload-columns { grid-template-columns: 1fr; } }
.cda-upload-col__heading {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  font-weight: 800;
  color: var(--cda-ink);
  margin-bottom: .6rem;
}
.cda-upload-col__heading .cda-dot { width: 8px; height: 8px; border-radius: 50%; }
/* ---- Super Admin: branding, users, role permissions (merged from
   cargo-audit-super-admin-patch, appended rather than replacing this file
   so every pre-existing rule above — reconciliation grid, dropzone,
   template cards, compare cards, etc. — is untouched). ---------------- */

.cda-sidebar__brand-logo {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 7px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

/* Branding & Appearance: logo preview + color picker row */
.cda-logo-preview {
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 1px solid var(--cda-border);
  background: var(--cda-slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cda-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.cda-logo-preview__mark { font-weight: 700; font-size: 1.4rem; color: var(--cda-navy-700); }
html[data-theme="dark"] .cda-logo-preview { background: var(--cda-slate-200); }

.cda-color-field { display: flex; align-items: center; gap: .6rem; }
.cda-color-field input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--cda-border);
  border-radius: 8px;
  background: var(--cda-surface);
  cursor: pointer;
}
.cda-color-field input[type="text"] { max-width: 130px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Manage Users / Role Permissions: compact active/inactive status pill.
   Deliberately BEM modifiers (--active/--inactive) rather than redeclaring
   the bare .cda-status-pill rule already defined above, so this can't
   collide with that existing (currently unused elsewhere, but not ours to
   touch) base style. */
.cda-status-pill--active { background: var(--cda-accent-verified-soft); color: var(--cda-accent-verified); }
.cda-status-pill--inactive { background: var(--cda-accent-neutral-soft); color: var(--cda-accent-neutral); }
.cda-status-pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Role Permissions: matrix table */
.cda-permission-matrix th, .cda-permission-matrix td { vertical-align: middle; }
.cda-permission-matrix thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--cda-slate-400); }
.cda-permission-matrix td.text-center, .cda-permission-matrix th.text-center { text-align: center; }
.cda-permission-matrix .form-check-input { width: 1.15em; height: 1.15em; cursor: pointer; }
.cda-permission-matrix__role-badge { font-size: .78rem; font-weight: 700; }

/* Login Slides admin: one row per slide — thumbnail, text fields, and
   reorder/remove controls. Mirrors .cda-logo-preview's thumbnail sizing. */
.cda-slide-row {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  padding: .9rem;
  border: 1px solid var(--cda-border);
  border-radius: 10px;
  margin-bottom: .75rem;
}
.cda-slide-row__thumb {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  border: 1px solid var(--cda-border);
  background: var(--cda-slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cda-slide-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cda-slide-row__thumb svg { width: 26px; height: 26px; color: var(--cda-slate-400); }
html[data-theme="dark"] .cda-slide-row__thumb { background: var(--cda-slate-200); }
.cda-slide-row__fields { flex: 1; min-width: 0; }
.cda-slide-row__controls {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex-shrink: 0;
}
.cda-slide-row__controls button {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--cda-border);
  background: var(--cda-surface);
  color: var(--cda-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cda-slide-row__controls button svg { width: 15px; height: 15px; }
.cda-slide-row__controls button:hover { background: var(--cda-slate-100); }
.cda-slide-row__controls button.cda-slide-row__remove:hover { background: var(--cda-accent-critical-soft); color: var(--cda-accent-critical); border-color: var(--cda-accent-critical); }

.cda-superadmin-note {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .7rem .9rem;
  border-radius: 10px;
  background: var(--cda-accent-info-soft);
  color: var(--cda-ink);
  font-size: .78rem;
  line-height: 1.5;
}
.cda-superadmin-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: .15rem; color: var(--cda-accent-info); }

/* ---- Excel-style grid tables (full cell borders, rows and columns) ----
   Opt-in via .cda-grid-table so existing borderless/striped .table usages
   elsewhere are completely unaffected. Used on the Payment Reconciliation
   screen's Orders overview, Payment Ledger, and installment schedule
   builder so they read like a spreadsheet with visible cells. ---------- */
.cda-grid-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}
.cda-grid-table th, .cda-grid-table td {
  border: 1px solid var(--cda-border);
  padding: .5rem .65rem;
  vertical-align: middle;
}
.cda-grid-table thead th {
  background: var(--cda-slate-100);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--cda-slate-400);
  font-weight: 700;
  white-space: nowrap;
}
.cda-grid-table tbody tr:hover { background: var(--cda-slate-100); }
html[data-theme="dark"] .cda-grid-table thead th { background: var(--cda-slate-200); }
html[data-theme="dark"] .cda-grid-table tbody tr:hover { background: var(--cda-slate-200); }

/* Compact variant for dense/nested grids (installment schedule builder and
   the ledger's expandable "full schedule" table). */
.cda-grid-table--compact th, .cda-grid-table--compact td {
  padding: .3rem .5rem;
  font-size: .8rem;
}
.cda-grid-table--compact input {
  border: none;
  background: transparent;
  width: 100%;
  padding: .1rem .2rem;
  font-size: .8rem;
}
.cda-grid-table--compact input:focus {
  outline: 2px solid var(--cda-navy-500);
  outline-offset: -1px;
  background: var(--cda-surface);
  border-radius: 3px;
}
.cda-grid-table--compact .btn-remove-row {
  border: none;
  background: transparent;
  color: var(--cda-accent-critical);
  font-weight: 700;
  line-height: 1;
  padding: 0 .3rem;
  cursor: pointer;
}
.cda-grid-table--compact .btn-remove-row:hover { background: var(--cda-accent-critical-soft); border-radius: 3px; }