/* Design tokens */
:root {
  --c-steel:    #5A7DA3;
  --c-green:    #22c55e;
  --c-amber:    #f59e0b;
  --c-red:      #ef4444;
  --c-gray:     #6b7280;
  --c-bg:       #ffffff;
  --c-surface:  #f9fafb;
  --c-border:   #e5e7eb;
  --c-text:     #111827;
  --c-muted:    #6b7280;
  --header-h:   48px;
  --health-h:   4px;
  --tab-h:      48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg:      #111827;
    --c-surface: #1f2937;
    --c-border:  #374151;
    --c-text:    #f9fafb;
    --c-muted:   #9ca3af;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  background-color: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
}

/* ── Header ───────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--header-h);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__title {
  font-weight: 600;
  font-size: 16px;
}

.header__logout {
  color: var(--c-muted);
  text-decoration: none;
  font-size: 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.header__logout:hover {
  text-decoration: underline;
}

/* ── Health bar ───────────────────────────────────────────── */
.health-bar {
  height: var(--health-h);
  width: 100%;
  background-color: var(--c-green);
  transition: height 0.3s ease, background-color 0.3s ease;
  position: sticky;
  top: var(--header-h);
  z-index: 99;
  cursor: default;
}

/* ── Banners ──────────────────────────────────────────────── */
.banner {
  padding: 8px 16px;
  font-size: 14px;
  border-bottom: 1px solid transparent;
}

.banner--warn {
  background: #fef3c7;
  border-color: var(--c-amber);
  color: #92400e;
}

.banner--error {
  background: #fee2e2;
  border-color: var(--c-red);
  color: #991b1b;
}

@media (prefers-color-scheme: dark) {
  .banner--warn  { background: #451a03; color: #fcd34d; }
  .banner--error { background: #450a0a; color: #fca5a5; }
}

/* ── Tab bar ──────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  height: var(--tab-h);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
  position: sticky;
  top: calc(var(--header-h) + var(--health-h));
  z-index: 98;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 110px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--c-muted);
  border-bottom: 2px solid transparent;
  padding: 0 12px;
  white-space: nowrap;
  min-height: 44px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn--active {
  color: var(--c-steel);
  border-bottom-color: var(--c-steel);
}

.tab-btn:hover:not(.tab-btn--active) {
  color: var(--c-text);
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  padding: 16px;
}

/* ── Tile grid ────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ── Tile ─────────────────────────────────────────────────── */
.tile {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

.tile__title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.tile__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.tile__title:hover {
  text-decoration: underline;
}

.tile__repo-tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--c-steel);
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tile__urgency {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.tile__urgency-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tile__status {
  color: var(--c-muted);
  font-size: 13px;
}

.tile__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-steel);
  color: #fff;
  border-radius: 8px;
  height: 36px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  align-self: flex-start;
  transition: opacity 0.15s;
}

.tile__action-btn:hover {
  opacity: 0.88;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  color: var(--c-muted);
  font-size: 15px;
}

/* ── Loading spinner ──────────────────────────────────────── */
.loading-spinner {
  text-align: center;
  padding: 24px;
  color: var(--c-muted);
  font-size: 15px;
}

/* ── Mobile 375px ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .tile-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 8px;
  }

  .tile__action-btn {
    align-self: stretch;
    width: 100%;
  }

  .tab-bar {
    top: calc(var(--header-h) + var(--health-h));
  }
}
