/*
 * Deckhaul look ("A + B" mockup): gray canvas, white rounded cards, Deckhaul blue,
 * floating icon rail. Plain CSS on top of Filament's compiled theme, so no build step.
 */
:root {
  --dh-canvas: #eceef2;
  --dh-card: #ffffff;
  --dh-ink: #15171c;
  --dh-muted: #5f6673;
  --dh-line: #e7e9ee;
  --dh-blue: #0071e3;
  --dh-blue-soft: #e6f0fc;
  --dh-orange: #f39a3d;
  --dh-radius: 22px;
  --dh-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --dh-hero: linear-gradient(150deg, #0058b8 0%, #0071e3 55%, #5aa2f2 100%);
}
.dark {
  --dh-canvas: #0f1115;
  --dh-card: #181b21;
  --dh-ink: #f1f3f6;
  --dh-muted: #a3a9b4;
  --dh-line: #2a2e36;
  --dh-blue-soft: rgba(0, 113, 227, .18);
  --dh-shadow: none;
}

/* Canvas and layout */
.fi-body { background: var(--dh-canvas); }
.fi-main { padding-top: 6px; }

/* Floating sidebar card */
@media (min-width: 1024px) {
  .fi-sidebar { padding: 14px 0 14px 14px; background: transparent !important; box-shadow: none !important; }
  .fi-sidebar > * { background: var(--dh-card); }
  .fi-sidebar-header { border-radius: var(--dh-radius) var(--dh-radius) 0 0; background: var(--dh-card) !important; box-shadow: none !important; }
  .fi-sidebar-nav { border-radius: 0 0 var(--dh-radius) var(--dh-radius); background: var(--dh-card); box-shadow: var(--dh-shadow); }
}
.fi-sidebar-item-btn { border-radius: 14px; }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn { background: var(--dh-blue); }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon,
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label { color: #fff; }

/* Topbar blends into the canvas */
.fi-topbar { background: transparent !important; box-shadow: none !important; border: 0 !important; }
.fi-topbar > nav, .fi-topbar-ctn { background: transparent !important; box-shadow: none !important; }
.fi-global-search-field .fi-input-wrp { border-radius: 999px; background: var(--dh-card); }

/* Cards, sections, tables, widgets */
.fi-section, .fi-ta-ctn, .fi-wi-stats-overview-stat, .fi-wi-chart .fi-section, .fi-fo-repeater-item {
  border-radius: var(--dh-radius) !important;
  background: var(--dh-card);
  box-shadow: var(--dh-shadow) !important;
  --tw-ring-color: transparent;
}
.fi-section-header { padding-inline: 22px; }
.fi-header-heading { letter-spacing: -.02em; font-weight: 700; }

/* Pills: buttons, badges, tabs, inputs */
.fi-btn, .fi-badge, .fi-tabs-item, .fi-tabs { border-radius: 999px !important; }
.fi-input-wrp { border-radius: 12px; }
.fi-tabs { background: var(--dh-card); box-shadow: var(--dh-shadow); }
/* Tables: no overflow clipping on the card (it cut the Filters and Columns dropdowns); round the inner edges instead. */
.fi-ta-ctn { overflow: visible; }
.fi-ta-main { border-radius: inherit; min-width: 0; }
.fi-ta-header-ctn { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.fi-ta-main > :last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }

/* ---------- Dashboard widgets (custom views) ---------- */
.dh-card { background: var(--dh-card); border-radius: var(--dh-radius); padding: 20px; box-shadow: var(--dh-shadow); height: 100%; }
.dh-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dh-title { font-size: 15px; font-weight: 700; color: var(--dh-ink); margin: 0; }
.dh-sub, .dh-label { color: var(--dh-muted); font-size: 12px; font-weight: 600; }
.dh-link { color: var(--dh-blue); font-size: 12px; font-weight: 700; }
.dh-big { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 0; font-variant-numeric: tabular-nums; color: var(--dh-ink); }
.dh-big small { font-size: 13px; font-weight: 600; color: var(--dh-muted); letter-spacing: 0; }
.dh-num { font-variant-numeric: tabular-nums; }

.dh-hero { background: var(--dh-hero); color: #fff; }
.dh-hero .dh-label, .dh-hero .dh-big, .dh-hero .dh-big small { color: #fff; }
.dh-hero .dh-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .25); font-size: 13px; }

.dh-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dh-trend { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.dh-up { background: #e3f4ea; color: #138a4b; }
.dh-down { background: #fde7e7; color: #c62828; }

.dh-list { display: grid; }
.dh-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--dh-line); color: var(--dh-ink); }
.dh-item:last-child { border-bottom: 0; }
.dh-item .dh-grow { flex: 1; min-width: 0; }
.dh-item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-item span.dh-sub { display: block; }
.dh-amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dh-in { color: #138a4b; }
.dh-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.dh-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.dh-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dh-ok { background: #e3f4ea; color: #138a4b; }
.dh-info { background: var(--dh-blue-soft); color: var(--dh-blue); }
.dh-warn { background: #fdf0dc; color: #a15c00; }
.dh-bad { background: #fde7e7; color: #c62828; }
.dh-gray { background: rgba(107, 114, 128, .12); color: var(--dh-muted); }
.dh-empty { color: var(--dh-muted); font-size: 13px; padding: 8px 0; }

.dh-segbar { display: grid; grid-template-columns: repeat(40, 1fr); gap: 3px; margin: 14px 0 8px; }
.dh-segbar i { height: 22px; border-radius: 3px; background: var(--dh-line); }
.dh-segbar i.on { background: var(--dh-blue); }
.dh-segfoot { display: flex; justify-content: space-between; gap: 10px; color: var(--dh-muted); font-size: 12px; }
.dh-occ { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--dh-line); }
.dh-occ-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 56px; gap: 12px; align-items: center; color: var(--dh-ink); }
.dh-occ-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-track { position: relative; height: 12px; border-radius: 6px; background: var(--dh-line); }
.dh-track i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--dh-blue); }
.dh-track b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--dh-orange); border-radius: 1px; }
.dh-occ-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.dh-occ-val small { color: var(--dh-muted); font-weight: 600; }


.dh-split { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--dh-line); color: var(--dh-ink); }
.dh-pill-sm { margin-top: 4px; font-size: 11px; padding: 2px 8px; }
.dh-item .dh-grow .dh-pill { display: inline-flex; }

