/* ═══════════════════════════════════════════════════
   Onboardio — Global Stylesheet
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary:    #6366f1;
  --primary-d:  #4f46e5;
  --accent:     #06b6d4;
  --dark:       #0f172a;
  --muted:      #64748b;
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --success:    #10b981;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--dark);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }
img { max-width: 100%; display: block; }

/* ── Typography ──────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; line-height: 1.2; color: var(--dark); }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; color: var(--dark); }
h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.4; color: var(--dark); }
h4 { font-size: 1rem;   font-weight: 600; color: var(--dark); }
p  { color: var(--muted); line-height: 1.7; }

/* ── Layout ──────────────────────────────────────── */
.container  { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 560px;  margin: 0 auto; padding: 0 24px; }
.container-md { max-width: 800px;  margin: 0 auto; padding: 0 24px; }

/* ── Navigation ──────────────────────────────────── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-inner {
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo span { color: var(--primary); }
.nav-logo-mark {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
}
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-link  { font-size: .88rem; color: var(--muted); font-weight: 500; }
.nav-link:hover { color: var(--dark); }
.nav-user  { font-size: .85rem; color: var(--muted); }

/* ── Sidebar layout ──────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar-section { padding: 0 12px; margin-bottom: 24px; }
.sidebar-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  color: var(--muted);
  transition: background .1s, color .1s;
}
.sidebar-link:hover { background: var(--bg); color: var(--dark); }
.sidebar-link.active { background: #eef2ff; color: var(--primary); }
.sidebar-link svg { flex-shrink: 0; }
.app-main { flex: 1; padding: 32px; min-width: 0; }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body   { padding: 24px; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { margin: 0; font-size: .95rem; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stat cards ──────────────────────────────────── */
.stat-card { padding: 20px 24px; }
.stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: background .12s, transform .08s, box-shadow .12s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-d); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--dark); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--dark); }
.btn-sm       { padding: 7px 14px; font-size: .82rem; }
.btn-lg       { padding: 13px 24px; font-size: .95rem; }
.btn-block    { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-label  {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-family: 'Inter', sans-serif;
  color: var(--dark);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-control::placeholder { color: #94a3b8; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 5px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-primary  { background: #eef2ff; color: var(--primary); }
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-muted    { background: #f1f5f9; color: var(--muted); }
.badge-accent   { background: #cffafe; color: #0e7490; }

/* ── Table ───────────────────────────────────────── */
.table-wrap { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th {
  background: var(--bg);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: var(--muted);
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: .88rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Alerts / Toasts ─────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-success { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.alert-danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.alert-info    { background: #e0f2fe; border-color: #7dd3fc; color: #0369a1; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  padding: 16px;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(520px, 100%);
  transform: translateY(10px);
  transition: transform .15s;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1.2rem; line-height: 1; padding: 4px;
}
.modal-body   { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Page header ─────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.page-header p  { font-size: .88rem; margin: 0; }

/* ── Grid helpers ────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
@media(max-width:900px) { .grid-3,.grid-4 { grid-template-columns: repeat(2,1fr); } }
@media(max-width:600px) { .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }

/* ── Pagination ──────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.page-btn {
  padding: 7px 13px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  text-decoration: none; color: var(--dark);
  background: var(--surface); border: 1.5px solid var(--border);
}
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* ── Empty state ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-state svg { opacity: .25; margin: 0 auto 16px; }
.empty-state h3 { color: var(--dark); margin-bottom: 8px; }
.empty-state p  { font-size: .88rem; }

/* ── Divider ─────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Utility ─────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-sm      { font-size: .82rem; }
.text-xs      { font-size: .72rem; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

/* ── Auth pages ──────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.auth-header {
  padding: 32px 36px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 20px;
}
.auth-logo span { color: var(--primary); }
.auth-body { padding: 28px 36px 32px; }

/* ── Landing page ────────────────────────────────── */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--dark);
}
.hero h1 span { color: var(--primary); }
.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 32px;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Tenant colour overrides (injected per tenant) ── */
/* .tenant-primary set via inline style on :root */

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }
