/* Status indicator animation */
.status-indicator {
  animation: fadeOut 2s ease-in-out forwards;
  animation-delay: 0s;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.mapping-row .copy-down-btn {
  display: none;
}

.mapping-row:first-child .copy-down-btn {
  display: inline;
}

.mapping-row:only-child .copy-down-btn {
  display: none;
}

.indicator {
  .text-success {
    color: #00B589;
  }

  .text-danger {
    color: rgb(255, 119, 119);
  }
}

.delta-pill {
  display: inline-block;
  font-size: var(--app-text-xs);
  font-weight: 200;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  background-color: var(--app-bg-sheet);
  border: 1px solid var(--app-bg-wash);
  color: #646464;

  &.success {
    background-color: var(--app-ok-bg);
    border-color: var(--app-ok-fg);
    color: var(--app-ok-fg);
  }

  &.loss {
    background-color: var(--app-danger-bg);
    border-color: var(--app-danger);
    color: var(--app-danger);
  }
}

/* Global table defaults live in hocos-ci.css via Bootstrap table variables.
   Keep feature-specific table variants below. */

/* Table form inputs: make controls visible inside table cells */
.form-control,
.form-select {
  background-color: var(--app-bg-muted);
  border: 1px solid var(--hc-sage-400, var(--bs-border-color));
  min-height: 2rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.datev-integration {
  .datev-fields {
    display: none;
  }

  &:has(#datev_integration_enabled:checked) {
    .datev-fields {
      display: block;
    }
  }
}

ol li.list-group-item.active {
  background-color: var(--app-accent-yellow);
  color: var(--app-fg-muted);
  border-radius: 4px;
  border: transparent;
}


/* SIDEBAR */
.sidebar {
  background: #D8DFD4;
}


.nav-link,
.nav-link.collapsed {
  /* background: #D8DFD4; */

  &:hover {
    background: #83947c;
    text-decoration: none;
  }
}

.nav-link.active {
  font-weight: bold;
}

/* HEADER NAV */
.header-nav .nav-profile {
  color: #1B2217;
}

/* DASHBOARD */
.dashboard a:hover .result-card {

  &:hover,
  &:focus {
    z-index: 1;
    color: var(--bs-body-color);
    text-decoration: none;
    background-color: var(--app-bg-muted);
  }
}

.dashboard .widget-chart {
  margin: -48px -20px;
  margin-bottom: -64px;
}

/* Info Cards */

.dashboard .result-card {
  padding-bottom: 10px;
  border-radius: 16px;
}

.dashboard .result-card h6 {
  font-size: 28px;
  color: var(--bs-body-color);
  font-weight: 300;
  margin: 0;
  padding: 0;
}

.dashboard .card-icon {
  font-size: 32px;
  line-height: 0;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  flex-grow: 0;
}

.dashboard .result-card .card-icon {
  /* color: #895a3a;
  background: #f9f1eb; */
  color: #50594C;
  background: #F0F5ED;
}

.dashboard .kpi-card .card-body {
  padding: 0px 20px 0 20px;
  margin: 0;
}

/* COMPONENTES */
/* Analysis Table  */
table.analysis {
  font-size: smaller;
}

table.analysis>thead {
  vertical-align: top;
}

table.analysis td.h3-row {
  font-weight: bold;
}

table.analysis th>.subheader {
  font-weight: normal;
  font-size: smaller;
}

table td.currency,
table th.currency {
  text-align: right;
}

table td.percentage,
table th.percentage {
  text-align: right;
  font-size: 0.9em;

  /* COST CENTERS */
  .tree-view {
    ul {
      border-left: 1px solid #dee2e6;

      li {
        position: relative;
        padding: 0.5rem 0;

        &:before {
          content: '';
          position: absolute;
          left: -1rem;
          top: 1.2rem;
          width: 1rem;
          height: 1px;
          background: #dee2e6;
        }
      }
    }
  }
}

/* Admin: code color; changelog markdown (Kramdown has no Bootstrap — overflow + simple tables) */
.admin {
  code {
    color: var(--app-fg-muted);
  }

  &.changelog-markdown {

    .changelog-markdown-body {
      max-width: 100%;
      overflow-x: auto;

      h1,
      h2,
      h3,
      h4,
      h5,
      h6 {
        margin-top: 0.5rem;
        margin-bottom: 0.2rem;
        font-size: 1rem;
      }

      h2 {
        font-size: 1.5rem;
      }

      pre {
        overflow-x: auto;
      }

      table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 1rem;
      }

      th,
      td {
        border: 1px solid var(--bs-border-color);
        padding: 0.35rem 0.5rem;
        vertical-align: top;
      }
    }
  }
}


/* KPI PAGE - Minimal styling using existing global standards */
.category-header {
  background-color: var(--hc-ink-300);
  border-bottom: 1px solid var(--hc-ink-300);
}

.kpi-grid {
  background-color: var(--bs-body-bg);
}


.table-results {
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--app-text-sm);

  tr td {
    position: relative;
    background-color: var(--app-bg-sheet);
    border-bottom: 1px solid var(--app-bg-sheet);
    border-top: 1px solid var(--app-bg-sheet);
    padding-top: 0.3125rem;
    padding-bottom: 0.3125rem;
  }

  tr td.label {
    width: 20%;
  }

  a {
    text-decoration: underline;
    color: var(--app-link);
  }

  thead {
    tr:first-child {
      th.section {
        border-top-left-radius: 6px;
        border-top-right-radius: 6px;
        corner-shape: squircle;
        background-color: var(--app-chrome);
        color: var(--app-fg-on-inverse);
        text-align: center;
      }

      th.first-section {
        border-right: 1px solid var(--app-bg-sheet);
      }

      th.last-section {
        border-left: 1px solid var(--app-bg-sheet);
      }
    }

    tr.row2 th {
      background-color: var(--app-bg-wash);
      text-align: center;

      &:not(.section-start) {
        border-left: 1px solid var(--app-bg-sheet);
      }

      &:not(.section-end) {
        border-right: 1px solid var(--app-bg-sheet);
      }

    }

    tr.row3 th {
      background-color: var(--app-bg-sheet);
    }

    tr th {
      background-color: var(--app-bg);
    }

    tr.row1 th:first-child {
      background-color: var(--app-bg-sheet);
    }

    tr:first-child th {
      border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    }

    border-bottom: transparent;

    &.header-sticky th {
      padding: 0.5rem;
      text-wrap: nowrap;
    }
  }

  .section-start {
    border-left: 1px solid var(--app-chrome);

    &::before {
      content: "";
      position: absolute;
      background-color: var(--app-chrome);
      width: 1px;
      height: calc(100% + 2px);
      top: -1px;
      left: -1px;
    }
  }

  .section-end {
    border-right: 1px solid var(--app-chrome);

    &::after {
      content: "";
      position: absolute;
      background-color: var(--app-chrome);
      width: 1px;
      height: calc(100% + 2px);
      top: -1px;
      right: -1px;
    }
  }

  tbody {

    tr.account,
    tr.area {
      td {
        color: var(--hc-neutral-600)
      }

      td.value {
        background-color: var(--app-bg);
      }

      td.diff {
        background-color: var(--app-bg-sheet);
      }

      td.diff:has(+ td.diff) {
        border-left: 1px solid var(--app-bg-wash)
      }
    }

    tr.summary-row-revenue td {
      background-color: var(--app-bg-wash);
      font-weight: 600;
      border-bottom: 1px solid var(--app-bg-sheet);
      border-top: 1px solid var(--app-bg-sheet);
    }

    tr.area td {
      font-weight: 600;
    }

    [class^="summary-row-"] {
      cursor: default;

      .label {
        padding-left: 2rem;
      }

      td {
        color: var(--hc-neutral-950);
      }
    }

    tr.summary-row-final td {
      background-color: var(--app-chrome);
      color: var(--app-fg-on-inverse);

      &::after {
        display: none;
      }

      &::before {
        display: none;
      }

      &.section-end {
        border-right: 0px;
        border-bottom-right-radius: 6px;
      }

      &.section-start:not(.label+.section-start) {
        border-left: 0px;
        border-bottom-left-radius: 6px;
      }
    }
  }

  .currency {
    vertical-align: bottom;
  }

  .percentage {
    vertical-align: bottom;
    padding-left: 0;
  }

  /* Indentation levels for tree structure */
  .indent-1 {
    padding-left: 1.75rem;
  }

  .indent-1-5 {
    padding-left: 3rem;
  }

  .indent-2 {
    padding-left: 3.75rem;
  }

  .indent-3 {
    padding-left: 4.5rem;
  }

  .indent-4 {
    padding-left: 6rem;
  }

  .indent-5 {
    padding-left: 7.5rem;
  }

  .revenue-sum,
  .area-sum,
  .title,
  .center-name {
    cursor: default;
    font-size: 1rem;
  }

  .revenue-sum {
    font-weight: bold;
  }

  .area-sum {
    font-weight: 600;
  }



  /* Discreet line borders for all data rows */

  tdbody tr:hover:not(.title, .center-name) td {
    background-color: var(--app-bg-sheet) !important;
  }

  /* Tree toggle icon */
  .tree-toggle-icon {
    display: inline-block;
    margin-right: 0.5rem;
    cursor: pointer;
  }

  /* Currency cell with font weight */
  .currency-bold {
    padding: 0.3rem 0.75rem;
    font-weight: bold;
  }

  /* Percentage cell with font weight */
  .percentage-medium {
    font-weight: 500;
  }

}

