@layer components {
/* Screen primitives — the building blocks every screen composes from.
   Mobile-first; the desktop shell (sidebar) is handled by the layout. */

/* Standard screen container: consistent gutters, never wider than viewport */
.screen {
  width: 100%;
  max-width: var(--container-xl);
  box-sizing: border-box;
  padding: var(--spacing-4);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--spacing-4);
  margin-inline: auto;
}

/* Uppercase hairline section label (Figma: BUTTONS / STATUS / MANAGE …) */
.section-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* Stat tiles: value + label, hairline box. Wraps to 2-up on mobile. */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--spacing-2);
}

.stat-tile {
  border: var(--border-width) solid var(--border);
  padding: var(--spacing-3) var(--spacing-4);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
  min-width: 0;

  & .stat-value {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
  }

  /* Money renders in the base font — the display fonts lack ₪ */
  & .stat-value--money {
    font-family: var(--font-family-base);
    font-weight: var(--font-weight-bold);
  }

  & .stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-subtle);
  }
}

/* List rows: ink-bordered group of hairline-divided rows (Figma list style) */
.list-rows {
  border: var(--border-width) solid var(--border-strong);

  &:empty {
    display: none;
  }
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 0;
  margin: 0;
  list-style: none;
}

.list-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3);
  min-height: var(--tap-min);
  text-decoration: none;
  color: var(--text);

  &:not(:last-child) {
    border-block-end: var(--border-width) solid var(--border);
  }

  &:hover {
    background: var(--surface-sunken);
  }

  &:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: -3px;
  }

  & .row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;

    & .row-title {
      font-weight: var(--font-weight-bold);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    & .row-meta {
      font-size: var(--font-size-sm);
      color: var(--text-subtle);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  & .row-aside {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    flex-shrink: 0;
    font-size: var(--font-size-sm);
    color: var(--text-subtle);
  }

  & .row-chevron {
    font-weight: var(--font-weight-bold);
    color: var(--text);
  }
}

/* Square ink avatar with initials */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
}

/* Screen toolbar: search + filters row under the page header */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-2);
  align-items: center;

  & .toolbar-search {
    flex: 1 1 220px;
    display: flex;
    min-width: 0;

    & input {
      width: 100%;
      min-width: 0;
      text-align: start;
      padding-inline: var(--spacing-3);
      background: var(--surface);
      border: var(--border-width) solid var(--border-strong);
    }
  }
}

/* Small inline tag chip (e.g. SUB-CONTRACTOR) */
.tag-chip {
  display: inline-block;
  padding: 2px var(--spacing-1);
  background: var(--gray-100);
  font-size: 0.625rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
}
