/* SUMO admin interface styles */
:root {
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --danger:         #dc2626;
  --danger-hover:   #b91c1c;
  --surface:        #ffffff;
  --bg:             #f3f4f6;
  --border:         #d1d5db;
  --text:           #111827;
  --text-muted:     #6b7280;
  --warn:           #d97706;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 0.9375rem;
}

/* ── Page layout ── */
.page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem 2rem;
}

.card {
  background: var(--surface);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  padding: 2rem;
  width: 100%;
  max-width: 26rem;
}

.card-wide { max-width: 62rem; }

/* ── Typography ── */
h1 { font-size: 1.375rem; font-weight: 700; margin: 0 0 1.5rem; }
h2 { font-size: 1.0625rem; font-weight: 600; margin: 1.75rem 0 0.75rem; }
h2:first-child { margin-top: 0; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.3125rem;
  color: var(--text);
}

.form-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  outline: none;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-input[readonly] { background: #f9fafb; color: var(--text-muted); }

/* inline input + icon button */
.input-row { display: flex; }
.input-row .form-input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-row .btn-icon {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
}

/* ── Password strength ── */
.strength-bar {
  height: 0.25rem;
  border-radius: 9999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-top: 0.375rem;
}
.strength-fill {
  height: 100%;
  width: 0;
  border-radius: 9999px;
  transition: width 0.25s ease, background-color 0.25s ease;
}
.strength-score-0 { width: 20%; background-color: #ef4444; }
.strength-score-1 { width: 40%; background-color: #f97316; }
.strength-score-2 { width: 60%; background-color: #eab308; }
.strength-score-3 { width: 80%; background-color: #22c55e; }
.strength-score-4 { width: 100%; background-color: #16a34a; }
.strength-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  transition: background-color 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-full { width: 100%; display: block; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: #f9fafb; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-icon {
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  line-height: 1;
}
.btn-icon:hover:not(:disabled) { background: #f3f4f6; }
.btn-icon:disabled { opacity: 0.45; cursor: not-allowed; }

/* Link-styled button (e.g. the user-table Reload control). */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
}
.btn-link:hover:not(:disabled) { text-decoration: underline; }
.btn-link:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Alerts ── */
.alert {
  border-radius: 0.375rem;
  padding: 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-dismissable { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.alert-close {
  background: none;
  border: none;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}
.alert-close:hover { opacity: 1; }

/* ── Misc helpers ── */
.warning { color: var(--warn); font-size: 0.75rem; margin-top: 0.25rem; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.hidden { display: none !important; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* ── Action rows ── */
.actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 1.25rem; }
.text-center { text-align: center; }
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ── Home page ── */
.home-actions { display: flex; flex-direction: column; gap: 0.625rem; margin-top: 1rem; }
.home-meta { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* SVG icons inside buttons – align with text */
.btn svg { vertical-align: middle; margin-right: 0.4em; flex-shrink: 0; }
.btn { text-decoration: none; }

/* Footer branding shown on all login/account steps */
.sumo-brand { text-align: center; margin-top: 1.75rem; }
.sumo-brand p { margin-top: 0.25rem; font-size: 0.8125rem; color: var(--text-muted); }

/* ── Table ── */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th, .table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-weight: 500;
  color: var(--text-muted);
  background: #f9fafb;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-invited    { background: #fef3c7; color: #92400e; }
.badge-registered { background: #d1fae5; color: #065f46; }

/* Fixed three-column grid so reinvite/edit/delete icons line up vertically across
   all rows. Rows without a reinvite action render an empty .action-slot placeholder. */
.table-cell-actions {
  display: grid;
  grid-template-columns: repeat(3, 2.75rem);
  gap: 0.375rem;
  align-items: center;
  justify-content: end;
}
.table-cell-actions .btn-icon { width: 100%; padding-left: 0; padding-right: 0; text-align: center; }
.action-slot { display: block; }
.input-sm { width: 10rem; padding: 0.25rem 0.5rem; font-size: 0.8125rem; }
.btn-icon-danger { color: var(--danger); border-color: #fecaca; }
.btn-icon-danger:hover { background: #fef2f2; }

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

/* ── SPA layout utilities (used by spa.js, replaces inline styles) ── */
.flex-between-base { display: flex; justify-content: space-between; align-items: baseline; }
.flex-wrap-end     { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.flex-gap-xs       { display: flex; gap: 0.25rem; }
.flex-1            { flex: 1; }
.flex-2            { flex: 2; }
.flex-15           { flex: 1.5; }
.min-w-7           { min-width: 7rem; }
.min-w-8           { min-width: 8rem; }
.min-w-9           { min-width: 9rem; }
.min-w-10          { min-width: 10rem; }
.w-6-fixed         { width: 6rem; flex-shrink: 0; }
.mb-0              { margin-bottom: 0 !important; }
.nowrap            { white-space: nowrap; }