/* Sticky statement header — only in the simplified layout, whose fixed header
   has a known height to offset against. The three header rows stack directly
   beneath it so the month/column labels stay visible while scrolling. */
.simplified-main .table-results thead.header-sticky {
  --sticky-top: calc(var(--app-header-height) + var(--app-admin-bar-height, 0px));
  --sticky-row-height: 2rem;

  th {
    position: sticky;
    z-index: 10;
    padding-block: 0;
    line-height: var(--sticky-row-height);
  }

  tr.row1 th {
    top: var(--sticky-top);
  }

  tr.row2 th {
    top: calc(var(--sticky-top) + var(--sticky-row-height));
  }

  tr.row3 th {
    top: calc(var(--sticky-top) + (2 * var(--sticky-row-height)));
  }
}

.income-statement-yearly-scroll {
  max-width: 100%;

  &.is-yearly-mode {
    /* Own the scroll on both axes so the header (sticky top) and the label/year
       columns (sticky left) freeze against this one box. The table-viewport
       controller sets max-height inline to fill the remaining viewport, keeping
       the whole table in a single inner scrollbar with no page scroll; this calc
       is the JS-off fallback. */
    overflow: auto;
    max-height: calc(100vh - var(--app-header-height) - var(--app-admin-bar-height, 0px) - 10rem);

    /* Query container so the section label can size itself to the VISIBLE width
       (100cqi) rather than the full scrolled table width — used for centering. */
    container-type: inline-size;

    /* keep first label + year pair visible while months scroll */
    --sticky-label-width: 18rem;
    --sticky-year-width: 10rem;
    --sticky-year-total-offset: calc(var(--sticky-label-width) + var(--sticky-year-width));

    /* Header rows stick to the top of THIS scroll box (0-based), overriding the
       page-scroll offset the non-yearly (monthly) layout uses. */
    thead.header-sticky {
      /* Above the frozen body columns (18/20) so the whole header row — including
         the non-frozen section bar — covers them instead of letting the year
         column peek through while scrolling. */
      th { z-index: 25; }

      tr.row1 th { top: 0; }
      tr.row2 th { top: var(--sticky-row-height); }
      tr.row3 th { top: calc(2 * var(--sticky-row-height)); }
    }

    /* Keep the section label (e.g. "Geschäftsjahr") centered in the visible area
       while the columns scroll under it — pure CSS so it tracks the scroll with no
       flicker. The label is a block as wide as the visible area, pinned to the left
       of the scrollport (sticky) with its text centered; the negative margin undoes
       the frozen label column's offset so the text lands on the true visible centre. */
    th.section .section-label {
      position: sticky;
      left: 0;
      display: block;
      width: 100cqi;
      margin-left: calc(-1 * var(--sticky-label-width));
      text-align: center;
    }

    .table-income-statement {
      min-width: max-content;

      .sticky-col-label {
        position: sticky;
        left: 0;
        width: var(--sticky-label-width);
        min-width: var(--sticky-label-width);
        max-width: var(--sticky-label-width);
        z-index: 20;
      }

      tbody td.sticky-col-label {
        background-color: var(--app-bg-sheet);
      }

      tbody tr[class*="results-row"] td.sticky-col-label {
        background-color: var(--tree-row-bg, var(--app-bg-sheet));
      }

      thead th.sticky-col-label {
        background-color: var(--app-bg-sheet);
      }

      td.sticky-col-year,
      th.sticky-col-year {
        position: sticky;
        left: var(--sticky-label-width);
        min-width: var(--sticky-year-width);
        z-index: 18;

        &.percentage {
          left: var(--sticky-year-total-offset);
        }
      }

      tbody td.sticky-col-year {
        background-color: var(--app-bg-sheet);
      }

      tbody tr[class*="results-row"] td.sticky-col-year {
        background-color: var(--tree-row-bg, var(--app-bg-sheet));
      }

      th.sticky-col-year {
        background-color: var(--app-bg-sheet);
      }

      thead {
        th.sticky-col-label {
          z-index: 34;
        }

        th.sticky-col-year {
          z-index: 32;
        }
      }
    }
  }
}

