/* Optimitry polish layer v1 - Opteo-grade finish on the existing markup. */

/* Back-to-Audits pill + platform logos (2026-09-27, Aaron). */
a.back-pill {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 10px 0 !important;
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid #d1d5db; background: #fff;
  font-size: .8rem; font-weight: 500; color: #374151 !important;
  text-decoration: none !important; line-height: 1.4;
}
a.back-pill:hover { background: #f3f4f6; border-color: #20AD83; color: #12805f !important; }
.platform-heading { display: inline-flex; align-items: center; gap: 8px; }
.platform-logo { width: 1.1em; height: 1.1em; flex: 0 0 auto; }
img.platform-logo { object-fit: contain; }

/* --- Sticky footer: on any page whose content is shorter than the
   viewport (e.g. a freshly-connected account with little to show yet),
   #footer used to sit directly under the content instead of pinned to the
   bottom of the screen, leaving a band of bare background below it. body
   becomes a column flexbox spanning at least the full viewport height;
   .outer-container (sidebar + main content) is the one child allowed to
   grow, so it absorbs any leftover space and #footer is pushed down to -
   and stays at - the bottom on short pages, while long pages that already
   overflow the viewport are unaffected. --- */
body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
}
.outer-container {
  flex: 1 0 auto !important;
}
#footer {
  flex-shrink: 0;
}

/* --- Sidebar / nav menu: icon and label side by side at ALL sizes.
   The theme absolutely-positions .ml-icon-box, which drops it on top of the
   label text; these rules force a simple flex row everywhere. --- */
