/* Lists, badges, tabs, filters, stats, grids and tables. See base.css for
 * the order. */

/* ---- Lists, badges, avatars, details ------------------------------------ */

.list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list > li + li {
  border-top: 1px solid var(--hairline);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.625rem 1rem;
}

a.list-row:hover {
  background: var(--accent);
}

.list-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.list-main > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-title {
  font-weight: 500;
}

.list-end {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  text-align: end;
}

/* A card whose body is a flush list. */
.card-flush > .card-body {
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge[data-tone="success"] {
  background: var(--success-soft);
  color: var(--success);
}

.badge[data-tone="warning"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge[data-tone="danger"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge[data-tone="info"] {
  background: var(--info-soft);
  color: var(--info);
}

.avatar {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  object-fit: cover;
}

.avatar[data-size="lg"] {
  width: 4rem;
  height: 4rem;
  font-size: 1.125rem;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 0.375rem;
  padding: 2rem 1rem;
  color: var(--muted-foreground);
  text-align: center;
}

.empty .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.empty-title {
  color: var(--foreground);
  font-weight: 500;
}

.details {
  display: grid;
  gap: 0.875rem 1.5rem;
  margin: 0;
}

.details dt {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  .details {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---- Tabs, filters, stats, grids --------------------------------------- */

/* View tabs scroll sideways on a phone. The scrollbar is hidden, so each
   edge with more tabs beyond it fades out instead: a scroll-driven mask, or
   the `more-start` / `more-end` classes app.js sets where that is missing. */
@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.tabs {
  --fade-size: 2.5rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--hairline);
  scrollbar-width: none;
  scroll-padding-inline: var(--fade-size);
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to right, black, transparent) 0 0 / var(--fade-start) 100%
      no-repeat no-clip,
    linear-gradient(to right, transparent, black) 100% 0 / var(--fade-end) 100%
      no-repeat no-clip;
  animation:
    tabs-fade-start linear both,
    tabs-fade-end linear both;
  animation-timeline: scroll(self inline);
  animation-range:
    0 var(--fade-size),
    calc(100% - var(--fade-size)) 100%;
}

.tabs.more-start {
  --fade-start: var(--fade-size);
}

.tabs.more-end {
  --fade-end: var(--fade-size);
}

@keyframes tabs-fade-start {
  to {
    --fade-start: var(--fade-size);
  }
}

@keyframes tabs-fade-end {
  from {
    --fade-end: var(--fade-size);
  }
}

.tabs a {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid transparent;
  color: var(--muted-foreground);
  font-weight: 500;
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--primary);
  color: var(--foreground);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.filters > .field {
  flex: 1 1 10rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.75rem;
}

/* Compact on a phone, where four tiles would fill the first screen. */
.stat {
  display: grid;
  gap: 0.125rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--hairline);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
}

a.stat:hover {
  background: var(--accent);
}

.stat-label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value[data-tone="danger"] {
  color: var(--danger);
}

.stat-value[data-tone="warning"] {
  color: var(--warning);
}

.stat-value[data-tone="success"] {
  color: var(--success);
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .stat {
    gap: 0.25rem;
    padding: 0.875rem 1rem;
  }

  .stat-value {
    font-size: 1.375rem;
  }
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-page {
  display: grid;
  gap: 1.5rem;
  max-width: 48rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* A receipt in a Claim, at its own shape, never wider than the dialog. */
.receipt-photo {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.money,
.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Tables: wide sheets scroll inside their card, never the page ------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
  text-align: start;
  white-space: nowrap;
}

.table th {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table .num {
  text-align: end;
}

.secret {
  padding: 0.75rem 1rem;
  border: 1px dashed var(--input-border);
  border-radius: var(--radius);
  font-family: ui-monospace, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.1em;
  text-align: center;
  user-select: all;
}

.map {
  height: 18rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.list-inset .list-row {
  padding-inline: 0;
}

.person {
  display: flex;
  align-items: center;
  gap: 1rem;
}