/* Toolbar above the yearly statement table (gear + fullscreen toggle). It sits in
   normal flow on the light sheet — no overlap with the table — so the controls are
   always visible and clickable regardless of scroll position. */
.statement-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;

  /* Both controls sit on the light sheet here, so use the muted foreground (the
     gear's default on-inverse colour would be invisible against it). */
  .view-options-menu .trigger,
  .statement-fullscreen-toggle {
    color: var(--app-fg-muted);
    border: 1px solid color-mix(in srgb, currentColor 35%, transparent);

    &:hover, &:focus-visible, &.show {
      color: var(--app-fg);
      background-color: color-mix(in srgb, currentColor 8%, transparent);
      border-color: color-mix(in srgb, currentColor 55%, transparent);
    }
  }

  .statement-fullscreen-toggle {
    line-height: 1;
    background-color: transparent;
    border-radius: var(--app-radius-sm);
    padding: 0.25rem 0.4rem;
  }

  .fs-exit { display: none; }
}

/* Fullscreen: the wrap covers the viewport as a flex column — the toolbar stays at
   the top (so the exit control is reachable) and the scroll box flexes to fill the
   rest. The controller clears the scroll box's inline max-height so the flex wins. */
.statement-table-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  background-color: var(--app-bg-sheet);

  .fs-enter { display: none; }
  .fs-exit { display: inline; }

  .income-statement-yearly-scroll.is-yearly-mode {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
}

