/*
 * Promixa Labs admin. Hand-written, no build step.
 * Mirrors the Two Chairs admin panel look: white sidebar, gray-50 canvas, indigo accent.
 * CSP forbids inline styles, so every visual rule lives here.
 */

:root {
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb; --gray-300: #d1d5db;
  --gray-400: #9ca3af; --gray-500: #6b7280; --gray-600: #4b5563; --gray-700: #374151;
  --gray-800: #1f2937; --gray-900: #111827;
  --indigo-50: #eef2ff; --indigo-100: #e0e7ff; --indigo-200: #c7d2fe; --indigo-500: #6366f1;
  --indigo-600: #4f46e5; --indigo-700: #4338ca; --indigo-800: #3730a3;
  --green-50: #ecfdf5; --green-100: #d1fae5; --green-200: #a7f3d0; --green-700: #047857; --green-800: #065f46;
  --amber-50: #fffbeb; --amber-100: #fef3c7; --amber-200: #fde68a; --amber-800: #92400e;
  --red-50: #fef2f2; --red-100: #fee2e2; --red-200: #fecaca; --red-600: #dc2626; --red-700: #b91c1c; --red-800: #991b1b;
  --radius: 0.5rem; --radius-lg: 0.75rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --sidebar-w: 16rem;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; background: var(--gray-50); color: var(--gray-900);
  font: 400 0.9375rem/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo-600); text-decoration: none; }
