/* Dashboard */
.nav-user {
  font-size: 0.88rem;
  color: var(--gray-mid);
}

.dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.dashboard--with-sidebar {
  max-width: 1200px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-main-grid {
  display: grid;
  /* auto-fit so a single panel (e.g. team members/leads who only have a
     cashbook panel, no invoices) stretches to fill the main area instead of
     sitting in a half-width column. Two panels still sit side by side, and it
     collapses to one column when the space is too tight. */
  /* min(): a bare minmax(380px, …) is a floor the grid cannot honour in a
     narrower container, and the panels spill out instead of shrinking. */
  grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  gap: 1.5rem;
  align-items: start;
}

.dashboard-section--full {
  grid-column: 1 / -1;
}

.dashboard-sidebar {
  position: sticky;
  top: 1rem;
}

.dashboard-section--sidebar {
  padding: 1.25rem;
}

.sidebar-projects {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sidebar-project {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--divider);
}

.sidebar-project:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sidebar-project-link {
  text-decoration: none;
  color: var(--gray-dark);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-project-link:hover .sidebar-project-name {
  color: var(--teal);
}

.sidebar-project-name {
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.sidebar-project-code {
  font-size: 0.75rem;
  color: var(--gray-mid);
}

.sidebar-project-action {
  font-size: 0.78rem;
  color: var(--teal);
  text-decoration: none;
  margin-top: 0.15rem;
}

.sidebar-project-action:hover {
  text-decoration: underline;
}

/* ── Favourites ────────────────────────────────────────────── */
.sidebar-projects-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-mid);
  margin: 0 0 0.6rem;
}

/* Space the second group's label off the favourites list above it. */
.sidebar-projects + .sidebar-projects-group-label {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--divider);
}

.sidebar-project-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-project-row .sidebar-project-link {
  flex: 1;
  min-width: 0;
}

/* button_to wraps the star in a <form>; strip its block-level chrome. */
.sidebar-project-row .button_to {
  margin: 0;
  line-height: 0;
  flex-shrink: 0;
}

.sidebar-project-fav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-mid);
  transition: color 0.15s;
}

.sidebar-project-fav .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.sidebar-project-fav:hover {
  color: var(--teal);
}

/* Favourited: filled teal star. The CSS fill overrides the icon's fill="none". */
.sidebar-project-fav.is-favorited {
  color: var(--teal);
}

.sidebar-project-fav.is-favorited .icon {
  fill: var(--teal);
}

@media (max-width: 900px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-sidebar {
    position: static;
  }
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-dark);
}

.dashboard-grid {
  display: grid;
  /* Same narrow-container floor as .dashboard-main-grid above. */
  grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  gap: 2rem;
  align-items: start;
}

.dashboard-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal);
  border-radius: 8px;
  padding: 1.5rem;
}

.dashboard-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-dark);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* Worded counts drop below the title in narrow columns instead of squeezing it. */
  flex-wrap: wrap;
}

.section-heading-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-heading-link:hover { color: var(--teal); }

.section-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-mid);
  background: var(--divider);
  border-radius: 99px;
  padding: 0.1rem 0.55rem;
  letter-spacing: 0;
  white-space: nowrap;
}

/* A queue count takes the status palette of the rows it counts. */
.section-count--requested {
  color: var(--requested);
  background: var(--requested-bg);
}

.section-count--review {
  color: var(--review);
  background: var(--review-bg);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  /* Unwrapped, this row pushes the page wider than a narrow viewport. */
  flex-wrap: wrap;
  justify-content: flex-end;
  /* Clears the copy-link .cashbook-cta spills below itself (tabs.css). */
  row-gap: 1.75rem;
}

.cashbook-totals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--gray-dark);
}

.cashbook-totals strong {
  font-size: 1.05rem;
  color: var(--teal);
}

.lerf-build-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lerf-build-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: var(--gray-mid);
  line-height: 1.2;
}

@media (max-width: 760px) {
  .cashbook-totals {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .lerf-build-action {
    justify-content: flex-start;
  }

  .lerf-build-hint {
    width: 100%;
  }

  .lerf-build-hint-label {
    white-space: normal;
  }

  .btn-lerf-build {
    width: 100%;
    text-align: center;
  }
}

.lerf-build-hint-label {
  font-weight: 500;
  color: var(--gray-dark);
  white-space: nowrap;
}

.lerf-build-hint ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lerf-build-hint li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--white);
  white-space: nowrap;
}

.lerf-build-hint li::before {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border: 1.5px solid var(--border-input);
  border-radius: 50%;
}

.lerf-build-hint li.is-met {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--teal-light);
}

.lerf-build-hint li.is-met::before {
  content: "✓";
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 0.7rem;
  text-align: center;
  color: var(--white);
  background: var(--teal);
  border-color: var(--teal);
}

.btn-lerf-build {
  background: transparent;
  color: var(--text-faint);
  border: 1.5px solid var(--border-input);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-lerf-build--active {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

.btn-lerf-build--active:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: var(--white);
}

.btn-lerf-build:disabled {
  opacity: 1; /* override the generic disabled rule — colour tells the story */
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Dashboard view-all link ───────────────────────────────── */
.dashboard-view-all {
  display: block;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--divider);
  font-size: 0.8rem;
  color: var(--teal);
  text-align: center;
  text-decoration: none;
}

.dashboard-view-all:hover { text-decoration: underline; }

.dashboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* .status-badge is nowrap, so in a narrow column the right-hand group has to
   wrap to its own line rather than overflow the card. */
.dashboard-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--divider);
}

.dashboard-list-item:last-child {
  border-bottom: none;
}

.dashboard-list-link {
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
  border-radius: 4px;
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.dashboard-list-link:hover { background: var(--teal-light); }

.list-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  /* min-width lets a long title wrap; the basis is where the aside wraps. */
  flex: 1 1 11rem;
  min-width: 0;
}

.list-item-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--gray-dark);
  /* Unbroken strings (a "DE→EN" title, an email) must not push the row wider. */
  overflow-wrap: anywhere;
}

.list-item-meta {
  font-size: 0.8rem;
  color: var(--gray-mid);
  /* An email at the end would otherwise set the row's min-content width. */
  overflow-wrap: anywhere;
}

/* An optional amount beside the status badge. Some rows put the badge straight
   on the row — same treatment: whole, right-aligned on whichever line it takes. */
.list-item-aside,
.dashboard-list-item > .status-badge {
  flex-shrink: 0;
  margin-left: auto;
}

.list-item-aside {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.list-item-amount {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-dark);
  white-space: nowrap;
}

/* .status-badge and the app-wide .status-* / .role-* palettes live in
   badges.css. */