body.statement-fullscreen-open {
  overflow: hidden;
}

/* Sticky Footer Fix for #main (used in Application and Account layouts) */
/* Override NiceAdmin's margin-top: 60px which causes overflow with min-vh-100 */
#main {
  margin-top: 0 !important;
  /* 60px (Header) + 20px (Original Top Padding) = 80px */
  padding-top: 80px !important;
}

@media (max-width: 1199px) {
  #main {
    padding-top: 80px !important;
  }
}

/* ==========================================================================
   SETUP CHECKLIST (Tax Advisor BWA Client Setup)
   Vertical timeline + state styling
   ========================================================================== */

.setup-checklist-timeline {
  display: flex;
  flex-direction: column;
}

.setup-checklist-timeline-item {
  position: relative;
  padding-bottom: 0.35rem;
}

/* Dotted spine between step indicators */
.setup-checklist-timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(1rem + 18px - 1px);
  top: calc(1rem + 36px);
  bottom: 0.15rem;
  border-left: 2px dotted var(--hc-sage-400);
}

.setup-checklist {
  background-color: var(--app-bg-sheet);
  border-color: var(--hc-sage-400) !important;

  .card-body {
    background-color: color-mix(in srgb, var(--app-bg-sheet) 72%, white);
  }

  .status {
    border-radius: var(--app-radius-sm);
  }

  .setup-step {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--app-radius-card);
    margin-bottom: 0;
    border: 1px solid transparent;
    background-color: var(--app-surface-muted);
    position: relative;

    &.always-available {
      background-color: var(--app-bg);
      border-color: var(--hc-sage-400);
      opacity: 1;
    }

    &.completed {
      background-color: color-mix(in srgb, var(--app-success) 10%, white);
      border-color: color-mix(in srgb, var(--app-success) 32%, transparent);
    }

    &.current {
      background-color: color-mix(in srgb, var(--app-accent-yellow) 44%, white);
      border-color: color-mix(in srgb, var(--app-fg-muted) 20%, transparent);
    }

    &.pending {
      opacity: 0.58;
    }

    .badge.rounded-pill {
      white-space: nowrap;
    }

    .optional-cleanup {
      margin-top: 0.5rem;
      font-size: 0.8125rem;

      .label {
        color: var(--app-fg-subtle);
        display: block;
        margin-bottom: 0.15rem;
      }

      ul {
        padding-left: 0;
      }

      li {
        line-height: 1.5;
      }
    }
  }

  .setup-step-content {
    flex: 1;
    min-width: 0;
  }

  .setup-step-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .setup-step-hint {
    color: var(--app-fg-subtle);
  }

  .setup-step.current .setup-step-hint {
    color: var(--app-fg-muted);
  }

  .step-indicator {
    background-color: color-mix(in srgb, var(--hc-sage-400) 68%, white);

    &.step-indicator--completed {
      background-color: var(--app-chrome);
      color: var(--app-accent-yellow);
    }

    &.step-indicator--current {
      background-color: var(--app-accent-yellow);
      color: var(--app-fg);
    }
  }

  .upload-drop-target {
    padding: 0.625rem 0.75rem;
    border-color: color-mix(in srgb, var(--app-fg-muted) 28%, transparent);
    background-color: color-mix(in srgb, var(--app-accent-yellow) 22%, white);
  }
}

