/* SG Statutes MCP — Slate + Indigo design system */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Slate neutrals */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Indigo accent */
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;

  /* Semantic */
  --color-bg: var(--slate-50);
  --color-surface: #ffffff;
  --color-border: var(--slate-200);
  --color-text: var(--slate-900);
  --color-muted: var(--slate-500);
  --color-primary: var(--indigo-600);
  --color-primary-hover: var(--indigo-700);
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-success: #16a34a;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Layout ────────────────────────────────────────────────────────────────── */

.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: .25rem;
  color: var(--slate-900);
}

.auth-card .tagline {
  color: var(--color-muted);
  font-size: .875rem;
  margin-bottom: 2rem;
}

/* ── Navbar ────────────────────────────────────────────────────────────────── */

.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--slate-900);
  text-decoration: none;
}

.navbar-links {
  display: flex;
  gap: 1.5rem;
  flex: 1;
}

.navbar-links a {
  color: var(--slate-600);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
}

.navbar-links a:hover { color: var(--slate-900); }

.navbar-user {
  position: relative;
  font-size: .875rem;
  color: var(--slate-600);
}

.navbar-user form { display: inline; }

.dashboard-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

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

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

.btn-secondary {
  background: var(--color-surface);
  color: var(--slate-700);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--slate-100);
  text-decoration: none;
}

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

.btn-danger:hover {
  background: var(--color-danger-hover);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--slate-700);
  border-color: var(--color-border);
}

.btn-outline:hover { background: var(--slate-100); text-decoration: none; }

.btn-google {
  width: 100%;
  justify-content: center;
  padding: .75rem 1rem;
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--slate-700);
  font-size: .9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.btn-google:hover { background: var(--slate-50); text-decoration: none; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .375rem;
  color: var(--slate-700);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-family: var(--font);
  color: var(--slate-900);
  background: var(--color-surface);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px var(--indigo-100);
}

.field-error {
  display: flex;
  align-items: center;
  gap: .375rem;
  color: var(--color-danger);
  font-size: .8125rem;
  margin-top: .375rem;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */

.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}

.alert-warning {
  background: #fef9c3;
  border: 1px solid #fde68a;
  color: #854d0e;
}

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

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.alert-info {
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  color: #312e81;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

.table-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th {
  background: var(--slate-50);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--slate-500);
  padding: .625rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: .875rem;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--slate-50); }

/* ── Badges ────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .125rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-active { background: #dcfce7; color: #14532d; }
.badge-revoked { background: var(--slate-100); color: var(--slate-500); }

/* ── Code blocks ───────────────────────────────────────────────────────────── */

.code-block {
  background: var(--slate-800);
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  position: relative;
}

.token-display {
  background: var(--slate-100);
  border: 2px solid var(--indigo-500);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: .9375rem;
  color: var(--slate-900);
  word-break: break-all;
  user-select: all;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--slate-900);
}

/* ── Empty state ───────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-muted);
}

.empty-state h3 { margin-bottom: .5rem; color: var(--slate-700); }
.empty-state p { font-size: .875rem; margin-bottom: 1.5rem; }

/* ── Page header ───────────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.375rem; font-weight: 700; }

/* ── Fullpage focus layout ─────────────────────────────────────────────────── */

.fullpage-focus {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 3rem 1.5rem;
  background: #fff;
}

.fullpage-focus .focus-card {
  width: 100%;
  max-width: 600px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

/* ── Misc ───────────────────────────────────────────────────────────────────── */

.divider { border: none; border-top: 1px solid var(--color-border); margin: 1.5rem 0; }

.text-muted { color: var(--color-muted); }
.text-sm { font-size: .875rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.gap-2 { gap: .5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.btn-row {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.sign-in-divider {
  color: var(--color-muted);
  font-size: .8125rem;
  text-align: center;
  margin: .75rem 0;
}

.invitation-note {
  font-size: .8125rem;
  color: var(--color-muted);
  text-align: center;
  margin-top: 1.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--color-muted);
  font-size: .875rem;
  text-decoration: none;
  margin-bottom: 1.5rem;
}

.back-link:hover { color: var(--slate-700); }

.copy-btn-group {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
}

.section-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: .5rem;
  padding-bottom: .375rem;
  border-bottom: 1px solid var(--color-border);
}

/* ── Accessibility min target 44px ─────────────────────────────────────────── */

.btn { min-height: 44px; }

@media (max-width: 600px) {
  .auth-card { padding: 1.5rem; }
  .dashboard-layout { padding: 1rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .navbar { flex-wrap: wrap; }
}