/* Solid Deckhaul blue for primary buttons */
.fi-btn.fi-color-primary:not(.fi-outlined) { background: var(--dh-blue) !important; color: #fff !important; }
.fi-btn.fi-color-primary:not(.fi-outlined):hover { background: #0058b8 !important; }
.fi-btn.fi-color-primary:not(.fi-outlined) .fi-icon { color: #fff !important; }

/* Dashboard: cards in the same row share one height (e.g. recent payments = weekly receipts). */
.fi-grid:has(> .fi-wi-widget) { align-items: stretch; }
.fi-wi-widget { display: flex; flex-direction: column; }
.fi-wi-widget > .dh-card, .fi-wi-widget > .dh-kpis, .fi-wi-widget > .fi-section { flex: 1; }
.fi-wi-chart > .fi-section { display: flex; flex-direction: column; }
.fi-wi-chart > .fi-section > .fi-section-content-ctn { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Topbar like the mockup: wide search on the left, then language, bell, initials ---------- */
.fi-topbar-end { flex: 1; gap: 12px; }
.fi-topbar-end > .fi-global-search, .fi-topbar-end > div:has(> .fi-global-search) { margin-inline-end: auto; flex: 1; max-width: 520px; }
.fi-global-search-field .fi-input-wrp { border-radius: 999px !important; background: var(--dh-card) !important; box-shadow: var(--dh-shadow); border: 0; --tw-ring-color: transparent; padding-block: 2px; }
.fi-global-search-field .fi-input { font-size: 15px; }
.dh-lang { display: flex; padding: 4px; border-radius: 999px; background: var(--dh-card); box-shadow: var(--dh-shadow); font-size: 13px; font-weight: 700; }
.dh-lang a { padding: 6px 10px; border-radius: 999px; color: var(--dh-muted); text-decoration: none; }
.dh-lang a.on { background: var(--dh-blue); color: #fff; }
.dh-lang a:not(.on):hover { color: var(--dh-blue); }
.fi-topbar-database-notifications-btn { width: 44px; height: 44px; border-radius: 50% !important; background: var(--dh-card) !important; box-shadow: var(--dh-shadow); }
.fi-user-menu-trigger .fi-avatar, .fi-user-avatar { width: 44px !important; height: 44px !important; }
@media (max-width: 640px) {
  .dh-lang a { padding: 5px 7px; }
  .fi-topbar-end > .fi-global-search, .fi-topbar-end > div:has(> .fi-global-search) { max-width: none; }
}

/* Content capped (90rem lists and dashboard, 64rem forms) and centered in the space beside the sidebar. */
.fi-main { margin-inline: auto !important; }
.fi-main.fi-width-7xl { max-width: 90rem !important; }

/* Logo: the PNG has a white background; multiply blends it into the gray canvas. */
.fi-logo { mix-blend-mode: multiply; }
.fi-simple-header .fi-logo, .fi-simple-page .fi-logo { height: 4.2rem !important; }
.fi-simple-main { border-radius: var(--dh-radius) !important; box-shadow: 0 10px 30px -18px rgba(16, 24, 40, .25) !important; }

/* ---------- Sidebar as one rounded card, full height, round logo on top (mockup rail) ---------- */
.dh-rail-logo { display: flex; justify-content: center; padding: 4px 0 18px; }
.dh-rail-logo img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 4px 14px -6px rgba(11, 42, 74, .45); }
.dh-rail-toggle { display: none; }
@media (min-width: 1024px) {
  /* Sidebar goes up to the top of the page; the topbar only covers the content area. */
  .fi-sidebar { top: 0 !important; height: 100dvh !important; margin-top: calc(-1 * var(--topbar-height, 4rem)); z-index: 31 !important; padding: 14px 0 14px 14px; }
  .fi-sidebar-header-ctn, .fi-topbar-start { display: none !important; }
  .fi-sidebar-nav { border-radius: var(--dh-radius) !important; padding-top: 22px; flex: 1; }
  .fi-sidebar-footer, .dh-rail-toggle { background: var(--dh-card); }
  .dh-rail-toggle { display: flex; justify-content: center; padding: 10px 0 14px; border-radius: 0 0 var(--dh-radius) var(--dh-radius); margin-top: -1px; }
  .dh-rail-toggle button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--dh-muted); background: transparent; border: 0; cursor: pointer; }
  .dh-rail-toggle button:hover { background: var(--dh-blue-soft); color: var(--dh-blue); }
  body:has(.dh-rail-toggle) .fi-sidebar-nav { border-radius: var(--dh-radius) var(--dh-radius) 0 0 !important; }

  /* Topbar starts after the sidebar and lines up with the page content (90rem, same side padding). */
  body:has(.fi-sidebar.fi-sidebar-open) .fi-topbar-ctn { padding-inline-start: var(--sidebar-width); }
  body:has(.fi-sidebar:not(.fi-sidebar-open)) .fi-topbar-ctn { padding-inline-start: var(--collapsed-sidebar-width); }
  .fi-topbar { max-width: 90rem; margin-inline: auto; padding-inline: 2rem !important; }

  /* Collapsed rail: smaller badge with room on both sides, round active item. */
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav { padding-inline: 10px !important; scrollbar-gutter: auto !important; }
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups { margin-inline: 0 !important; align-self: center; }
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-item { display: flex; justify-content: center; }
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-item-btn { width: 46px; height: 46px; padding: 0 !important; justify-content: center; }
  .fi-sidebar:not(.fi-sidebar-open) .dh-rail-logo img { width: 44px; height: 44px; }
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-item.fi-active > .fi-sidebar-item-btn { border-radius: 50%; }
}

/* Search results open right under the field, same width and left edge. */
.fi-global-search { position: relative; }
.fi-global-search-results-ctn { inset-inline: 0 !important; width: auto !important; max-width: none !important; border-radius: 18px !important; }
.fi-global-search-ctn, .fi-global-search { width: 100%; }

/* Two KPI cards side by side (received / expenses) */
.dh-kpis { height: 100%; }
.dh-kpis .dh-card { min-width: 0; }
.dh-big-sm { font-size: clamp(20px, 1.9vw, 26px); }
@media (max-width: 420px) { .dh-kpis { grid-template-columns: 1fr; } }
/* Narrow cards: keep heading and link on one line, tighter list amounts. */
.dh-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dh-link { white-space: nowrap; flex: none; }
.dh-item { gap: 8px; }
.dh-amt { font-size: 13px; }

/* Weekly receipts bar chart (SVG, like the mockup) */
.dh-chip { border: 1px solid var(--dh-line); border-radius: 999px; padding: 5px 10px; font-size: 12px; color: var(--dh-muted); white-space: nowrap; }
.dh-chart { display: block; margin-top: 6px; }
.dh-chart .dh-grid { stroke: var(--dh-line); stroke-width: 1; }
.dh-chart .dh-axis { fill: var(--dh-muted); font-size: 11px; font-family: inherit; }
.dh-chart .dh-bar { fill: #d6e6fb; }
.dark .dh-chart .dh-bar { fill: rgba(0, 113, 227, .25); }
.dh-chart .dh-bar-on { fill: url(#dh-bar-on); }
.dh-chart .dh-pill-bg { fill: var(--dh-blue); }
.dh-chart .dh-pill-text { fill: #fff; font-size: 11px; font-weight: 600; font-family: inherit; }
/* Lists never grow past their card: names shrink with an ellipsis, amounts stay inside. */
.dh-list { grid-template-columns: minmax(0, 1fr); }
.dh-item { min-width: 0; }
.dh-amt { flex: none; }
/* Sticky topbar keeps the canvas color so content doesn't show through while scrolling. */
.fi-topbar-ctn { background: var(--dh-canvas) !important; }
.dh-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.dh-end .dh-pill-sm { margin-top: 0; }
/* Show the full name (wraps instead of "…"); the list column already keeps amounts inside. */
.dh-item b { white-space: normal; overflow-wrap: anywhere; }

/* Lists: line 1 = name (one line) [+ status], line 2 = details + amount */
.dh-item { align-items: flex-start; }
.dh-item .dh-avatar { margin-top: 2px; }
.dh-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.dh-line + .dh-line { margin-top: 2px; }
.dh-line b { white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dh-line .dh-sub { min-width: 0; }
.dh-line .dh-pill-sm { margin-top: 0; flex: none; }

/* Weekly bars fill the card height */
.dh-chart-card { display: flex; flex-direction: column; }
.dh-bars { flex: 1; min-height: 220px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; column-gap: 10px; padding-top: 34px; }
.dh-bars-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--dh-muted); text-align: right; margin-block: -7px; }
.dh-bars-plot { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; }
.dh-bars-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--dh-line); }
.dh-bars-col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.dh-bars-bar { position: relative; width: 62%; max-width: 44px; border-radius: 10px; background: #d6e6fb; }
.dark .dh-bars-bar { background: rgba(0, 113, 227, .25); }
.dh-bars-bar.on { background: linear-gradient(180deg, #5aa2f2, #0071e3); }
.dh-bars-pill { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--dh-blue); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; z-index: 2; opacity: 0; pointer-events: none; transition: opacity .12s; }
.dh-bars-pill.is-default { opacity: 1; }
.dh-bars-col { cursor: default; outline: none; }
.dh-bars-col:hover .dh-bars-bar:not(.on), .dh-bars-col:focus-visible .dh-bars-bar:not(.on) { background: #b7d3f7; }
.dh-bars-plot:has(.dh-bars-col:hover, .dh-bars-col:focus-visible) .dh-bars-pill.is-default { opacity: 0; }
.dh-bars-plot .dh-bars-col:hover .dh-bars-pill, .dh-bars-plot .dh-bars-col:focus-visible .dh-bars-pill { opacity: 1; }
.dh-bars-col:first-child .dh-bars-pill { left: 0; transform: none; }
.dh-bars-col:last-child .dh-bars-pill { left: auto; right: 0; transform: none; }
@media (prefers-reduced-motion: reduce) { .dh-bars-pill { transition: none; } }
.dh-bars-labels { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); text-align: center; font-size: 11px; color: var(--dh-muted); padding-top: 8px; }
.dh-split-tight { margin-top: 8px; padding-top: 8px; }

/* ---------- Table toolbar: search on the left (all listings), filters/columns on the right ---------- */
.fi-ta-header-toolbar > div:has(> .fi-ta-search-field) { flex: 1; order: -1; }
.fi-ta-header-toolbar .fi-ta-search-field { flex: 0 1 420px; margin-inline-end: auto; }
/* Table search: white pill with a thin border, like the search in the Wallet's investors card. */
.fi-ta-search-field .fi-input-wrp { border-radius: 999px !important; background: var(--dh-card) !important; border: 1px solid var(--dh-line); box-shadow: none !important; }
.fi-ta-search-field .fi-input-wrp:focus-within { border-color: var(--dh-blue); box-shadow: 0 0 0 1px var(--dh-blue) !important; }
.fi-ta-search-field .fi-input { font-size: 14px; }
@media (max-width: 640px) { .fi-ta-header-toolbar .fi-ta-search-field { flex-basis: 100%; } }

/* ---------- Menu items like the mockup rail: 44px tall, 14px corners, 18px thin icons ---------- */
.fi-sidebar-group-items { gap: 6px; }
.fi-sidebar-item-btn { min-height: 44px; border-radius: 14px !important; padding-inline: 13px !important; gap: 12px; }
.fi-sidebar-item-icon { width: 18px !important; height: 18px !important; color: var(--dh-muted); }
.fi-sidebar-item-label { font-size: 14px; font-weight: 600; color: var(--dh-muted); }
.fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-btn:hover { background: var(--dh-blue-soft) !important; }
.fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-btn:hover .fi-sidebar-item-icon,
.fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-btn:hover .fi-sidebar-item-label { color: var(--dh-blue); }
@media (min-width: 1024px) {
  /* Collapsed rail: 44 x 44 rounded squares (not circles), 40px logo, as in the mockup. */
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-item-btn { width: 44px !important; height: 44px !important; min-height: 44px; border-radius: 14px !important; }
  .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-item.fi-active > .fi-sidebar-item-btn { border-radius: 14px !important; }
  .fi-sidebar:not(.fi-sidebar-open) .dh-rail-logo img { width: 40px; height: 40px; }
}

/* ---------- Page header actions as mockup pills (white, soft shadow, 18px thin icons) ---------- */
/* Dashboard greeting as in the mockup: smaller title and line, 18px from the topbar and from the cards. */
.dh-dashboard .fi-page-header-main-ctn { padding-top: 12px; row-gap: 18px; }
@media (min-width: 640px) { .dh-dashboard .fi-header { align-items: flex-end; } }
.dh-dashboard .fi-header-heading { font-size: 26px; line-height: 32px; }
.dh-dashboard .fi-header-subheading { font-size: 14px; line-height: 20px; margin-top: 4px; }
.fi-header .fi-ac { gap: 8px; }
.fi-header .fi-ac .fi-btn { padding: 9px 14px !important; gap: 6px; font-size: 13px; font-weight: 600; border-radius: 999px !important;
  background: var(--dh-card) !important; color: var(--dh-ink) !important; box-shadow: var(--dh-shadow) !important; --tw-ring-color: transparent; border: 0; }
.fi-header .fi-ac .fi-btn .fi-icon { width: 18px !important; height: 18px !important; color: currentColor !important; }
.fi-header .fi-ac .fi-btn:hover { background: var(--dh-blue-soft) !important; color: var(--dh-blue) !important; }
.fi-header .fi-ac .fi-btn.fi-color-primary { background: var(--dh-blue) !important; color: #fff !important; }
.fi-header .fi-ac .fi-btn.fi-color-primary:hover { background: #0058b8 !important; color: #fff !important; }

/* ---------- Form and modal buttons: main action on the far right, Cancel just to its left ---------- */
/* Filament renders [Save, (Create another), Cancel]; reversing the row puts Save rightmost. */
[id$="form-actions"] > .fi-ac,
.fi-modal-footer-actions { flex-direction: row-reverse !important; justify-content: flex-start !important; }
/* Only the neutral buttons (Cancel...) become white pills. Colored ones keep their color:
   a red "Confirm" with a white background was white text on white, i.e. invisible. */
[id$="form-actions"] .fi-btn:not(.fi-color),
.fi-modal-footer-actions .fi-btn:not(.fi-color) { background: var(--dh-card) !important; box-shadow: var(--dh-shadow) !important; }
@media (max-width: 640px) {
  [id$="form-actions"] > .fi-ac { flex-wrap: wrap-reverse; }
}
/* Order from the right: main action, "create another" next to it, then Cancel. */
[id$="form-actions"] > .fi-ac > .fi-color-primary, .fi-modal-footer-actions > .fi-color-primary { order: 0; }
[id$="form-actions"] > .fi-ac > :not(.fi-color-primary):not(:last-child) { order: 1; }
[id$="form-actions"] > .fi-ac > :last-child:not(.fi-color-primary), .fi-modal-footer-actions > :last-child:not(.fi-color-primary) { order: 2; }

/* Two-column page of cards (payout statement, profit report); one column on phones. */
.dh-page-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: stretch; }
@media (min-width: 768px) { .dh-page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dh-page-grid .dh-span { grid-column: 1 / -1; }

/* Filters above a report */
.dh-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.dh-filters .fi-input-wrp { min-width: 160px; border-radius: 999px; }

/* Report table inside a card: numbers right-aligned, scrolls inside the card on phones. */
.dh-table-wrap { overflow-x: auto; margin: 0 -4px; }
.dh-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--dh-ink); font-variant-numeric: tabular-nums; }
.dh-table th { text-align: right; color: var(--dh-muted); font-size: 12px; font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--dh-line); white-space: nowrap; }
.dh-table td { text-align: right; padding: 10px 6px; border-bottom: 1px solid var(--dh-line); white-space: nowrap; }
.dh-table th:first-child, .dh-table td:first-child { text-align: left; }
.dh-table tfoot td { font-weight: 700; border-bottom: 0; }
.dh-table .dh-future td { color: var(--dh-muted); }
.dh-table .dh-neg { color: #c2412d; }

/* List tabs shown in the table toolbar (TabsInTableToolbar): search, then the period pills, then filters on the right. */
.fi-ta-header-toolbar:has(.dh-toolbar-tab) > div:has(> .fi-ta-search-field) { display: contents; }
.fi-ta-header-toolbar:has(.dh-toolbar-tab) .fi-ta-search-field { order: -3; flex: 0 1 420px; margin-inline-end: 0; }
.fi-ta-header-toolbar > .fi-ta-actions:has(.dh-toolbar-tab) { order: -2; margin-inline-end: auto; gap: 6px; padding: 3px; border-radius: 999px; background: var(--dh-canvas); }
.dh-toolbar-tab.fi-btn { box-shadow: none !important; padding: 6px 12px !important; }
.dh-toolbar-tab.fi-btn:not(.fi-color-primary) { background: transparent !important; color: var(--dh-muted) !important; }
.dh-toolbar-tab.fi-btn:not(.fi-color-primary):hover { background: var(--dh-card) !important; color: var(--dh-ink) !important; }
.dh-toolbar-tab.fi-btn.fi-color-primary { background: var(--dh-blue) !important; color: #fff !important; }
.dh-toolbar-tab .fi-btn-badge-ctn { position: static !important; inset: auto !important; transform: none !important; translate: none !important; align-self: center; display: inline-flex; margin-inline-start: 6px; }
.dh-toolbar-tab .fi-badge * { color: inherit !important; }
.dh-toolbar-tab .fi-badge { min-width: 18px; justify-content: center; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 18px; background: var(--dh-line); color: var(--dh-ink); box-shadow: none; }
.dh-toolbar-tab.fi-color-primary .fi-badge { background: #fff !important; color: var(--dh-blue) !important; font-weight: 700; }
.dh-toolbar-tab .fi-badge.fi-color-danger { background: #fde7e4; color: #c2412d; }

/* Sign-in code (two-step login): digits, label and "send a new code" centered in the card. */
.fi-one-time-code-input-ctn { margin-inline: auto; }
.fi-fo-field:has(.fi-one-time-code-input-ctn) { text-align: center; }
.fi-fo-field:has(.fi-one-time-code-input-ctn) :is(.fi-fo-field-label-ctn, .fi-fo-field-label-col, .fi-fo-field-content-col, .fi-sc-actions, .fi-ac, .fi-sc-text) { justify-content: center; justify-items: center; text-align: center; }
.fi-fo-field:has(.fi-one-time-code-input-ctn) .fi-fo-field-label-content { display: inline; }
.fi-one-time-code-input-digit { border-radius: 12px; }

/* Table totals: "Total US$ 130,00" on one line, the value in ink. */
.fi-ta-text-summary { display: flex !important; flex-wrap: nowrap; align-items: baseline; gap: 6px; white-space: nowrap; }
.fi-ta-text-summary > :not(.fi-ta-text-summary-label) { color: var(--dh-ink); font-weight: 700; }

/* Pagination: "Showing 1 to 2 of 2 results" then the per-page select right beside it; page numbers stay on the right. */
@media (min-width: 768px) {
  .fi-pagination { grid-template-columns: auto auto 1fr; }
  .fi-pagination-records-per-page-select-ctn { justify-self: start; }
}

/* Wallet statement (bank-style ledger): description left, amounts right, payouts stand out. */
.dh-ledger th:nth-child(2), .dh-ledger td:nth-child(2) { text-align: left; white-space: normal; }
.dh-ledger td:nth-child(2) .dh-link, .dh-ledger td:nth-child(2) .fi-link { margin-inline-start: 8px; }
/* Row action (trash) in its own narrow column at the end of the line. */
.dh-ledger .dh-ledger-act { width: 1%; padding-inline: 4px 0; text-align: right; white-space: nowrap; }
.dh-ledger .dh-ledger-act .fi-icon-btn { display: inline-flex; vertical-align: middle; margin-block: -6px; }
.dh-ledger .dh-ledger-main { font-weight: 600; }
.dh-ledger .dh-ledger-payout { color: var(--dh-blue); }
.dh-ledger td.dh-in { color: #138a4b; }
.dh-ledger th:last-child, .dh-ledger td:last-child { text-align: right; }
.dh-back { display: inline-flex; align-items: center; background: var(--dh-card); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.dh-back:hover { color: var(--dh-blue); border-color: var(--dh-blue); }

/* Segmented choice (Week · Month · Year) above a report. */
.dh-seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--dh-card); box-shadow: var(--dh-shadow); }
.dh-seg-btn { border: 0; background: transparent; color: var(--dh-muted); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.dh-seg-btn:hover { color: var(--dh-ink); }
.dh-seg-btn.dh-seg-on { background: var(--dh-blue); color: #fff; }
.dh-seg-btn:focus-visible { outline: 2px solid var(--dh-blue); outline-offset: 2px; }
.dh-filters { align-items: center; }

/* Ledger group header (one week, month or year): label left, its totals and closing balance right. */
.dh-ledger .dh-group td { background: var(--dh-canvas); font-weight: 700; color: var(--dh-ink); border-bottom: 0; padding-block: 8px; }
.dh-ledger .dh-group td:first-child { border-radius: 10px 0 0 10px; padding-inline-start: 12px; }
.dh-ledger .dh-group td:last-child { border-radius: 0 10px 10px 0; }
.dh-ledger tbody + tbody .dh-group td { border-top: 10px solid var(--dh-card); }
/* Information line in the ledger (deposit held): shown, but not part of the balance. */
.dh-ledger .dh-ledger-info td { color: var(--dh-muted); }
.dh-ledger .dh-ledger-info .dh-ledger-main { color: var(--dh-ink); }
.dh-ledger .dh-ledger-info .dh-pill { margin-inline-start: 8px; }
.dh-held { color: var(--dh-muted) !important; font-weight: 600; }
.dh-ledger .dh-pill-sm { margin-top: 0; vertical-align: middle; }

/* Wallet for admins: investors in a side card (search, All / With balance, list), the selected wallet beside it. */
.dh-wallet { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 1024px) { .dh-wallet-split { grid-template-columns: 320px minmax(0, 1fr); } .dh-wallet-list { position: sticky; top: 84px; } }
.dh-wallet-main { display: grid; gap: 18px; min-width: 0; }
.dh-wallet-list { height: auto; }
.dh-wallet-title { font-size: 17px; }
.dh-wallet-search { display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--dh-card); border: 1px solid var(--dh-line); color: var(--dh-muted); }
.dh-wallet-search svg { width: 16px; height: 16px; flex: none; }
.dh-wallet-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; font: inherit; font-size: 14px; color: var(--dh-ink); outline: none; box-shadow: none; }
.dh-wallet-search input::placeholder { color: var(--dh-muted); }
.dh-wallet-search:focus-within { border-color: var(--dh-blue); box-shadow: 0 0 0 1px var(--dh-blue); }
/* Segmented control that fills the row; the active option is a white pill on the canvas track. */
.dh-seg-fill { display: flex; width: 100%; box-sizing: border-box; margin-top: 10px; background: var(--dh-canvas); box-shadow: none; }
.dh-seg-fill .dh-seg-btn { flex: 1; }
.dh-seg-fill .dh-seg-btn.dh-seg-on { background: var(--dh-card); color: var(--dh-ink); box-shadow: var(--dh-shadow), 0 1px 3px rgba(16, 24, 40, .08); }
.dh-seg-n { color: var(--dh-muted); font-weight: 600; }
.dh-wallet-items { margin-top: 10px; gap: 2px; }
.dh-wallet-item { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; font: inherit; color: var(--dh-ink); padding: 10px 12px; margin-inline: -12px; width: calc(100% + 24px); border-radius: 14px; cursor: pointer; }
.dh-wallet-item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-wallet-item .dh-sub { display: block; font-weight: 500; }
.dh-wallet-item .dh-grow { flex: 1; min-width: 0; }
.dh-wallet-item .dh-amt { font-size: 14px; }
.dh-wallet-avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--dh-blue-soft); color: var(--dh-blue); font-size: 13px; font-weight: 700; }
.dh-wallet-item:hover { background: var(--dh-canvas); }
.dh-wallet-item.dh-wallet-on { background: var(--dh-blue-soft); }
.dh-wallet-item.dh-wallet-on::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; border-radius: 3px 0 0 3px; background: var(--dh-blue); }
.dh-wallet-item.dh-wallet-on { overflow: hidden; }
.dh-wallet-item.dh-wallet-on .dh-wallet-avatar { background: var(--dh-blue); color: #fff; }
.dh-wallet-item:focus-visible { outline: 2px solid var(--dh-blue); outline-offset: 2px; }
.dh-wallet-item .dh-neg { color: #c2412d; }
/* Total owed to all investors, on top of the investors card. */
.dh-wallet-total { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--dh-line); }
.dh-wallet-total .dh-big { margin-top: 4px; }
/* Hero card that is a link (investor's wallet on the dashboard). */
a.dh-hero-link { display: block; text-decoration: none; }
a.dh-hero-link:hover { filter: brightness(1.04); }
a.dh-hero-link:focus-visible { outline: 2px solid var(--dh-blue); outline-offset: 3px; }
.dh-hero .dh-row > span { min-width: 0; } .dh-hero .dh-row > b { white-space: nowrap; flex: none; }
/* Profit per trailer: the occupancy row layout in a narrow card (name + profit, bar, percent). */
.dh-profit-row { grid-template-columns: minmax(0, 1fr) minmax(60px, 1.2fr) 44px; gap: 10px; }
.dh-profit-row .dh-occ-name .dh-sub { display: block; font-weight: 600; }
.dh-profit-row .dh-occ-val { text-align: right; font-weight: 700; }
.dh-profit-row + .dh-profit-row { margin-top: 14px; }

/* Dashboard list rows that open a record (upcoming due dates, recent payments). */
a.dh-item { text-decoration: none; border-radius: 10px; transition: background .15s; }
a.dh-item:hover b { color: var(--dh-blue, #0071e3); }
a.dh-item:focus-visible { outline: 3px solid #cfe3fb; outline-offset: 2px; }

/* Simulator (admin): editable numbers of a possible new client. */
.dh-sim-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 16px; }
@media (max-width: 480px) { .dh-sim-fields { grid-template-columns: minmax(0, 1fr); } }
.dh-sim-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dh-sim-input, .dh-stepper { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 1px solid var(--dh-line); border-radius: 10px; background: var(--dh-card); }
.dh-sim-input:focus-within, .dh-stepper:focus-within { outline: 2px solid var(--dh-blue); outline-offset: -1px; }
.dh-sim-input.dh-sim-bad { border-color: #c2412d; }
.dh-sim-input span { color: var(--dh-muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dh-sim-input input, .dh-stepper input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--dh-ink); font: inherit; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0; box-shadow: none; outline: none; }
.dh-stepper { padding: 0 4px; }
.dh-stepper input { text-align: center; }
.dh-stepper button { width: 32px; height: 32px; border: 0; border-radius: 999px; background: var(--dh-canvas); color: var(--dh-ink); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; }
.dh-stepper button:hover:not(:disabled) { background: var(--dh-blue-soft, #e8f1fc); color: var(--dh-blue); }
.dh-stepper button:disabled { opacity: .4; cursor: default; }
.dh-sim-note { margin-top: 14px; }
.dh-link-btn { border: 0; background: transparent; color: var(--dh-blue); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 4px 0; }
.dh-link-btn:hover { text-decoration: underline; }

/* ===== GPS maps (design system: LocationCard, FleetMap). OpenFreeMap via MapLibre, Apple-like colors (public/js/deckhaul-map.js). ===== */
.dh-map { position: relative; overflow: hidden; border-radius: 12px; background: #f6f3ec; aspect-ratio: 16 / 9; min-height: 220px; isolation: isolate; z-index: 0; }
.dh-map.tall { aspect-ratio: auto; height: min(70vh, 640px); min-height: 360px; }
.dh-map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; font-family: inherit; background: #f6f3ec; }
.dh-map-marker { width: 0; height: 0; }
.dh-map-pin { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: grid; justify-items: center; gap: 3px; text-decoration: none; }
.dh-map-tag { font-size: 11px; line-height: 14px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #fff; color: #15171c; box-shadow: 0 2px 6px rgba(16, 24, 40, .18); white-space: nowrap; }
.dh-map-dot { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--dh-blue); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(16, 24, 40, .25); }
.dh-map-pin.ok .dh-map-dot { background: #138a4b; }
.dh-map-pin.info .dh-map-dot { background: var(--dh-blue); }
.dh-map-pin.warn .dh-map-dot { background: #a15c00; }
.dh-map-pin.gray .dh-map-dot { background: var(--dh-muted); }
.dh-map .maplibregl-ctrl-attrib { font-size: 11px; line-height: 14px; }
.dh-map .maplibregl-ctrl-group { border-radius: 10px; box-shadow: 0 1px 3px rgba(16, 24, 40, .15); }
.dh-map-empty { display: grid; place-items: center; align-content: center; gap: 4px; min-height: 160px; border-radius: 12px; background: var(--dh-canvas); color: var(--dh-muted); text-align: center; padding: 20px; }
.dh-map-empty .dh-big { margin: 0; }
.dh-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; margin: 16px 0 0; }
.dh-facts div { min-width: 0; }
.dh-facts dt { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--dh-muted); }
.dh-facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dh-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dh-fleet { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1024px) { .dh-fleet { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.dh-fleet-list { max-height: min(70vh, 640px); overflow-y: auto; }
.dh-fleet-row { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }
.dh-fleet-row:hover .dh-line b { color: var(--dh-blue); }
.dh-fleet-row:focus-visible { outline: 2px solid var(--dh-blue); outline-offset: 2px; border-radius: 10px; }
.dh-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 4px; }
.dh-tab { border: 0; background: transparent; color: var(--dh-muted); font: 700 12px/16px inherit; font-family: inherit; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.dh-tab.on { background: var(--dh-blue-soft); color: var(--dh-blue); }
.dh-search-in-card { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--dh-canvas); color: var(--dh-muted); }
.dh-search-in-card input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--dh-ink); outline: none; box-shadow: none; padding: 0; }
.dh-search-in-card svg { width: 16px; height: 16px; flex: none; }