.banner {
  padding: 1rem;
  border-radius: var(--app-radius-card);
  border: 1px solid color-mix(in srgb, var(--app-fg-muted) 20%, transparent);

  .message {
    color: var(--app-fg-muted);
  }

  .upload-drop-target {
    padding: 0.625rem 0.75rem;
    border-color: color-mix(in srgb, var(--app-fg-muted) 28%, transparent);
  }

  &.hint {
    background-color: color-mix(in srgb, var(--app-accent-yellow) 44%, white);

    .upload-drop-target {
      background-color: color-mix(in srgb, var(--app-accent-yellow) 22%, white);
    }

    /* Rest state only: scoped selector loses :not() on hover/active so Bootstrap’s .btn-outline-secondary states apply unchanged */
    .btn.btn-outline-secondary {
      white-space: nowrap;

      &:not(:hover):not(:active):not(.active):not(:disabled) {
        background-color: var(--app-accent-yellow);
        color: var(--hc-ink-700);
        border-color: var(--bs-btn-border-color);
      }
    }
  }

  &.setup-continue-banner {
    .title {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-weight: 600;
      margin-bottom: 0.5rem;
    }

    .intro {
      margin-bottom: 0.5rem;
      color: var(--app-fg-muted);
      font-size: 0.9375rem;
    }

    .tasks {
      margin: 0;
      padding-left: 1.25rem;
      font-size: 0.9375rem;

      li.optional {
        color: var(--app-fg-subtle);
        font-size: 0.875rem;
      }
    }
  }
}