.menu-link-item .menu-link-box,
.s-menu-link-item .menu-link-box {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  padding: 11px 18px;
  margin: 2px 8px;
  border-radius: 10px;
  text-align: left !important;
  transition: background .15s ease;
}
.menu-link-item .menu-link-box:hover,
.menu-link-item .menu-link-box:focus {
  background: rgba(255, 255, 255, .16);
}
.menu-link-item .menu-link-box.active {
  background: rgba(255, 255, 255, .22);
  font-weight: 600;
}
.menu-link-item .ml-icon-box,
.s-menu-link-item .ml-icon-box {
  position: static !important;
  transform: none !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 24px !important;
  height: 24px !important;
  flex: 0 0 24px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.menu-link-item .ml-icon-box img { width: 100%; height: auto; }
.menu-link-item .ml-label-box {
  flex: 1 1 auto;
  font-size: .82rem;
  line-height: 1.25;
  letter-spacing: -.01em;
  white-space: normal;
  text-align: left !important;
}
.menu-link-list { padding: 2px 0; }

/* --- Mobile filter drawer --- */
@media (max-width: 991px) {
  .filter-container {
    width: 88vw;
    max-width: 380px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 56px 16px 24px !important;
  }
  .filter-container .fc-box-lower {
    flex-direction: column;
    align-items: stretch !important;
    gap: .5rem;
  }
  /* Timeframe block: stack, fit the drawer, and stay legible on green */
  #timeframe-toggle {
    flex-direction: column;
    align-items: stretch !important;
    gap: .4rem !important;
    margin-bottom: .25rem;
  }
  #timeframe-toggle > span:first-child,
  #tf-count {
    color: rgba(255, 255, 255, .92) !important;
    font-size: .85rem !important;
  }
  #timeframe-toggle .btn-group {
    width: 100%;
    display: flex;
  }
  #timeframe-toggle .btn-group .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: .5rem .25rem;
    font-size: .82rem;
    white-space: nowrap;
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .45);
    color: #fff;
  }
  /* Active pill: white fill needs dark text. Must beat the generic hover rule. */
  #timeframe-toggle .btn-group .btn.active,
  .filter-container .btn-outline-success.active,
  .filter-container .btn-group .btn.active {
    background: #fff !important;
    color: #12805f !important;
    border-color: #fff !important;
    font-weight: 600;
  }
  /* Coverage / helper text inside the green drawer must not be dark grey */
  .filter-container [style*="color:#6b7280"],
  .filter-container [style*="color:#b45309"],
  .filter-container small,
  .filter-container .text-muted {
    color: rgba(255,255,255,.9) !important;
  }
  .filter-container .alert { color: #1f2937; }
  .filter-container .alert a { color: #0f766e; }
  /* Section pills */
  .filter-container .fc-lower-left {
    flex-direction: column;
    gap: .45rem;
    width: 100%;
  }
  .filter-container .fc-lower-left .btn-outline {
    width: 100%;
    text-align: center;
    padding: .7rem 1rem;
  }
  .filter-container .fc-lower-right { width: 100%; margin-top: .5rem; }
  .filter-container .fc-lower-right .btn-outline { width: 100%; justify-content: center; }
  /* Onboarding notice inside the drawer */
  .filter-container .alert { font-size: .85rem; }
  .close-filter { top: 12px; right: 14px; z-index: 5; }
  /* The account selector is a fixed bar above the drawer, so the close
     button must sit below it rather than underneath. */
  .filter-container { padding-top: 78px !important; }
  .close-filter { top: 62px !important; }
}

/* --- Audit page spacing: stop empty/collapsed widgets leaving big gaps --- */
.content-hold-widget:empty,
.content-chart-row:empty,
.chart-body:empty { display: none !important; }

.content-hold-widget { margin-bottom: .75rem; }
.content-hold-widget.is-empty { display: none !important; }

.chart-content-box { padding: .85rem 1rem; }
.chart-body { min-height: 0; }
.chart-body canvas { display: block; }

/* Lazy-loaded charts: reserve a sensible height rather than a tall blank box */
.chart-body canvas:not([data-rendered]) { max-height: 320px; }

.content-chart-row { row-gap: .75rem; }
.main-content-wrapper > .container-fluid { padding-bottom: 1rem; }

/* Tables inside report cards should not add trailing space */
.chart-content-box .table-responsive:last-child,
.chart-content-box table:last-child { margin-bottom: 0; }
.chart-content-box .table > :last-child > tr:last-child > * { border-bottom: 0; }

/* Asset coverage: three levels (Account/Campaign/Ad Group) side by side
   on desktop, stacked on mobile - one compact table cell, not three full-
   width table columns (2026-09-02: basis shrunk from an earlier 220px,
   sized for when these were separate columns spanning the whole table -
   at 220px each, three items plus gaps needed ~684px of width just for
   this one cell to avoid wrapping, which a normal desktop browser often
   couldn't give it once four OTHER columns were also competing for space
   in the same table - reproducing the exact "still stacking on desktop"
   symptom this class exists to prevent. Content here is a short label
   plus a small count like "5 / 5", so 90px is generous, not tight. */
.asset-coverage-levels {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.asset-coverage-levels > * { flex: 1 1 90px; min-width: 0; }
@media (max-width: 767px) {
  .asset-coverage-levels { flex-direction: column; }
  .asset-coverage-levels > * { flex: 1 1 auto; }
  /* Wide report tables scroll rather than squash on a phone */
  .chart-content-box .table-responsive { -webkit-overflow-scrolling: touch; }
  .chart-content-box table { min-width: 520px; }
}

/* Button hover: keep text legible. Several themes lighten the background on
   hover without changing the label colour, leaving text on a similar tone. */
.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: #fff !important;
}
.btn-outline-success:hover,
.btn-outline-success:focus { background-color: #1c9e77 !important; border-color: #1c9e77 !important; }
.btn-outline-secondary:hover,
.btn-outline-secondary:focus { background-color: #4b5563 !important; border-color: #4b5563 !important; }
.btn-outline-danger:hover,
.btn-outline-danger:focus { background-color: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
.btn-default:hover, .btn-default:focus { color: #fff !important; background: #1c9e77 !important; }
.btn-success:hover, .btn-success:focus,
.btn-approve:hover, .btn-approve:focus { color: #fff !important; filter: brightness(1.08); }
/* Inside the green filter drawer the inactive pills are translucent white */
.filter-container .btn-outline-success:hover,
.filter-container .btn-outline-success:focus {
  background: #fff !important; color: #12805f !important; border-color: #fff !important;
}
a.btn:hover, a.btn:focus { text-decoration: none; }

.chart-content-box, .content-hold-widget > div, .card, .apr-card {
  border-radius: 14px !important;
  border: 1px solid #eef1f4 !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .04) !important;
  transition: box-shadow .18s ease, transform .18s ease;
  background: #fff;
}
.content-hold-widget:hover > div,
.chart-content-box:hover {
  box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 10px 24px rgba(16, 24, 40, .08) !important;
}
.chart-title, .table-title, .page-title { letter-spacing: -.01em; font-weight: 600; }
.chart-head, .table-head { padding-bottom: .35rem; border-bottom: 1px solid #f2f4f7; margin-bottom: .5rem; }
.btn-success, .btn-approve { background: linear-gradient(180deg, #23b98c, #1c9e77) !important; border: none !important; }
.btn-success:hover, .btn-approve:hover { filter: brightness(1.05); }
.btn { border-radius: 9px !important; }
.btn-sm { padding: .28rem .65rem; }
table.table thead th, .apr-table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: #667085; font-weight: 600; border-bottom: 1px solid #eef1f4;
}
table.table-sm td, .apr-table td { vertical-align: middle; }
table.table tbody tr:hover, .apr-table tbody tr:hover { background: #fafbfc; }
.alert { border-radius: 12px; border: none; }
.progress { border-radius: 99px; background: #eef1f4; }
.progress-bar { border-radius: 99px; }
.btn-group-sm .btn-outline-success { border-color: #d8e6e0; color: #1c9e77; }
.btn-group-sm .btn-outline-success.active { background: #1c9e77; border-color: #1c9e77; color: #fff; }
::selection { background: #c9f2e5; }
html { scroll-behavior: smooth; }
.chart-empty-state { background: #fafbfc; border-radius: 10px; }
@media (max-width: 640px) {
  .chart-content-box { padding: .6rem !important; }
  .page-title { font-size: 1.15rem; }
}

/* --- Graph sizing, site-wide: fill the available width and keep every
   chart a sane, predictable height regardless of the inline height baked
   into whichever template it lives in (220px/300px/350px/500px etc. show
   up across the report templates).
   ":has(> canvas)" catches the common wrapper pattern used throughout -
   <div style="height:...px"><canvas></canvas></div> - so this applies
   without editing every template individually. Falls back to just the
   canvas itself in browsers without :has() support. !important is needed
   to beat the per-template inline heights.
   NOTE: an earlier version of this rule fixed the height at 150px/250px,
   which was too short for Chart.js charts that have rotated x-axis labels
   and/or a second (right-hand) y-axis - those elements need real vertical
   room, and at 150px they overlapped the bars/lines and became
   unreadable (see e.g. the age-demographic and time/day performance
   charts). 280px/380px gives Chart.js enough room to lay out axes and
   legend properly while still capping runaway inline heights. --- */
canvas,
div:has(> canvas) {
  width: 100% !important;
  max-width: 100% !important;
  height: 280px !important;
  max-height: 280px !important;
}
@media (min-width: 768px) {
  canvas,
  div:has(> canvas) {
    height: 380px !important;
    max-height: 380px !important;
  }
}

/* Performance Score history chart (audits.html): a single-line 0-100 trend
   with no rotated labels or second axis, so it doesn't need the 380px the
   general desktop rule above gives every chart - that read as "insanely
   high" for what's a simple sparkline-style chart. The id selector here
   out-specifies the generic ".../div:has(> canvas)" rule (including at the
   768px breakpoint) so this one card stays at a fixed, sane 260px on both
   mobile and desktop. */
#scoreHistoryChart,
div:has(> #scoreHistoryChart) {
  height: 260px !important;
  max-height: 260px !important;
}

/* Asset Coverage mini pie-chart grid (asset_coverage_report.html): several
   small square pies side by side (col-6 / col-lg-3), not one full-width
   chart. The generic canvas rule above forces every canvas to 280-380px
   tall regardless of its column width, which stretched each circular pie
   into a tall oval. These need to opt out and stay small + square instead,
   same idea as the #scoreHistoryChart carve-out just above. */
#asset-coverage-charts canvas {
  width: 100% !important;
  max-width: 140px !important;
  height: 140px !important;
  max-height: 140px !important;
  margin: 0 auto;
  display: block;
}
/* FIXED (2026-09-09, Aaron: "You are still stacking the pie charts") - the
   generic "div:has(> canvas)" rule above also forces width:100% !important
   on ANY div whose direct child is a canvas. Each chart's Bootstrap column
   wrapper (.col-6.col-md-4.col-lg-3 in asset_coverage_report.html) has the
   <canvas> as a direct child, so it matched too - width:100% !important
   silently overrode col-6/col-md-4/col-lg-3's 50%/33.3%/25% widths and
   forced every column to the full row width, stacking them one per row
   regardless of the Bootstrap grid classes. The height-only override below
   fixed the OVAL-pie symptom but never freed width, so the stacking
   symptom stayed.
   Restoring width:auto here would have been the wrong fix too - it would
   have replaced Bootstrap's deliberate 50/33.3/25% split with pure
   content-based auto-sizing (every column exactly canvas-width, as many
   per row as fit, ignoring the col-6/col-md-4/col-lg-3 breakpoints
   entirely). Instead this re-declares the SAME percentages Bootstrap's own
   col-6/col-md-4/col-lg-3 classes already specify, at the SAME breakpoints
   (768px/992px, Bootstrap's own md/lg), so the intended 2-per-row mobile /
   3-per-row tablet / 4-per-row desktop layout is restored exactly rather
   than approximated. */
#asset-coverage-charts div:has(> canvas) {
  height: auto !important;
  max-height: none !important;
  width: 50% !important;
  max-width: 50% !important;
}
@media (min-width: 768px) {
  #asset-coverage-charts div:has(> canvas) {
    width: 33.3333% !important;
    max-width: 33.3333% !important;
  }
}
@media (min-width: 992px) {
  #asset-coverage-charts div:has(> canvas) {
    width: 25% !important;
    max-width: 25% !important;
  }
}

/* --- Footer nav columns: on all pages, at every breakpoint (2026-08-31).
   style_new.css had a stray mobile rule of `column-gap: 320px` on
   .footer-nav-list (fixed at its source too - was very likely a typo for
   32px), which on any viewport wide enough to fit two items per row blew a
   huge gap between them while each item's own box stayed exactly as wide
   as its label - reading as "columns are too narrow, with way too much
   space between them". This sets a small, consistent gap at every
   breakpoint rather than relying on breakpoint-specific rules scattered
   through the legacy stylesheet, and lets items size to their content
   instead of stretching or shrinking oddly. !important beats the
   remaining legacy per-breakpoint rules. --- */
.footer-nav-list {
  column-gap: 28px !important;
  row-gap: 14px !important;
  max-width: 100% !important;
}
.footer-nav-item {
  flex: 0 0 auto !important;
  width: auto !important;
}
.footer-nav-box {
  white-space: nowrap;
}

/* --- Link hover affordance, site-wide (2026-09-03, Aaron: "every link
   had a hover over so that we know its a link"). Many links in this app's
   report content sit with the theme's default anchor underline stripped
   (see e.g. optimitry-polish.css's own a.btn:hover rule above, which
   exists because .btn anchors specifically had this problem) - nothing
   currently distinguishes clickable text from plain text until it's
   clicked. A permanent underline on every link would clutter dense report
   pages that mix plain labels and real links, so this adds it only on
   hover/focus instead - keyboard focus gets the same treatment as mouse
   hover, not just visual mouseover, since a hover-only rule leaves
   keyboard navigation with no affordance at all.
   Scoped to actual inline content links - :not(.btn) and :not([class*="tab-btn"])
   excludes every button-styled anchor (regular .btn's, and any *-tab-btn
   pattern like .rrf-tab-btn), which already have their own distinct hover
   treatment and would look wrong underlined. */
/* --- Link hover affordance, site-wide (2026-09-03, Aaron: "every link
   had a hover over so that we know its a link", refined same day: "Remove
   the underline from the hover over... where there is no highlighting
   such as text links then you can use underline but where there is any
   borders or backgrounds being added on hover over there's no need to add
   the underline. Basically only add the underline when it is text only").
   So this only underlines a link that has NO OTHER hover treatment of its
   own - a plain text link sitting in report copy, a breadcrumb, a footer
   nav label. Anything that already gets a border/shadow swap
   ([class*="-card"] - e.g. .spend-hub-card) or a background swap
   (.menu-link-box - the sidebar/footer nav items) is excluded, alongside
   the pre-existing .btn/tab-btn exclusions, so a link never gets BOTH an
   underline AND its own highlight fighting for attention at once. */
a:not(.btn):not([class*="tab-btn"]):not(.menu-link-box):not([class*="-card"]):hover,
a:not(.btn):not([class*="tab-btn"]):not(.menu-link-box):not([class*="-card"]):focus {
  text-decoration: underline;
}

/* Sidebar header padding (2026-09-22, Aaron: "decrease the font size in
   the main nav and reduce the top padding / margin" - follows the same
   2026-09-03 override below, tightened further). Top padding halved
   (20px -> 8px) to pull the menu list up closer to the logo/welcome
   block; right/bottom/left left as the 2026-09-03 values. */
.sidebar-head {
  padding: 0 40px 15px 40px !important; /* top removed 2026-09-28 (Aaron); logo link carries its own 10px top/bottom */
}

/* Sidebar footer top margin (2026-09-04, Aaron: ".sidebar-footer
   margin-top: 60px; needs changing to 0"). style_new.css sets this to
   60px inside its own @media (max-width:1599.98px) block - !important
   beats it at that same breakpoint, same override pattern as
   .sidebar-head just above. The BASE (non-media-query) .sidebar-footer
   rule in style_new.css still sets margin-top:98px above 1600px width -
   left as-is, since Aaron's instruction quoted this exact 60px rule
   specifically, not the wider-screen one. */
@media (max-width:1599.98px) {
  .sidebar-footer {
    margin-top: 0 !important;
  }
}

/* Sidebar bottom padding (2026-09-22, Aaron: "reduce the padding at the
   bottom of the sidebar nav"). style_new.css sets .sidebar-body's own
   padding to "20px 15px" (bottom included) AND base_new.html sets an
   inline min-height:600px on the same element - on most accounts the menu
   list is shorter than 600px, so that inline min-height was the larger
   visible gap between the last menu item and the Logout footer, not the
   20px CSS padding alone. External !important CAN beat an inline style
   for the same property, so this overrides both from here rather than
   editing the inline HTML. */
.sidebar-body {
  min-height: 0 !important;
  padding-bottom: 8px !important;
}

/* Page intro paragraph directly under .main-content-wrapper > .container-
   fluid.py-3 (2026-09-22, Aaron, via a literal DOM path: "body >
   div.outer-container.d-xl-flex > div:nth-of-type(3).main-content-wrapper
   > div.container-fluid.py-3 > p"). No specific values were given, so
   this adds a modest, reversible amount of breathing room above/below -
   revisit if a different amount is wanted. Scoped narrowly (direct child
   of .container-fluid.py-3 only) so it does not touch every <p> inside
   report cards/widgets elsewhere on the page. */
/* Report-table font-size BASELINE (2026-09-22, Aaron: "Restructure
   Opportunities table font size too big. Check other tables also. We
   need more consistency in terms of fonts and font sizes."). Confirmed
   cause for that specific one: se_rebuild_report_full.html's table has
   NO font-size anywhere (unlike its own embedded-card sibling,
   se_rebuild_report.html, which inherits style_new.css's `.table-body
   .table thead th/td{font-size:12px}` rule via a `.table-body` wrapper
   div it happens to have) - falls through to the page's own 16px body
   font, roughly a third larger than every other report table in this
   app (which mostly sit in the .82rem-.88rem range, set either via that
   same .table-body rule or an inline style per table/cell).
   Rather than hand-audit and patch each of this app's 150+ report
   templates individually for the same gap, this sets ONE baseline for
   the two content-wrapper classes every report widget/full-page table
   already sits inside (.table-content-box, .chart-content-box) at .84rem
   - the rough middle of the range already in use elsewhere. Deliberately
   NOT !important: a table with its own more specific inline style or
   class-based rule (the common case already) keeps that value untouched
   via normal CSS specificity/inline-wins - this only fills tables that
   currently have no sizing at all, which is exactly the inconsistency
   being fixed, not a blanket override of tables already sized on
   purpose. */
.table-content-box table.table th, .table-content-box table.table td,
.chart-content-box table.table th, .chart-content-box table.table td {
  font-size: .8rem; /* was .84rem - reduced 2026-09-23 (Aaron: report text too big) */
}

/* Mobile text inflation fix (2026-09-23, Aaron screenshots: asset coverage
   campaign list, Missing Display Paths table and Top Tasks text "too big").
   Chrome Android's text autosizer boosts text inside blocks wider than the
   viewport (report tables are min-width:520px on mobile) - wrapped text was
   rendering ~30% larger than its CSS size. 100% disables the boost while
   keeping user pinch-zoom. */
html, body {
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}
@media (max-width: 767px) {
  /* !important (2026-09-23, Aaron: Audit History "text is too big too") -
     some legacy rules and bare .table cells were still rendering ~16px on
     phones. Applies to every report/history table in a content card. */
  .table-content-box table.table td, .chart-content-box table.table td,
  .content-hold-widget table.table td { font-size: .74rem !important; }
  .table-content-box table.table thead th, .chart-content-box table.table thead th,
  .content-hold-widget table.table thead th { font-size: .64rem !important; }
  .content-hold-widget .chart-title, .content-hold-widget .table-title { font-size: .92rem !important; }
  .pr-table-pagination, .pr-table-pagination .btn, .pr-table-pagination .form-select { font-size: .74rem !important; }
  .content-hold-widget .pagination .page-link { font-size: .78rem; padding: .3rem .6rem; }
}
@media (max-width: 767px) and (min-width: 99999px) {
  /* superseded by the !important mobile block above */
}

.main-content-wrapper > .container-fluid.py-3 > p {
  margin: 0 0 16px !important;
  padding: 8px 0 !important;
}

/* Sidebar body bottom padding (2026-09-22, Aaron: "reduce the padding at
   the bottom off the sidebar body"). style_new.css sets .sidebar-body to
   padding:20px 15px on desktop and padding:15px 45px 37px 25px below
   1199.98px - only the BOTTOM side is touched here via padding-bottom, so
   top/left/right (and the mobile overlay's own centering layout) are
   left alone, same targeted-override approach as the rest of this file. */
.sidebar-body {
  padding-bottom: 6px !important;
}
@media (max-width: 1199.98px) {
  .sidebar-body {
    padding-bottom: 16px !important;
  }
}

/* Mobile width fixes (2026-10-02, Aaron screenshots: Change Approvals table
   squashed to a sliver at the right edge with the Reason column wrapping one
   letter per line; Meta overview "Year-on-year" pill running off-screen).
   - .apr-table is width:100% with 8 columns, so on a phone every column
     shrank to its minimum and Reason got ~0px. The tables already sit in an
     overflow-x:auto wrapper, so a min-width gives the columns real room and
     the wrapper scrolls sideways instead of crushing them.
   - Bootstrap's .badge is white-space:nowrap, so a long badge/pill forces the
     whole page wider than the screen. Let it wrap on phones.
   - overflow-x:clip on the content wrapper stops any remaining oversize child
     widening the page (clip, not hidden, so position:sticky still works). */
@media (max-width: 767px) {
  .apr-table { min-width: 680px; }
  #pending-table { min-width: 760px; }
  #pending-table .apr-change-cell { min-width: 190px; }
  #pending-table .apr-reason-cell { min-width: 250px; }
  .apr-table th, .apr-table td { font-size: .74rem; padding: 7px 8px; }
  .main-content-wrapper .badge { white-space: normal; text-align: left; max-width: 100%; }
  .main-content-wrapper { max-width: 100%; overflow-x: clip; }
}

/* === SIDEBAR FIT-TO-SCREEN (2026-10-06, Aaron: "fit the sidebar menu on to the screen without the need to scroll
   on my laptop"). Desktop (xl+) only. Everything that sets the menu's height scales with the viewport HEIGHT via
   clamp(min, vh, max): short laptop screens compress the menu to fit, tall screens keep the roomier look (the
   maxima are the previous values or smaller). The old padding/gaps (46px items + 14-18px gaps + 24px footer
   padding) added up to ~850px, more than a laptop viewport. overflow-y:auto stays as a last-resort fallback for
   very short windows only. Mobile/tablet (the #header + collapsed nav) is untouched. */
@media (min-width: 1200px) {
  .sidebar-wrapper .sidebar-head { padding: 0 32px clamp(2px, .8vh, 12px) 32px !important; }
  .sidebar-wrapper .sidebar-head .logo-area a { padding: clamp(4px, 1vh, 10px) 0 !important; }
  .sidebar-wrapper .sidebar-head .logo-area img { max-height: clamp(26px, 5vh, 40px) !important; }
  .sidebar-wrapper .sidebar-body { padding: 2px 12px clamp(2px, .6vh, 8px) !important; min-height: 0 !important; display: block !important; }
  .sidebar-wrapper .menu-link-list { padding: 0 !important; }
  .sidebar-wrapper .menu-link-item + .menu-link-item { margin-top: clamp(0px, .45vh, 6px) !important; }
  .sidebar-wrapper .menu-link-item .menu-link-box { padding: clamp(3px, .85vh, 10px) 16px !important; margin: 1px 6px !important; gap: 11px !important; }
  .sidebar-wrapper .menu-link-item .ml-icon-box { width: clamp(18px, 3vh, 24px) !important; height: clamp(18px, 3vh, 24px) !important; flex: 0 0 clamp(18px, 3vh, 24px) !important; }
  .sidebar-wrapper .menu-link-item .ml-label-box { font-size: clamp(.76rem, 1.9vh, .86rem) !important; line-height: 1.2 !important; }
  .sidebar-wrapper .sidebar-footer { margin-top: 0 !important; padding: 0 12px !important; }
  .sidebar-wrapper .sidebar-footer .s-menu-link { padding: clamp(4px, 1vh, 16px) 0 clamp(4px, 1vh, 12px) !important; }
  .sidebar-wrapper .sidebar-footer .logout-link-box { padding: clamp(3px, .8vh, 6px) 12px !important; }
  .sidebar-wrapper .sidebar-inside.sticky-top { padding-bottom: 0 !important; }
}

/* === CHROME FLOW (2026-10-06, Aaron: "the header, sidebar and footer are all too clunky and don't flow") ===
   1. The sticky sidebar used top:0, so on scroll its logo and first items slid UNDER the fixed header bar. It now
      sticks BELOW it: base_new.html's applyOffset() publishes the measured bar height as --topbar-h.
   2. Header bar, sidebar and footer were three differently-coloured blocks (two gradients that did not line up and a
      flat grey footer). They now share ONE gradient painted with background-attachment:fixed, so the pieces read as
      a single continuous frame. White-label branding still wins (--brand-primary exists only while presenting).
   3. Header bar: content starts at the page column instead of floating mid-bar; account picker is a pill; search
      sits at the right edge. Footer: compact, same frame colour, links readable (white on #B3B3B3 was not).
   Desktop-only parts are inside the min-width:1200px query; the mobile header/menu is untouched. */
:root { --topbar-h: 0px; --chrome-bg: linear-gradient(313deg, #2dab66 0%, #00afa9 100%); }
.sidebar-wrapper, #footer { background: var(--brand-primary, var(--chrome-bg)); background-attachment: fixed; }
#account-selector-bar { background: var(--brand-primary, var(--chrome-bg)) !important; background-attachment: fixed !important; }

#footer { border-top: 0; }
#footer .footer-upper { padding: 14px 0 4px !important; }
#footer .footer-nav-list { column-gap: 22px !important; row-gap: 6px !important; margin-bottom: 0 !important; }
#footer .footer-nav-item { margin-bottom: 0 !important; }
#footer .footer-nav-box { color: #fff; opacity: .92; }
#footer .footer-nav-box:hover { opacity: 1; }
#footer .footer-nav-label { font-size: .8rem !important; }
#footer .footer-lower { padding: 8px 0 12px !important; margin-top: 8px !important; border-top: 1px solid rgba(255, 255, 255, .28) !important; }
#footer .footer-lower .copyright { font-size: .74rem !important; opacity: .85; }

@media (min-width: 1200px) {
  .sidebar-wrapper .sidebar-inside.sticky-top { top: var(--topbar-h, 0px) !important; max-height: calc(100vh - var(--topbar-h, 0px)) !important; }
  .sidebar-wrapper { position: relative; z-index: 2; box-shadow: 2px 0 10px rgba(0, 0, 0, .10); }
  .sidebar-wrapper .sidebar-head { margin: 0 16px 6px !important; border-bottom: 1px solid rgba(255, 255, 255, .22); }
  .sidebar-wrapper .sidebar-footer .s-menu-link { border-top-color: rgba(255, 255, 255, .22) !important; }
  #account-selector-bar { justify-content: flex-start !important; gap: 12px !important; padding: 7px 28px 7px calc(294px + 22px) !important; }
  #account-selector-bar .account-label { font-weight: 600; letter-spacing: .02em; }
  #accountSelectorDropdown { background-color: rgba(255, 255, 255, .16) !important; border: 1px solid rgba(255, 255, 255, .5) !important;
                             border-radius: 999px !important; padding: 5px 32px 5px 14px !important; font-size: .84rem !important; cursor: pointer; }
  #accountSelectorDropdown:hover { background-color: rgba(255, 255, 255, .24) !important; }
  #account-selector-bar .app-search { margin-left: auto; flex: 0 1 440px; min-width: 240px; }
  /* 2026-10-06 (Aaron: "add 10% separators between each item in side nav"): white at 10% opacity between items. The old
     gap is split half above / half below the line so it sits centred and the menu's total height is unchanged. */
  .sidebar-wrapper .menu-link-item + .menu-link-item { border-top: 1px solid rgba(255, 255, 255, .10); margin-top: clamp(0px, .22vh, 3px) !important; padding-top: clamp(0px, .22vh, 3px); }
}

/* === TOP-NAV STATUS CHIPS (2026-10-07) - slim bar shown on the pages where #account-selector-bar is hidden by design
   (Dashboard, Account Connections) so the autopilot / daily-audit chips are visible everywhere. Same frame colour + alignment. */
#topnav-status-bar { background: var(--brand-primary, var(--chrome-bg)); background-attachment: fixed; color: #fff; padding: 6px 16px;
                     display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (min-width: 1200px) { #topnav-status-bar { padding: 7px 28px 7px calc(294px + 22px); } }

/* === 2026-10-07 UX BATCH ===
   (a) TOP BAR IN FOUR QUARTILES (Aaron: "split the top nav into 4 quartiles"): account | autopilot | daily audits | search,
       equal widths across the content area (right of the sidebar), thin dividers between them. Desktop only; below 1200px the
       bar keeps its wrapping flex layout. The slim bar on Dashboard/Account Connections keeps the chips in quartiles 2 and 3 so
       they do not jump between pages.
   (b) APPROVALS REASON COLUMN (Aaron screenshot: reason squeezed into a ~110px strip making rows hundreds of pixels tall): the
       column gets a real width, the text is clamped to 3 lines with "Show more", and the three action buttons stack so they stop
       eating the row.
   (c) Audit Scheduling status badges. */
@media (min-width: 1200px) {
  #account-selector-bar, #topnav-status-bar { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto minmax(0, 1fr); grid-auto-flow: column; gap: 0 !important;
                                              align-items: center; padding: 7px 28px 7px calc(294px + 22px) !important; }
  #tn-status { display: contents; }
  #account-selector-bar > .tn-q-account { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 14px; }
  #account-selector-bar #accountSelectorDropdown { flex: 1 1 auto; width: 100%; max-width: none !important; min-width: 0; }
  #account-selector-bar > #tn-ap-item, #account-selector-bar #tn-ap-item, #account-selector-bar #tn-au-item,
  #topnav-status-bar #tn-ap-item, #topnav-status-bar #tn-au-item,
  #account-selector-bar > .app-search { border-left: 1px solid rgba(255, 255, 255, .30); padding: 0 14px; }
  #account-selector-bar > .app-search { margin: 0 !important; flex: none; min-width: 0 !important; max-width: none !important; width: auto; padding-right: 0; }
  #tn-ap-item, #tn-au-item { display: flex; min-width: 0; }
  #topnav-status-bar #tn-ap-item { grid-column: 2; }
  #topnav-status-bar #tn-au-item { grid-column: 3; }
  /* 2026-11-18: the Guide chip (a 5th item) used to take the 4th cell and push search onto a second row. It now has its own auto-width cell. */
  #tn-guide-item { display: flex; min-width: 0; padding: 0 14px; border-left: 1px solid rgba(255, 255, 255, .30); }
  #topnav-status-bar #tn-guide-item { grid-column: 4; }
  #tn-ap-item .tn-chip, #tn-au-item .tn-chip { width: 100%; min-width: 0; }
  .tn-chip .tn-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
}

#pending-table th:nth-child(5), #pending-table td.apr-reason-cell { min-width: 300px; width: 32%; max-width: 480px; }
.apr-reason-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.apr-reason-wrap.open .apr-reason-clamp { -webkit-line-clamp: unset; display: block; overflow: visible; }
.apr-reason-wrap.has-more { cursor: pointer; }
.apr-reason-wrap.has-more::after { content: "Show more \25BE"; display: block; margin-top: 3px; font-size: .72rem; font-weight: 600; color: #0f766e; }
.apr-reason-wrap.has-more.open::after { content: "Show less \25B4"; }
#pending-table td:last-child { white-space: normal !important; width: 150px; min-width: 150px; }
#pending-table td:last-child .btn-approve { display: block; width: 100%; margin: 0 0 6px 0 !important; }
#pending-table td:last-child .btn-reject, #pending-table td:last-child .btn-ignore { display: inline-block; margin: 0 0 0 6px !important; }

.sch-badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #f3f4f6; color: #6b7280; white-space: nowrap; }
.sch-badge.ok { background: #dcfce7; color: #166534; } .sch-badge.bad { background: #fee2e2; color: #991b1b; }
.sch-badge.run { background: #dbeafe; color: #1e40af; } .sch-badge.warn { background: #fef3c7; color: #92400e; }
.sch-sub { font-size: .72rem; color: #6b7280; margin-top: 2px; white-space: normal; max-width: 280px; }

/* === REPORT TABLE CLARITY (2026-10-20, Aaron: "tables are unclear when presented") ===
   One baseline for every report table inside a content card. The approvals card (.apr-card) is excluded:
   it has its own table styling. Colour/typography only - no column widths or markup are changed. */
.table-content-box:not(.apr-card) table.table thead th,
.chart-content-box:not(.apr-card) table.table thead th {
  background: #f4f7f6;
  color: #374151;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: bottom;
  border-bottom: 2px solid #dbe3e0;
}
.table-content-box:not(.apr-card) table.table tbody td,
.chart-content-box:not(.apr-card) table.table tbody td {
  vertical-align: middle;
  border-bottom: 1px solid #eef1f0;
  font-variant-numeric: tabular-nums;
}
.table-content-box:not(.apr-card) table.table tbody tr:nth-child(even) > td,
.chart-content-box:not(.apr-card) table.table tbody tr:nth-child(even) > td { background: #fafcfb; }
.table-content-box:not(.apr-card) table.table tbody tr:hover > td,
.chart-content-box:not(.apr-card) table.table tbody tr:hover > td { background: #eef7f3; }
