:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1f4ed8;
  --primary-dark: #173ea8;
  --danger: #b91c1c;
  --success: #15803d;
  --warning: #b45309;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 72px;
  background: #0f172a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topnav a {
  color: #dbeafe;
  font-weight: 500;
}

.topnav .user-pill {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 12px;
  border-radius: 999px;
  color: white;
}

.page {
  max-width: 1600px;
  width: 100%;
  margin: 32px auto;
  padding: 0 24px;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.page-subtitle {
  color: var(--muted);
  margin-top: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  width: 100%;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--primary);
  color: white;
  min-height: 40px;
}

.btn:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-danger {
  background: var(--danger);
}

.btn-small {
  padding: 7px 11px;
  min-height: 32px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-weight: 650;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: white;
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.15);
  border-color: var(--primary);
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

.table-wrap table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-soft);
}

.table-wrap th, .table-wrap td {
  white-space: nowrap;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge-success {
  color: var(--success);
  background: #dcfce7;
}

.badge-muted {
  color: #475569;
  background: #e2e8f0;
}

.badge-warning {
  color: var(--warning);
  background: #fef3c7;
}

.error {
  color: var(--danger);
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 12px 14px;
  border-radius: 12px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,0.25), transparent 35%),
    linear-gradient(135deg, #0f172a, #1e293b);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: white;
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-title {
  margin: 0;
  font-size: 28px;
}

.auth-subtitle {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.col-message {
  max-width: 400px;
  white-space: normal;
  word-break: break-word;
}

.col-wide {
  min-width: 360px;
  max-width: 620px;
  white-space: normal !important;
  word-break: break-word;
}

.col-url {
  min-width: 460px;
  max-width: 760px;
  white-space: normal !important;
  word-break: break-all;
}

.col-json {
  min-width: 420px;
  max-width: 760px;
  white-space: pre-wrap !important;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .topnav {
    flex-wrap: wrap;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
