*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; }

:root {
  --color-bg: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #1a1a1a;
  --color-text-muted: #6b7280;
  --color-accent: #1e7a34;
  --color-accent-bg: #e6f4ea;
  --color-danger: #b3261e;
  --color-danger-bg: #fdecea;
  --color-neutral-bg: #f1f3f4;
  --radius-sm: 6px;
  --radius-md: 10px;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, sans-serif;
  line-height: 1.4;
}

.page {
  margin-inline: auto;
  padding-inline: 1rem;
  padding-block: 1.25rem 3rem;
  max-width: 100%;
}

.page-header { margin-bottom: 1rem; }
.page-header h1 { font-size: 1.375rem; margin: 0; }

.banner {
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.banner time { font-weight: 600; }
.banner--ok    { background: var(--color-accent-bg);  color: var(--color-accent); }
.banner--error { background: var(--color-danger-bg);  color: var(--color-danger); }
.banner--empty { background: var(--color-neutral-bg); color: var(--color-text-muted); }

/* Auto-fit + minmax means no manual stack/unstack breakpoint is needed for the stat
   cards: at a 320px viewport, .page padding (2 * 16px) leaves 288px of content width;
   (288 - 12px gap) / 2 = 138px per card, just under the 140px floor below, so the grid
   naturally drops to a single column right at the smallest realistic phone width. From
   ~360px up there is enough room for two columns without any author-written breakpoint. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  text-align: center;
}
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); }

.user-section { margin-bottom: 1.75rem; }
.user-section h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
}

/* Prominent without being a decorative flourish: a single accent border-stripe plus a
   tinted count badge, not a full colored background block. */
.user-section--urgent {
  border-inline-start: 3px solid var(--color-danger);
  padding-inline-start: 0.75rem;
}
.user-section--urgent h2 { color: var(--color-danger); }

.count-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--color-neutral-bg);
  color: var(--color-text-muted);
}
.user-section--urgent .count-badge { background: var(--color-danger-bg); color: var(--color-danger); }

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}
.user-row { border-bottom: 1px solid var(--color-border); }

.user-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding-block: 0.5rem;
  padding-inline: 0.25rem;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.user-link:active { background: var(--color-neutral-bg); }
.user-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--color-neutral-bg);
}
.avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.username { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* Kept in canonical orientation in both directions on purpose — an "opens externally"
   glyph indicates an action, not reading direction, so it is not mirrored for RTL. */
.external-icon { flex-shrink: 0; color: var(--color-text-muted); }

.empty-state { color: var(--color-text-muted); font-style: italic; margin: 0.5rem 0 0; }

/* --- Progressive enhancement for wider viewports (tablet/desktop) --- */
@media (min-width: 600px) {
  .page { max-width: 760px; padding-inline: 1.5rem; }
  .page-header h1 { font-size: 1.625rem; }
}
