:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eaf1fe;
  --success: #15803d;
  --success-soft: #eafaf0;
  --danger: #b91c1c;
  --danger-soft: #fdeeee;
  --warning: #92600a;
  --warning-soft: #fff6e5;
  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  /* No page-level fade here on purpose (Mike's feedback, 2026-07-17): this
     is a plain server-rendered app, every nav click is a full page load -
     animating body opacity made navigation FEEL slow (a moment of near-
     invisible content on every click), on top of the real load time.
     Cards still animate in below - that's enough motion without adding
     perceived latency to switching tabs. */
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topnav .brand {
  font-weight: 600;
  margin-right: 20px;
  color: var(--text);
}

.topnav a.tab {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  position: relative;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.topnav a.tab:hover {
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
}

.topnav a.tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.topnav .spacer { flex: 1; }

.topnav form { margin: 0; }

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.btn-link:hover { color: var(--text); background: var(--bg); }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
  animation: rise-in 0.3s var(--ease) backwards;
}

.card:hover { box-shadow: 0 4px 16px rgba(20, 20, 30, 0.06); }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid {
  /* Flexbox, not CSS grid: with wrapping + justify-content:center, an
     incomplete last row (e.g. 5 cards -> 3+2) centers itself naturally.
     A fixed grid-template-columns leaves a leftover row stuck to the left. */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}

.grid .card {
  flex: 1 1 260px;
  max-width: 300px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

tr { transition: background-color 0.12s var(--ease); }
tbody tr:hover { background: var(--bg); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--bg); color: var(--text-muted); }

.pulse {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

select, input[type="text"], input[type="password"] {
  font: inherit;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button, .btn {
  font: inherit;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}

button:hover, .btn:hover { background: var(--bg); }
button:active, .btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #991b1b; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 320px;
  animation: rise-in 0.35s var(--ease);
}

.login-card h1 { text-align: center; }

.field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label { font-size: 13px; color: var(--text-muted); }

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 14px;
}

.muted { color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 24px 0 10px;
}
.section-title:first-child { margin-top: 0; }

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
