:root {
  --blue: #006cfe;
  --blue-hover: #0056d6;
  --blue-soft: #eef4ff;
  --blue-border: #c7dcff;
  --ink: #0f172a;
  --body: #334155;
  --muted: #64748b;
  --soft: #94a3b8;
  --border: #e6ebf1;
  --border-soft: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --row-alt: #f9fafb;
  --row-hover: #f0f6ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--body);
  background: var(--surface-2);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { color: var(--ink); letter-spacing: -0.02em; margin: 0; }
.hidden { display: none !important; }

/* Login */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 40px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--ink);
  font-size: 17px;
  margin-bottom: 6px;
}
.auth-brand img { width: 24px; height: 24px; display: block; }
.auth-card h1 { font-size: 20px; margin-top: 10px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 6px 0 22px; }
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 14px 0 6px;
}
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
}
input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 108, 254, .14);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 44px;
  margin-top: 20px;
  padding: 0 18px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
  transition: background .15s;
}
.btn:hover { background: var(--blue-hover); }
.btn[disabled] { opacity: .6; cursor: default; }
.error {
  display: none;
  margin-top: 16px;
  font-size: 14px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
}
.error.visible { display: block; }

/* Google SSO */
#sso-alt { margin-bottom: 4px; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  padding: 0 18px;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-google:hover { background: var(--surface-2); border-color: #d2d8df; }
.btn-google img { display: block; flex: none; }

/* Dashboard shell */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.top-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.top .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--ink);
  font-size: 16px;
}
.top .brand img { width: 24px; height: 24px; display: block; }
.top .brand .tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 999px;
  padding: 3px 10px;
}
.top .who {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--muted);
}
.top .who button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.top .who button:hover { background: var(--surface-2); }

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}

/* Tab navigation */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active {
  color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px var(--blue-border);
}
.tab:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head { margin-bottom: 16px; }
.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-head h2 {
  font-size: 22px;
  font-weight: 650;
}
.section-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* Data card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
th {
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--body);
  vertical-align: top;
  font-size: 14px;
  line-height: 1.45;
}
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--row-hover); }
tr:last-child td { border-bottom: 0; }
td.strong { color: var(--ink); font-weight: 550; }
td .dim { color: var(--soft); font-size: 13px; margin-left: 8px; }
.pill {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  text-transform: capitalize;
}
.ok { color: #059669; font-weight: 550; }
.warn { color: #d97706; font-weight: 550; }

.placeholder {
  padding: 48px 24px;
  text-align: center;
  color: var(--soft);
  font-size: 14px;
  background: var(--surface) !important;
}
.placeholder.empty {
  color: var(--muted);
}
.placeholder.error-state {
  color: #b91c1c;
  background: #fffafb !important;
}

td a { color: var(--blue); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
.msg-cell { max-width: 420px; white-space: pre-wrap; color: var(--muted); font-size: 14px; }

/* Pagination */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.page-info {
  font-size: 13px;
  color: var(--muted);
}
.page-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.page-btn:hover:not([disabled]) { background: var(--surface-2); border-color: #d2d8df; }
.page-btn[disabled] { opacity: .45; cursor: default; }
.page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.page-ellipsis {
  padding: 0 4px;
  color: var(--soft);
  font-size: 13px;
}

@media (max-width: 640px) {
  .top-inner, .page { padding-left: 16px; padding-right: 16px; }
  .tabs { flex-direction: column; }
  .section-head h2 { font-size: 19px; }
  .table-footer { flex-direction: column; align-items: stretch; }
  .page-controls { justify-content: center; flex-wrap: wrap; }
}
