/* Fleet Integrity — ETM mobile refresh (2026-10-07)
   ETM-only, loaded after the shared portal layers. */
@media (max-width:700px){
  body.fi-refined[data-fi-portal="admin"].v4-ready{
    font-size:15px;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready main{
    padding-inline:14px!important;
    padding-bottom:calc(94px + env(safe-area-inset-bottom))!important;
  }

  /* Mobile header: page identity + profile only. Search/Create live in nav/More. */
  body.fi-refined[data-fi-portal="admin"].v4-ready main>header{
    min-height:68px!important;
    margin:0 -14px 16px!important;
    padding:max(10px,env(safe-area-inset-top)) 14px 10px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:12px!important;
    background:var(--v4-bg)!important;
    border-bottom:1px solid color-mix(in srgb,var(--v4-line) 78%,transparent)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready main>header>div:first-child{
    min-width:0!important;
    flex:1 1 auto!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready main>header .eyebrow,
  body.fi-refined[data-fi-portal="admin"].v4-ready #viewSub,
  body.fi-refined[data-fi-portal="admin"].v4-ready .v4-header-tools,
  body.fi-refined[data-fi-portal="admin"].v4-ready .user #userEmail,
  body.fi-refined[data-fi-portal="admin"].v4-ready .user .fi-theme-toggle,
  body.fi-refined[data-fi-portal="admin"].v4-ready #headerSignOut{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #viewTitle{
    margin:0!important;
    font-size:22px!important;
    line-height:1.12!important;
    letter-spacing:-.025em!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .user{
    display:flex!important;
    grid-column:auto!important;
    align-items:center!important;
    justify-content:flex-end!important;
    min-width:44px!important;
    gap:0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .user .avatar{
    display:grid!important;
    place-items:center!important;
    width:42px!important;
    height:42px!important;
    min-width:42px!important;
    border:1px solid color-mix(in srgb,var(--v4-blue) 28%,var(--v4-line))!important;
    border-radius:14px!important;
    background:color-mix(in srgb,var(--v4-blue) 10%,var(--v4-surface))!important;
    color:var(--v4-text)!important;
    font-size:12px!important;
    font-weight:900!important;
    letter-spacing:.03em!important;
    cursor:pointer!important;
    user-select:none!important;
    -webkit-tap-highlight-color:transparent;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .user .avatar:focus-visible{
    outline:2px solid var(--v4-blue)!important;
    outline-offset:2px!important;
  }

  /* Page copy: readable, quieter and less compressed. */
  body.fi-refined[data-fi-portal="admin"].v4-ready .view>.toolbar,
  body.fi-refined[data-fi-portal="admin"].v4-ready .toolbar{
    display:block!important;
    margin:0 0 14px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .toolbar h2{
    font-size:20px!important;
    line-height:1.2!important;
    letter-spacing:-.015em!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .toolbar p{
    max-width:42rem!important;
    margin-top:6px!important;
    font-size:13px!important;
    line-height:1.45!important;
    color:var(--v4-muted)!important;
  }
  /* Standard create actions are already available from the centre Create tab. */
  body.fi-refined[data-fi-portal="admin"].v4-ready :is(
    #clients,#vehicles,#trailers,#drivers,#actions,#documents,#audits,#invoices
  )>.toolbar>button{
    display:none!important;
  }

  /* Dashboard: compact 2x2 snapshot, but keep text readable. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
    margin-bottom:12px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article{
    min-height:104px!important;
    padding:14px!important;
    border-radius:16px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article>span{
    font-size:10px!important;
    line-height:1.25!important;
    letter-spacing:.055em!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article>strong{
    margin-top:7px!important;
    font-size:27px!important;
    line-height:1!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article>small{
    margin-top:7px!important;
    font-size:11px!important;
    line-height:1.3!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard .grid,
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard .grid.lower{
    gap:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard .panel{
    padding:15px!important;
    border-radius:16px!important;
    margin-bottom:0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard .panel-head h2{
    font-size:16px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard .panel-head p{
    margin-top:4px!important;
    font-size:12px!important;
    line-height:1.4!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard :is(#dueList,#priorityList,#clientHealth,#activityList) .row{
    padding:12px 0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard :is(#dueList,#priorityList,#clientHealth,#activityList) .row-title{
    font-size:14px!important;
    line-height:1.3!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard :is(#dueList,#priorityList,#clientHealth,#activityList) .row-sub{
    margin-top:4px!important;
    font-size:12px!important;
    line-height:1.4!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard .row-note{
    margin-top:6px!important;
    font-size:12px!important;
    line-height:1.4!important;
  }

  /* Register tables become native-feeling cards instead of horizontal desktop tables. */
  body.fi-refined[data-fi-portal="admin"].v4-ready :is(
    #clientsTable,#vehiclesTable,#trailersTable,#driversTable,#documentsTable,#auditsTable,#invoicesTable
  ){
    width:100%!important;
    max-width:100%!important;
    padding:0!important;
    overflow:visible!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    table-layout:auto!important;
    border:0!important;
    background:transparent!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards thead{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody{
    display:grid!important;
    width:100%!important;
    gap:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody tr{
    position:relative!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:11px 14px!important;
    width:100%!important;
    min-width:0!important;
    padding:15px!important;
    border:1px solid var(--v4-line)!important;
    border-radius:16px!important;
    background:var(--v4-surface)!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    padding:0!important;
    border:0!important;
    white-space:normal!important;
    overflow:visible!important;
    overflow-wrap:anywhere!important;
    font-size:13px!important;
    line-height:1.35!important;
    color:var(--v4-text)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td::before{
    content:attr(data-label);
    display:block;
    margin:0 0 4px;
    color:var(--v4-muted);
    font-size:10px;
    font-weight:800;
    line-height:1.15;
    letter-spacing:.065em;
    text-transform:uppercase;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td:first-child{
    grid-column:1/-1!important;
    padding:0 58px 11px 0!important;
    border-bottom:1px solid color-mix(in srgb,var(--v4-line) 76%,transparent)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td:first-child::before{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td:first-child>strong{
    display:block!important;
    margin:0!important;
    font-size:16px!important;
    line-height:1.25!important;
    letter-spacing:-.01em!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td:first-child>br{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td:first-child>small{
    display:block!important;
    margin-top:5px!important;
    color:var(--v4-muted)!important;
    font-size:12px!important;
    line-height:1.35!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready :is(
    #clientsTable,#vehiclesTable,#trailersTable,#driversTable,#auditsTable,#invoicesTable
  ) table.fi-etm-mobile-cards tbody td:last-child{
    position:absolute!important;
    top:14px!important;
    right:14px!important;
    width:auto!important;
    max-width:46%!important;
    padding:0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready :is(
    #clientsTable,#vehiclesTable,#trailersTable,#driversTable,#auditsTable,#invoicesTable
  ) table.fi-etm-mobile-cards tbody td:last-child::before{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody tr.clickable-row::after{
    content:"›";
    position:absolute;
    right:16px;
    bottom:13px;
    color:var(--v4-muted);
    font-size:22px;
    line-height:1;
    opacity:.75;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #documentsTable table.fi-etm-mobile-cards tbody td:first-child{
    padding-right:0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #documentsTable [data-fiai-doc-inline]{
    width:auto!important;
    min-height:34px!important;
    margin:8px 0 0!important;
    padding:7px 9px!important;
    border:0!important;
    background:color-mix(in srgb,var(--v4-blue) 9%,transparent)!important;
    color:var(--v4-blue)!important;
    font-size:11px!important;
  }

  /* Keep search visible; secondary selectors live behind one Filters control. */
  body.fi-refined[data-fi-portal="admin"].v4-ready [data-fi-mobile-filter-native="1"]{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-mobile-filter-native-wrap{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-mobile-filter-empty-source{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .v4-filter-row.fi-mobile-search-only{
    display:block!important;
    margin:0 0 10px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .v4-filter-row.fi-mobile-search-only input[type="search"]{
    display:block!important;
    width:100%!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .v4-filter-row.fi-mobile-search-only>button{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .v4-filter-row.fi-mobile-search-only .fi-filter-count{
    display:block!important;
    margin-top:6px!important;
    color:var(--v4-muted)!important;
    font-size:11px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-mobile-filter-trigger{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:7px!important;
    min-height:42px!important;
    width:auto!important;
    margin:0 0 10px!important;
    padding:8px 12px!important;
    border:1px solid var(--v4-line)!important;
    border-radius:11px!important;
    background:var(--v4-surface)!important;
    color:var(--v4-text)!important;
    box-shadow:none!important;
    font-size:12px!important;
    font-weight:800!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-mobile-filter-trigger[data-active-count]:not([data-active-count="0"]){
    border-color:color-mix(in srgb,var(--v4-blue) 42%,var(--v4-line))!important;
    color:var(--v4-blue)!important;
    background:color-mix(in srgb,var(--v4-blue) 7%,var(--v4-surface))!important;
  }

  /* Filter bottom sheet */
  #fiEtmFilterBackdrop{
    position:fixed;
    z-index:1490;
    inset:0;
    display:none;
    background:rgba(1,8,18,.5);
  }
  #fiEtmFilterBackdrop.open{display:block}
  #fiEtmFilterSheet{
    position:fixed;
    z-index:1500;
    left:10px;
    right:10px;
    bottom:calc(10px + env(safe-area-inset-bottom));
    display:none;
    max-height:min(72dvh,620px);
    overflow:auto;
    padding:10px 12px 14px;
    border:1px solid var(--v4-line);
    border-radius:20px;
    background:var(--v4-surface);
    color:var(--v4-text);
    box-shadow:0 24px 70px rgba(0,0,0,.34);
  }
  #fiEtmFilterSheet.open{display:block}
  #fiEtmFilterSheet .fi-filter-sheet-handle{
    width:42px;
    height:4px;
    margin:2px auto 10px;
    border-radius:999px;
    background:color-mix(in srgb,var(--v4-muted) 55%,transparent);
  }
  #fiEtmFilterSheet .fi-filter-sheet-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:0 2px 10px;
  }
  #fiEtmFilterSheet .fi-filter-sheet-head strong{
    font-size:17px;
    letter-spacing:-.01em;
  }
  #fiEtmFilterSheet .fi-filter-sheet-close{
    display:grid;
    place-items:center;
    width:38px;
    height:38px;
    border:1px solid var(--v4-line);
    border-radius:11px;
    background:transparent;
    color:var(--v4-text);
    font-size:20px;
  }
  #fiEtmFilterSheet .fi-filter-sheet-fields{
    display:grid;
    gap:10px;
  }
  #fiEtmFilterSheet label{
    display:grid;
    gap:6px;
    color:var(--v4-muted);
    font-size:11px;
    font-weight:800;
    letter-spacing:.045em;
    text-transform:uppercase;
  }
  #fiEtmFilterSheet select{
    width:100%;
    min-height:48px!important;
    border-radius:12px!important;
    font-size:16px!important;
    text-transform:none;
    letter-spacing:0;
  }
  #fiEtmFilterSheet .fi-filter-sheet-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:12px;
  }
  #fiEtmFilterSheet .fi-filter-sheet-actions button{
    min-height:44px;
    border-radius:12px;
  }

  /* AI is available from More on mobile; no permanent bright pill over records. */
  body.fi-refined[data-fi-portal="admin"] #fiAiLauncher{
    display:none!important;
  }

  /* More becomes the home for utilities that were cluttering the header. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore{
    max-height:min(76dvh,660px)!important;
    padding:11px!important;
    border-radius:20px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-etm-mobile-utilities{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin-top:10px;
    padding-top:10px;
    border-top:1px solid var(--v4-line);
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-etm-mobile-utilities button{
    min-height:58px;
    padding:10px;
    border:1px solid var(--v4-line);
    border-radius:13px;
    background:var(--v4-surface-2);
    color:var(--v4-text);
    text-align:left;
    font:inherit;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-etm-mobile-utilities button span{
    display:block;
    margin-bottom:4px;
    color:var(--v4-blue);
    font-size:17px;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-etm-mobile-utilities button strong{
    display:block;
    font-size:12px;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready .fi-etm-mobile-utilities button[data-fi-etm-util="logout"] span{
    color:#dc5757;
  }

  /* Bottom navigation: quieter selection, stronger central Create action. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav{
    padding:6px 5px calc(7px + env(safe-area-inset-bottom))!important;
    border-top:1px solid color-mix(in srgb,var(--v4-line) 84%,transparent)!important;
    background:var(--v4-surface)!important;
    box-shadow:0 -10px 30px rgba(2,9,19,.12)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav button{
    position:relative;
    min-height:54px!important;
    padding:4px 2px!important;
    border-radius:12px!important;
    background:transparent!important;
    color:var(--v4-muted)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav button.active{
    background:transparent!important;
    color:var(--v4-blue)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav button.active:not([data-mobile-create])::after{
    content:"";
    position:absolute;
    left:50%;
    bottom:2px;
    width:18px;
    height:2px;
    border-radius:999px;
    background:var(--v4-blue);
    transform:translateX(-50%);
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav button span:first-child{
    font-size:18px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav button span:last-child{
    font-size:10px!important;
    font-weight:750!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav [data-mobile-create] span:first-child{
    display:grid!important;
    place-items:center!important;
    width:42px!important;
    height:42px!important;
    margin:-13px auto 1px!important;
    border-radius:14px!important;
    background:linear-gradient(145deg,#1f69ef,#245ee8)!important;
    color:#fff!important;
    box-shadow:0 10px 24px rgba(36,94,232,.28)!important;
    font-size:23px!important;
  }
}

@media (max-width:390px){
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody tr{
    grid-template-columns:1fr!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td{
    grid-column:1!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready table.fi-etm-mobile-cards tbody td:first-child{
    grid-column:1!important;
  }
}


/* ETM mobile QA pass 2 — fixes seen in 2026-10-07 screen recording */
@media (max-width:700px){
  /* Keep title + profile on one line; older grid rules were forcing the profile below. */
  body.fi-refined[data-fi-portal="admin"].v4-ready main>header{
    display:flex!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    min-height:64px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready main>header>div:first-child{
    width:auto!important;
    max-width:calc(100% - 56px)!important;
    flex:1 1 auto!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready main>header .user{
    width:auto!important;
    min-width:42px!important;
    flex:0 0 auto!important;
  }

  /* Client cards are navigational on mobile. Remove legacy inline action buttons
     that were sitting over the company name/status area. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #clientsTable tbody td button{
    display:none!important;
  }

  /* Due Centre must not fall back to a horizontally scrolling desktop table. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable{
    padding:0!important;
    overflow:visible!important;
    border:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable table{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    border:0!important;
    background:transparent!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable thead{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody{
    display:grid!important;
    width:100%!important;
    gap:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody tr{
    position:relative!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:11px 14px!important;
    width:100%!important;
    min-width:0!important;
    padding:15px!important;
    border:1px solid var(--v4-line)!important;
    border-radius:16px!important;
    background:var(--v4-surface)!important;
    box-shadow:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    padding:0!important;
    border:0!important;
    white-space:normal!important;
    overflow:visible!important;
    overflow-wrap:anywhere!important;
    font-size:13px!important;
    line-height:1.35!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:first-child{
    grid-column:1/-1!important;
    padding:0 82px 11px 0!important;
    border-bottom:1px solid color-mix(in srgb,var(--v4-line) 76%,transparent)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:first-child strong{
    display:block!important;
    font-size:16px!important;
    line-height:1.25!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:first-child br{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:first-child small{
    display:block!important;
    margin-top:5px!important;
    color:var(--v4-muted)!important;
    font-size:11px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(2)::before,
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(3)::before,
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(4)::before{
    display:block;
    margin-bottom:4px;
    color:var(--v4-muted);
    font-size:10px;
    font-weight:800;
    line-height:1.15;
    letter-spacing:.065em;
    text-transform:uppercase;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(2)::before{content:"Client"}
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(3)::before{content:"Obligation"}
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(4)::before{content:"Due"}
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(5){
    position:absolute!important;
    top:14px!important;
    right:14px!important;
    width:auto!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(6){
    grid-column:1/-1!important;
    padding-top:11px!important;
    border-top:1px solid color-mix(in srgb,var(--v4-line) 76%,transparent)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable .v4-due-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    width:100%!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable .v4-due-actions button{
    width:100%!important;
    min-height:42px!important;
    margin:0!important;
  }

  /* Invoice card: actions belong in a footer, never over monetary/date fields. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable table.fi-etm-mobile-cards tbody td[data-label="Status"]{
    position:absolute!important;
    top:14px!important;
    right:14px!important;
    width:auto!important;
    max-width:44%!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable table.fi-etm-mobile-cards tbody td[data-label="Status"]::before{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable table.fi-etm-mobile-cards tbody td[data-label="Controls"],
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable table.fi-etm-mobile-cards tbody td[data-invoice-cell]{
    position:static!important;
    grid-column:1/-1!important;
    width:auto!important;
    max-width:none!important;
    display:flex!important;
    align-items:center!important;
    flex-wrap:wrap!important;
    gap:8px!important;
    padding-top:11px!important;
    border-top:1px solid color-mix(in srgb,var(--v4-line) 76%,transparent)!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable table.fi-etm-mobile-cards tbody td[data-label="Controls"]::before,
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable table.fi-etm-mobile-cards tbody td[data-invoice-cell]::before{
    content:"Actions"!important;
    display:block!important;
    flex:0 0 100%!important;
    margin-bottom:0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable td[data-invoice-cell] button{
    min-height:40px!important;
    margin:0!important;
    padding:8px 11px!important;
    white-space:normal!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #invoicesTable .paid-note{
    display:inline-flex!important;
    align-items:center!important;
    min-height:32px!important;
    padding:5px 9px!important;
    border-radius:999px!important;
    background:color-mix(in srgb,#2eaa72 12%,transparent)!important;
    color:#68d59e!important;
    font-size:11px!important;
    font-weight:800!important;
  }

  /* More: two compact columns so all destinations + utilities fit without a long scroll. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore{
    bottom:calc(78px + env(safe-area-inset-bottom))!important;
    max-height:calc(100dvh - 112px - env(safe-area-inset-bottom))!important;
    overflow:auto!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore .v4-mobile-more-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore .v4-mobile-more-grid>button{
    min-height:74px!important;
    padding:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore .v4-mobile-more-grid>button>span{
    margin-bottom:4px!important;
    font-size:18px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore .v4-mobile-more-grid strong{
    font-size:12px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore .v4-mobile-more-grid small{
    margin-top:2px!important;
    font-size:9.5px!important;
    line-height:1.3!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4MobileMore .fi-etm-mobile-utilities{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media (max-width:390px){
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody tr{
    grid-template-columns:1fr!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4DueTable tbody td:nth-child(6){
    grid-column:1!important;
  }
}


/* ETM polish pass — 2026-10-07 */
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"]{
  --fi-canvas:#eaf0f6;
  --fi-surface:#f9fbfd;
  --fi-soft:#eef3f8;
  --fi-ink:#14243a;
  --fi-muted:#607087;
  --fi-border:#d4deea;
  --fi-tint:#e7efff;
  --fi-elevation:0 2px 8px rgba(20,36,58,.035),0 12px 32px rgba(20,36,58,.055);
  --v4-bg:var(--fi-canvas);
  --v4-surface:var(--fi-surface);
  --v4-surface-2:var(--fi-soft);
  --v4-text:var(--fi-ink);
  --v4-muted:var(--fi-muted);
  --v4-line:var(--fi-border);
  --fi4-bg:var(--fi-canvas);
  --fi4-surface:var(--fi-surface);
  --fi4-surface2:var(--fi-soft);
  --fi4-text:var(--fi-ink);
  --fi4-muted:var(--fi-muted);
  --fi4-line:var(--fi-border);
  --fiai-bg:#f8fbff;
  --fiai-bg2:#edf3f9;
  --fiai-line:#d1ddea;
  --fiai-text:#14243a;
  --fiai-muted:#61758c;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] :is(.panel,.v4-panel,.stats article,.invoice-stats article,.v4-stat){
  box-shadow:var(--fi-elevation)!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] main>header{
  background:color-mix(in srgb,var(--fi-canvas) 86%,white 14%);
}

/* AI should belong to the active portal theme. */
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDrawer .fiai-panel{
  background:#f8fbff!important;
  color:#14243a!important;
  border-color:#d1ddea!important;
  box-shadow:-24px 0 60px rgba(22,41,66,.14)!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDrawer :is(.fiai-head,.fiai-controls){
  border-color:#d1ddea!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDrawer :is(.fiai-controls select,.fiai-controls textarea,.fiai-btn,.fiai-card,.fiai-notice){
  background:#edf3f9!important;
  color:#14243a!important;
  border-color:#d1ddea!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDrawer .fiai-muted,
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDrawer :is(.fiai-head-copy small,.fiai-controls label,.fiai-row-main small){
  color:#61758c!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDrawer .fiai-icon-btn{
  color:#243850!important;
  border-color:#d1ddea!important;
  background:#f4f7fb!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDashboardCard{
  background:linear-gradient(145deg,#edf5ff,#f7faff)!important;
  border-color:#c6d8ee!important;
  color:#14243a!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDashboardCard :is(h2,h3){
  color:#14243a!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiAiDashboardCard :is(p,.fiai-dashboard-summary){
  color:#61758c!important;
}

/* Admin onboarding: remove dark legacy islands in light mode. */
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog{
  background:#f8fbfe!important;
  color:#14243a!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog .fi-form-head,
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog .fi-form-actions{
  background:#f5f8fc!important;
  color:#14243a!important;
  border-color:#d6e1ec!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog .fi-form-section{
  background:#fbfcfe!important;
  border-color:#d6e1ec!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog .fi-form-section>header{
  background:#e9f1fb!important;
  color:#18314d!important;
  border-bottom:1px solid #d4e0ed!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog .fi-form-section>header :is(h3,p){
  color:#18314d!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog :is(.fi-fixed-value,.fi-check-line,.fi-contract-terms,.fi-evidence-item){
  background:#f0f5fa!important;
  color:#243850!important;
  border-color:#d6e1ec!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog :is(input,select,textarea){
  background:#fff!important;
  color:#14243a!important;
  border-color:#cdd9e6!important;
}
html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"] #fiOnboardingDialog .icon-btn{
  background:#edf2f7!important;
  color:#53687f!important;
}

/* Client record search/actions */
body.fi-refined[data-fi-portal="admin"] .v4-client-record-search{
  display:grid;
  gap:6px;
  margin:0 0 12px;
}
body.fi-refined[data-fi-portal="admin"] .v4-client-record-search>span{
  color:var(--v4-muted);
  font-size:10px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
}
body.fi-refined[data-fi-portal="admin"] .v4-client-record-search input{
  width:100%;
}
body.fi-refined[data-fi-portal="admin"] .v4-client-record-row{
  align-items:center!important;
}
body.fi-refined[data-fi-portal="admin"] .v4-client-row-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  flex-wrap:wrap;
}
body.fi-refined[data-fi-portal="admin"] .v4-client-row-actions button{
  min-height:36px;
  margin:0!important;
  padding:7px 10px;
}

/* Dashboard rhythm: don't let Upcoming obligations touch the Actions panel. */
body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard [data-v4-obligation-summary]{
  margin-top:18px!important;
  margin-bottom:18px!important;
}

/* Client tachograph workspace: reduce boxed clutter and restore consistent rhythm. */
body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]{
  display:grid;
  gap:14px;
}
body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]>.fi-tacho-toolbar{
  margin:0!important;
  gap:12px!important;
}
body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]>.fi-tacho-tabs{
  margin:0!important;
}
body.fi-refined[data-fi-portal="admin"] [data-fi-client-tacho-content]{
  display:grid;
  gap:14px;
}
body.fi-refined[data-fi-portal="admin"] [data-tacho-responsibility-quick]{
  margin:0!important;
}
body.fi-refined[data-fi-portal="admin"] [data-tacho-responsibility-quick] .fi-tacho-settings-grid{
  margin-top:14px;
}

/* Finance stats: large currency values must fit instead of colliding. */
body.fi-refined[data-fi-portal="admin"] .invoice-stats article{
  min-width:0!important;
}
body.fi-refined[data-fi-portal="admin"] .invoice-stats strong{
  max-width:100%;
  overflow-wrap:anywhere;
  font-size:clamp(21px,3.4vw,34px)!important;
  line-height:1.05!important;
}

/* Document record drawer: compact metadata + usable actions. */
body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer{
  overflow-x:hidden!important;
}
body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-drawer-head h2{
  overflow-wrap:anywhere!important;
}
body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-record-hero{
  min-width:0;
}
body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-record-hero strong{
  overflow-wrap:anywhere!important;
}
body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-drawer-actions{
  flex-wrap:wrap!important;
}

/* Drivers: destructive action belongs in a footer, not over the driver name. */
@media(max-width:700px){
  body.fi-refined[data-fi-portal="admin"].v4-ready #driversTable table.fi-etm-mobile-cards tbody td[data-label="Remove"]{
    position:static!important;
    grid-column:1/-1!important;
    width:auto!important;
    max-width:none!important;
    padding-top:10px!important;
    border-top:1px solid var(--v4-line)!important;
    display:flex!important;
    justify-content:flex-end!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #driversTable table.fi-etm-mobile-cards tbody td[data-label="Remove"]::before{
    display:none!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #driversTable td[data-label="Remove"] .danger-btn{
    width:auto!important;
    min-height:36px!important;
    padding:7px 11px!important;
    margin:0!important;
    font-size:11px!important;
  }

  /* Bottom nav: centre Create optically and keep label spacing consistent. */
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav{
    align-items:end!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav button{
    display:grid!important;
    grid-template-rows:30px 16px!important;
    align-content:end!important;
    justify-items:center!important;
    gap:3px!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav [data-mobile-create]{
    transform:translateY(-2px);
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav [data-mobile-create] span:first-child{
    width:44px!important;
    height:44px!important;
    margin:-17px auto 0!important;
  }
  body.fi-refined[data-fi-portal="admin"].v4-ready #v4BottomNav [data-mobile-create] span:last-child{
    margin-top:1px!important;
  }

  /* Tachograph tabs read as one compact navigation block on phones. */
  body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]>.fi-tacho-tabs{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    overflow:visible!important;
    padding:0!important;
  }
  body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]>.fi-tacho-tabs button{
    width:100%!important;
    min-height:44px!important;
    white-space:normal!important;
    line-height:1.2!important;
    padding:9px 8px!important;
  }
  body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]>.fi-tacho-toolbar{
    display:grid!important;
    grid-template-columns:1fr!important;
  }
  body.fi-refined[data-fi-portal="admin"] [data-fi-tacho-client-panel]>.fi-tacho-toolbar>button{
    width:100%!important;
    min-height:46px!important;
  }
  body.fi-refined[data-fi-portal="admin"] [data-tacho-responsibility-quick]{
    padding:14px!important;
  }
  body.fi-refined[data-fi-portal="admin"] [data-tacho-responsibility-quick] .fi-tacho-settings-grid{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"] [data-tacho-responsibility-quick] .fi-tacho-report-actions button{
    width:100%!important;
  }

  /* Client document/invoice actions stack cleanly on smaller cards. */
  body.fi-refined[data-fi-portal="admin"] .v4-client-record-row{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"] .v4-client-row-actions{
    justify-content:flex-start!important;
  }

  /* Document detail drawer: no horizontal button train. */
  body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-drawer-body{
    padding:16px 14px 24px!important;
  }
  body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-detail-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
  }
  body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-detail{
    min-width:0!important;
    padding:11px!important;
  }
  body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-drawer-actions{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    padding:10px 12px calc(12px + env(safe-area-inset-bottom))!important;
  }
  body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-drawer-actions button{
    width:100%!important;
    min-width:0!important;
    min-height:44px!important;
    margin:0!important;
    padding:9px 8px!important;
    white-space:normal!important;
    line-height:1.25!important;
  }

  /* Finance summary stays 3-across, but values fit comfortably. */
  body.fi-refined[data-fi-portal="admin"] .invoice-stats{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:8px!important;
  }
  body.fi-refined[data-fi-portal="admin"] .invoice-stats article{
    padding:12px 10px!important;
    border-radius:15px!important;
  }
  body.fi-refined[data-fi-portal="admin"] .invoice-stats article>span{
    font-size:10px!important;
  }
  body.fi-refined[data-fi-portal="admin"] .invoice-stats strong{
    margin-top:8px!important;
    font-size:clamp(19px,5vw,26px)!important;
    letter-spacing:-.035em!important;
  }
}

@media(max-width:380px){
  body.fi-refined[data-fi-portal="admin"] #v4RecordDrawer .v4-detail-grid{
    grid-template-columns:1fr!important;
  }
  body.fi-refined[data-fi-portal="admin"] .invoice-stats strong{
    font-size:18px!important;
  }
}

body.fi-refined[data-fi-portal="admin"] .fi-invoice-locked-note{
  display:grid;
  gap:4px;
  padding:12px 13px;
  border:1px solid var(--v4-line);
  border-radius:12px;
  background:var(--v4-surface-2);
  color:var(--v4-text);
}
body.fi-refined[data-fi-portal="admin"] .fi-invoice-locked-note strong{font-size:12px}
body.fi-refined[data-fi-portal="admin"] .fi-invoice-locked-note span{font-size:11px;color:var(--v4-muted)}


/* ETM light-mode final balance pass — 2026-10-07 */
@media(max-width:700px){
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard{
    margin-top:-12px!important;
    margin-bottom:14px!important;
    padding:15px!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-head{
    align-items:center!important;
    gap:14px!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-head h2{
    font-size:21px!important;
    line-height:1.16!important;
    letter-spacing:-.025em!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-head p{
    margin-top:6px!important;
    font-size:13px!important;
    line-height:1.45!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-summary{
    margin-top:11px!important;
    font-size:13px!important;
    line-height:1.45!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-btn[data-fiai-open]{
    flex:0 0 auto!important;
    min-width:104px!important;
    min-height:42px!important;
    padding:9px 15px!important;
    white-space:nowrap!important;
    border-radius:12px!important;
    font-size:12px!important;
    line-height:1!important;
  }

  /* Keep one highlighted KPI without allowing it to dominate the whole dashboard. */
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article:first-child{
    background:linear-gradient(145deg,#e2edff,#edf4ff)!important;
    border-color:#c6d8f1!important;
    color:#173a68!important;
    box-shadow:0 8px 24px rgba(36,94,232,.07)!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article:first-child>strong{
    color:#183c6b!important;
  }
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article:first-child>:is(span,small){
    color:#58718f!important;
  }

  /* Neutral upcoming state should still read clearly against light surfaces. */
  html:not([data-theme="dark"]) body.fi-refined[data-fi-portal="admin"].v4-ready #dueList :is(.badge,.v4-pill):not(.red):not(.amber):not(.green):not(.bad):not(.warn):not(.ok){
    background:#e3ebf4!important;
    color:#4f667e!important;
    border:1px solid #d1dce8!important;
  }
}


/* ETM dark-mode parity pass — mirror final mobile balance refinements */
@media(max-width:700px){
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard{
    margin-top:-12px!important;
    margin-bottom:14px!important;
    padding:15px!important;
    background:linear-gradient(145deg,#112238,#142a45)!important;
    border-color:#294b70!important;
    color:#edf4ff!important;
    box-shadow:0 10px 30px rgba(0,0,0,.14)!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-head{
    align-items:center!important;
    gap:14px!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-head h2{
    color:#f0f5ff!important;
    font-size:21px!important;
    line-height:1.16!important;
    letter-spacing:-.025em!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-head p{
    margin-top:6px!important;
    color:#a9bdd3!important;
    font-size:13px!important;
    line-height:1.45!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-dashboard-summary{
    margin-top:11px!important;
    color:#a9bdd3!important;
    font-size:13px!important;
    line-height:1.45!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #fiAiDashboardCard .fiai-btn[data-fiai-open]{
    flex:0 0 auto!important;
    min-width:104px!important;
    min-height:42px!important;
    padding:9px 15px!important;
    white-space:nowrap!important;
    border-radius:12px!important;
    background:#172c45!important;
    border-color:#365777!important;
    color:#eef5ff!important;
    font-size:12px!important;
    line-height:1!important;
  }

  /* Keep the lead KPI highlighted, but closer to the rest of the dark dashboard. */
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article:first-child{
    background:linear-gradient(145deg,#15263d,#193552)!important;
    border-color:#294763!important;
    color:#edf4ff!important;
    box-shadow:0 8px 24px rgba(0,0,0,.12)!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article:first-child>strong{
    color:#f4f8ff!important;
  }
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #dashboard>.stats article:first-child>:is(span,small){
    color:#a9bfd8!important;
  }

  /* Give neutral Upcoming states enough separation from dark cards. */
  html[data-theme="dark"] body.fi-refined[data-fi-portal="admin"].v4-ready #dueList :is(.badge,.v4-pill):not(.red):not(.amber):not(.green):not(.bad):not(.warn):not(.ok){
    background:#1a2b3e!important;
    color:#b8cadc!important;
    border:1px solid #2c425a!important;
  }
}