a:hover { color: var(--indigo-800); text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--gray-900); }
p { margin: 0; }
svg.icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20;
}
.sidebar-brand { padding: 1.25rem; border-bottom: 1px solid var(--gray-100); }
.sidebar-brand h1 { font-size: 1.125rem; font-weight: 700; }
.sidebar-brand p { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.125rem; }
.sidebar-nav { flex: 1; padding: 0.75rem; overflow-y: auto; }
.nav-section { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--gray-400); padding: 1rem 0.75rem 0.375rem; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; color: var(--gray-700); transition: background .15s, color .15s;
  margin-bottom: 0.125rem; width: 100%; border: 0; background: none; font-family: inherit; cursor: pointer; text-align: left;
}
.sidebar-link:hover { background: var(--indigo-50); color: var(--indigo-700); text-decoration: none; }
.sidebar-link.active { background: var(--indigo-100); color: var(--indigo-800); font-weight: 600; }
.sidebar-link.disabled { color: var(--gray-400); cursor: default; }
.sidebar-link.disabled:hover { background: none; color: var(--gray-400); }
.sidebar-link.danger:hover { background: var(--red-50); color: var(--red-600); }
.sidebar-link .soon { margin-left: auto; font-size: 0.6875rem; font-weight: 600; color: var(--gray-400); background: var(--gray-100); border-radius: 9999px; padding: 0 0.5rem; }
.sidebar-foot { padding: 0.75rem; border-top: 1px solid var(--gray-100); }
.sidebar-user { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem 0.5rem; font-size: 0.8125rem; color: var(--gray-600); min-width: 0; }
.sidebar-user .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--gray-800); }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar-title { font-size: 0.875rem; color: var(--gray-500); }
.content { flex: 1; padding: 2rem; max-width: 80rem; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h2 { font-size: 1.5rem; font-weight: 700; }
.page-head p { color: var(--gray-500); font-size: 0.875rem; margin-top: 0.25rem; }

/* ── Building blocks ──────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.25rem; }
.stack-cards > .card + .card { margin-top: 1.25rem; }
.card-title { font-size: 0.875rem; font-weight: 600; color: var(--gray-900); margin-bottom: 0.75rem; }
.card-narrow { max-width: 36rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.muted { color: var(--gray-500); }
.small { font-size: 0.8125rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }

.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 0.75rem; color: var(--gray-600); margin-top: 0.25rem; font-weight: 500; }

.btn, .btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5625rem 1.25rem; border-radius: var(--radius);
  font-family: inherit; font-size: 0.875rem; font-weight: 600; line-height: 1.25;
  letter-spacing: .01em; cursor: pointer; transition: all .15s ease; text-decoration: none;
}
.btn:hover, .btn-primary:hover, .btn-secondary:hover, .btn-danger:hover { text-decoration: none; transform: translateY(-0.5px); }
.btn-primary { background: var(--indigo-600); color: #fff; border: 1px solid var(--indigo-700); box-shadow: 0 1px 2px rgba(67, 56, 202, .3); }
.btn-primary:hover { background: var(--indigo-700); color: #fff; }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--gray-800); }
.btn-danger { background: var(--red-600); color: #fff; border: 1px solid var(--red-700); }
.btn-danger:hover { background: var(--red-700); color: #fff; }
.btn-sm { padding: 0.3125rem 0.75rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.badge-indigo { background: var(--indigo-100); color: var(--indigo-800); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-green { background: var(--green-100); color: var(--green-800); }
.badge-amber { background: var(--amber-100); color: var(--amber-800); }
.badge-red { background: var(--red-100); color: var(--red-800); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
.label, .field > label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.25rem; }
.input {
  display: block; width: 100%; border-radius: var(--radius); border: 1px solid var(--gray-300); background: #fff;
  padding: 0.5rem 0.75rem; font: inherit; font-size: 0.875rem; color: var(--gray-900); box-shadow: var(--shadow-sm);
}
.input:focus { outline: none; border-color: var(--indigo-500); box-shadow: 0 0 0 2px rgba(99, 102, 241, .2); }
.field-check { display: flex; align-items: center; gap: 0.5rem; }
.field-check label { margin: 0; }
.help { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.25rem; }
.help ul { margin: 0.25rem 0 0; padding-left: 1.125rem; }
.errorlist { list-style: none; margin: 0.25rem 0 0; padding: 0; font-size: 0.8125rem; color: var(--red-700); }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.75rem 1rem; border-radius: var(--radius); border: 1px solid; font-size: 0.875rem; margin-bottom: 1.25rem; }
.alert-success { background: var(--green-50); border-color: var(--green-200); color: var(--green-800); }
.alert-error { background: var(--red-50); border-color: var(--red-200); color: var(--red-800); }
.alert-warning { background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-800); }
.alert-info { background: var(--indigo-50); border-color: var(--indigo-200); color: var(--indigo-800); }
.alert .dismiss { background: none; border: 0; font-size: 1.125rem; line-height: 1; color: inherit; cursor: pointer; opacity: .7; padding: 0; }
.alert.fade { opacity: 0; transition: opacity .5s; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-500); background: var(--gray-50); padding: 0.625rem 1rem; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { color: var(--gray-400); }
.table .actions { text-align: right; white-space: nowrap; }

/* ── Bare pages: login, errors ────────────────────────────────────────── */
.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.bare-card { width: 100%; max-width: 24rem; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: 0 4px 16px rgba(17, 24, 39, .06); padding: 2rem; }
.bare-brand { text-align: center; margin-bottom: 1.5rem; }
.bare-brand h1 { font-size: 1.25rem; font-weight: 700; }
.bare-brand p { font-size: 0.8125rem; color: var(--gray-400); margin-top: 0.125rem; }
.bare-card h2 { font-size: 1.125rem; margin-bottom: 0.5rem; }

/* One-time password reveal */
.secret { display: flex; gap: 0.5rem; align-items: center; background: var(--gray-50); border: 1px dashed var(--gray-300); border-radius: var(--radius); padding: 0.75rem 1rem; }
.secret code { font: 600 1.0625rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; flex: 1; overflow-wrap: anywhere; user-select: all; }

/* ── Small screens: sidebar becomes a top section ─────────────────────── */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: 100%; border-right: 0; border-bottom: 1px solid var(--gray-200); }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; overflow: visible; }
  .sidebar-nav .nav-section { display: none; }
  .sidebar-link { width: auto; }
  .main { margin-left: 0; }
  .topbar { padding: 0.75rem 1rem; }
  .content { padding: 1.25rem 1rem; }
}

/* A whole card that is a link */
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--indigo-200); box-shadow: 0 2px 6px rgba(79, 70, 229, .12); }

/* Sign in with Google (follows Google's light button style) */
.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.75rem;
  padding: 0.625rem 1rem; border-radius: var(--radius); border: 1px solid #747775; background: #fff;
  color: #1f1f1f; font-family: inherit; font-size: 0.9375rem; font-weight: 500; text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.btn-google:hover { background: #f8f9fa; color: #1f1f1f; text-decoration: none; box-shadow: 0 1px 3px rgba(60, 64, 67, .25); }
.btn-google .icon { width: 1.125rem; height: 1.125rem; }

.sidebar-email { padding: 0 0.75rem 0.5rem 2.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
