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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: white;
  min-height: 100vh;
  color: #2d3436;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  margin-bottom: 40px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.header-text {
  flex: 1;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 1.1rem;
  color: #636e72;
  font-weight: 400;
}

.home-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  margin-top: 8px;
  border: 1px solid #d5deeb;
  border-radius: 999px;
  color: #0e5fd3;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.home-link:hover {
  background: #f0f6ff;
}

.header-logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert code {
  background: rgba(0, 0, 0, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.toast-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.toast-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.meta {
  font-size: 0.85rem;
  color: #9ca3af;
}

.btn-refresh {
  padding: 8px 18px;
  border: 1px solid #d5deeb;
  border-radius: 999px;
  background: white;
  color: #0e5fd3;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: #f0f6ff;
  border-color: #0e5fd3;
}

/* ── Summary bar ─────────────────────────────────────────────────────────── */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9ecef;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #0e5fd3;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #636e72;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: #636e72;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e9ecef;
  border-top-color: #0e5fd3;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 1rem;
}

/* ── Card / Table wrapper ────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.bucket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bucket-table th {
  padding: 12px 16px;
  text-align: left;
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #636e72;
  white-space: nowrap;
}

.bucket-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f3f5;
  color: #2d3436;
  white-space: nowrap;
}

.bucket-table tbody tr:last-child td {
  border-bottom: none;
}

.bucket-table tbody tr:hover td {
  background: #f8f9fa;
}

.date-cell {
  color: #636e72;
  font-size: 0.85rem;
}

.die-pill {
  display: inline-block;
  padding: 3px 12px;
  background: #e8f0fd;
  color: #0e5fd3;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ── Batch button ────────────────────────────────────────────────────────── */
.btn-batch {
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  background: #0e5fd3;
  color: white;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-batch:hover    { background: #0a4aaa; }
.btn-batch:disabled { background: #9ca3af; cursor: not-allowed; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 32px;
  padding: 20px;
  color: #9ca3af;
  font-size: 0.85rem;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .header-content {
    flex-direction: column-reverse;
    text-align: center;
    gap: 16px;
  }

  .header-logo {
    max-height: 60px;
  }

  header h1 {
    font-size: 1.75rem;
  }

  .summary-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .bucket-table th,
  .bucket-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  /* Hide less-critical columns on small screens */
  .bucket-table th:nth-child(6),
  .bucket-table td:nth-child(6),
  .bucket-table th:nth-child(7),
  .bucket-table td:nth-child(7),
  .bucket-table th:nth-child(8),
  .bucket-table td:nth-child(8) {
    display: none;
  }
}