/* Uploads index — year sections (HOCOS palette) */
.uploads-index {
  .uploads-year-card {
    border: 1px solid var(--hc-sage-400);
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;

    /* Left accent only (Bootstrap border-primary tints every edge and can pick up default blue RGB) */
    .header {
      background-color: var(--app-bg);
      border-top: 0;
      border-right: 0;
      border-bottom: 1px solid var(--hc-sage-400);
      border-left: 4px solid var(--hc-ink-500);

      &.warning {
        border-left-color: color-mix(in srgb, var(--bs-warning) 75%, var(--app-fg-muted));
      }

      &.neutral {
        border-left-color: color-mix(in srgb, var(--hc-sage-400) 85%, var(--hc-ink-500));
      }
    }

    .hint {
      font-size: 0.8125rem;
      line-height: 1.35;
    }

    .heading {
      font-size: 1.5rem;
      font-weight: 600;
      color: var(--app-fg-muted);
      letter-spacing: -0.02em;
      line-height: 1.2;
    }

    .info-grid {
      max-width: 19rem;
    }
  }
}

.upload-drop-target {
  display: block;
  border: 2px dashed var(--hc-sage-400);
  border-radius: var(--app-radius-card);
  background-color: var(--app-bg-sheet);
  padding: 1rem;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    border-style 0.15s ease,
    border-width 0.15s ease,
    border-radius 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease;

  /* Same language as .simplified-header .pill-button.active: chrome fill, white copy, yellow icons */
  &.is-drag-active {
    border-style: solid;
    border-width: 1px;
    border-color: var(--app-chrome);
    border-radius: 20px;
    background-color: var(--app-chrome);
    color: #fff;
    box-shadow: none;

    .bi {
      color: var(--app-accent-yellow);
    }

    .text-muted {
      color: color-mix(in srgb, #fff 78%, transparent) !important;
    }

    .form-control {
      background-color: color-mix(in srgb, var(--app-chrome) 72%, var(--hc-ink-800));
      border-color: color-mix(in srgb, #fff 22%, var(--app-chrome));
      color: #fff;
    }

    input[type="file"].form-control::file-selector-button {
      background-color: var(--app-accent-yellow);
      color: var(--hc-ink-900);
      border-color: color-mix(in srgb, var(--hc-ink-900) 20%, transparent);
    }

    input[type="file"].form-control::file-selector-button:hover {
      background-color: color-mix(in srgb, white 12%, var(--app-accent-yellow));
    }
  }

  &.compact {
    display: inline-block;
    border-width: 1px;
    border-radius: var(--app-radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: var(--app-text-xs);
    font-weight: 500;

    &.is-drag-active {
      border-radius: 20px;
    }
  }
}

.setup-step-file-input {
  display: none;
}

/* Tax advisor businesses index — compact bookkeeping upload status */
.bookkeeping-upload-cell {
  max-width: 100%;
  min-width: 12rem;

  .meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    min-width: 0;
    margin-bottom: 0.25rem;
  }

  .name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--app-text-xs);
  }

  .phase {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: var(--app-text-xs);
  }

  .progress {
    width: 100%;
    height: 6px !important;
    margin: 0;
  }

  .pending-badge {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: var(--app-text-xs);
    font-weight: 500;
  }
}

/* Tax advisor business show — compact upload/import list */
.bookkeeping-upload-imports {
  .upload-list {
    border-top: 1px solid color-mix(in srgb, var(--app-fg-muted) 14%, transparent);
  }

  .row-item {
    padding: 0.375rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--app-fg-muted) 14%, transparent);
  }

  .head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
  }

  .name {
    font-size: var(--app-text-xs);
    font-weight: 500;
    min-width: 0;
  }

  .when {
    flex: 0 0 auto;
    font-size: var(--app-text-xs);
    color: var(--app-fg-subtle);
    white-space: nowrap;
  }

  .detail {
    margin-top: 0.125rem;
    font-size: var(--app-text-xs);
  }

  .state {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--app-fg-muted);

    .bi {
      flex: 0 0 auto;
    }

    &.done {
      color: color-mix(in srgb, var(--app-success) 65%, var(--app-fg-muted));
    }

    &.failed {
      color: var(--bs-danger);
    }

    &.processing {
      display: block;

      .pct {
        margin-left: 0.375rem;
        color: var(--app-fg-subtle);
      }

      .progress {
        max-width: 14rem;
      }
    }
  }
}

/* Issues summary (businesses list): a compact stacked list, warning-toned, with a
   small dot marker per line; severe issues (e.g. overlapping periods) shift to
   danger. Kept subtle so it sits calmly inside the clients table. */
.issues-summary {
  .item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.1rem 0;
    font-size: var(--app-text-xs);
    color: var(--app-fg-muted);
  }

  .dot {
    flex: 0 0 auto;
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background-color: var(--app-accent-yellow);
  }

  .item.severe {
    color: var(--app-danger);

    .dot {
      background-color: var(--app-danger);
    }
  }
}

/* Clients table: top-align so multi-line status cells line up their neighbours
   (date, period, upload) with the first row of issues rather than centring. */
.table.listing.clients-listing > tbody > tr > td {
  vertical-align: top;
}

/* Activity feed: let the client name take the slack and truncate, and pin the
   date to a fixed right-hand column so the status badges line up. */
.activity-feed {
  .name {
    min-width: 0;
  }

  .date {
    flex: 0 0 auto;
    min-width: 6.25rem;
    text-align: right;
  }
}

.toast-container {
  z-index: 1090;

  a:not(.btn) {
    text-decoration: underline;
  }

  .toast {
    border-radius: var(--app-radius-xs);
    max-width: 24rem;
    border-width: 1px;
    border-style: solid;
    box-shadow: var(--app-shadow-lg);

    > .d-flex {
      align-items: flex-start;
      gap: 0.5rem;
      padding: 0.625rem 0.625rem 0.625rem 0.75rem;
    }

    .toast-body {
      padding: 0;
    }

    .btn-close {
      flex-shrink: 0;
      margin: 0;
      padding: 0.375rem;
      opacity: 0.55;

      &:hover,
      &:focus {
        opacity: 0.85;
      }
    }
  }

  .toast-notice {
    background-color: color-mix(in srgb, var(--app-success) 30%, var(--app-surface));
    color: color-mix(in srgb, var(--app-fg-muted) 80%, var(--app-success));
    border-color: color-mix(in srgb, var(--app-fg-muted) 20%, transparent);
  }

  .toast-alert {
    background-color: var(--app-accent-yellow);
    color: var(--app-fg-muted);
    border-color: color-mix(in srgb, var(--app-fg-muted) 20%, transparent);
  }

  .toast-error {
    background-color: var(--app-danger-bg);
    color: var(--app-fg);
    border-color: color-mix(in srgb, var(--app-danger) 35%, transparent);
  }

  .toast-info {
    background-color: var(--hc-info-1);
    color: var(--app-fg-muted);
    border-color: color-mix(in srgb, var(--app-fg-muted) 20%, transparent);
  }
}

body:has(.simplified-main) .toast-container {
  padding-bottom: 4.5rem;
}

/* Turbo Drive loading bar. Taller and in the dark foreground colour so it stands
   out against the light (sage) fixed header during navigation — the default thin
   blue bar is nearly invisible here, especially on mobile. */
.turbo-progress-bar {
  height: 4px;
  background: var(--app-fg);
  box-shadow: 0 0 8px color-mix(in srgb, var(--app-fg) 45%, transparent);
}

/* Tap feedback for table-based drill pages (e.g. debtor / creditor lists) whose
   rows navigate via links inside .table-results. The row darkens instantly on
   press and stays highlighted while the next page loads (.is-navigating). */
.table-results a {
  -webkit-tap-highlight-color: transparent;
}

.table-results tr:has(a):active,
.table-results tr:has(a.is-navigating) {
  background-color: var(--app-table-row-hover-bg);
}