/* ── MyMetrixLab Portal — admin shell ─────────────────────────────────── */

:root {
  --brand-purple:      #8B5CF6;
  --brand-purple-dark: #6D28D9;
  --brand-purple-50:   #F5F3FF;
  --brand-orange:      #F97316;
  --brand-dark:        #111827;
  --gray-50:           #F9FAFB;
  --gray-100:          #F3F4F6;
  --gray-200:          #E5E7EB;
  --gray-300:          #D1D5DB;
  --gray-500:          #6B7280;
  --gray-700:          #374151;
  --gray-900:          #111827;
  --sidebar-width:     260px;
  --bs-primary:        #8B5CF6;
  --bs-primary-rgb:    139, 92, 246;
  --bs-link-color:     #8B5CF6;
  --bs-link-hover-color: #6D28D9;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

a { color: var(--brand-purple); text-decoration: none; }
a:hover { color: var(--brand-purple-dark); }

.text-purple        { color: var(--brand-purple) !important; }
.text-orange        { color: var(--brand-orange) !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.fw-900 { font-weight: 900 !important; }

.purple-grad { background: linear-gradient(135deg, #8B5CF6, #6D28D9) !important; }

/* ── Shell ────────────────────────────────────────────────────────────── */
.portal-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.portal-sidebar {
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0 .25rem 1.5rem;
  color: var(--gray-900);
  font-weight: 800;
  font-size: 1.05rem;
}
.portal-brand:hover { color: var(--gray-900); }
.portal-brand-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.portal-brand-text { line-height: 1.1; }

.portal-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1 1 auto;
}
.portal-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: 10px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: .92rem;
  transition: background .15s, color .15s;
}
.portal-nav-link i { font-size: 1.05rem; color: var(--gray-500); }
.portal-nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}
.portal-nav-link.active {
  background: var(--brand-purple-50);
  color: var(--brand-purple-dark);
  font-weight: 600;
}
.portal-nav-link.active i { color: var(--brand-purple); }

.portal-sidebar-footer {
  border-top: 1px solid var(--gray-200);
  padding-top: 1rem;
  margin-top: 1rem;
}
.portal-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .5rem;
  border-radius: 10px;
  color: var(--gray-700);
  text-decoration: none;
  transition: background .15s;
}
.portal-user:hover { background: var(--gray-100); color: var(--gray-900); }
.portal-user.active { background: var(--brand-purple-50); }
.portal-user.active .portal-user-name { color: var(--brand-purple-dark); }
.portal-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.portal-user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.portal-user-name { font-weight: 600; font-size: .9rem; color: var(--gray-900); }
.portal-user-role { font-size: .75rem; color: var(--gray-500); }

.portal-logout {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: .9rem;
}
.portal-logout:hover {
  background: #FEF2F2;
  color: #B91C1C;
}

/* ── Main ─────────────────────────────────────────────────────────────── */
.portal-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.portal-topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.portal-page-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -.01em;
}
.portal-page-subtitle {
  margin: .15rem 0 0;
  color: var(--gray-500);
  font-size: .88rem;
}
.portal-topbar-actions { display: flex; gap: .5rem; }
.portal-content { padding: 1.5rem 2rem 3rem; }

/* ── Cards / panels ───────────────────────────────────────────────────── */
.panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.panel-title {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

/* ── Stat cards ───────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.stat-card-link {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.stat-card-link:hover { color: inherit; }
.stat-card-link:hover .stat-card { border-color: var(--brand-purple); }
.stat-card-hint { margin-top: auto; }
.stat-card-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-card-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: .3rem 0 .1rem;
}
.stat-card-hint {
  font-size: .82rem;
  color: var(--gray-500);
}
.stat-card-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--brand-purple-50);
  color: var(--brand-purple-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  float: right;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  overflow: hidden;
}
.table-card .table {
  margin: 0;
}
.table-card .table > :not(caption) > * > * {
  padding: .9rem 1.1rem;
  border-bottom-color: var(--gray-100);
}
.table-card thead th {
  background: var(--gray-50);
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}
.table-card tbody tr:hover { background: var(--gray-50); }
.table-card tbody tr:last-child td { border-bottom: 0; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-purple {
  background: var(--brand-purple);
  border-color: var(--brand-purple);
  color: #fff;
}
.btn-purple:hover,
.btn-purple:focus {
  background: var(--brand-purple-dark);
  border-color: var(--brand-purple-dark);
  color: #fff;
}
.btn-purple-soft {
  background: var(--brand-purple-50);
  border-color: var(--brand-purple-50);
  color: var(--brand-purple-dark);
}
.btn-purple-soft:hover {
  background: #EDE9FE;
  color: var(--brand-purple-dark);
}
.btn-pill { border-radius: 999px; }

/* ── Status badges ────────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.pill-success { background: #DCFCE7; color: #166534; }
.pill-warning { background: #FEF3C7; color: #92400E; }
.pill-danger  { background: #FEE2E2; color: #991B1B; }
.pill-info    { background: #DBEAFE; color: #1E40AF; }
.pill-muted   { background: var(--gray-100); color: var(--gray-700); }
.pill-purple  { background: var(--brand-purple-50); color: var(--brand-purple-dark); }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}
.empty-state i { font-size: 2.5rem; color: var(--gray-300); display: block; margin-bottom: .75rem; }

/* ── Auth page ────────────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
}
.auth-left {
  background: linear-gradient(135deg, #8B5CF6, #6D28D9);
  color: #fff;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form .form-control {
  border-radius: 10px;
  padding: .65rem .85rem;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.auth-form .form-control:focus {
  border-color: var(--brand-purple);
  background: #fff;
  box-shadow: 0 0 0 .2rem rgba(139, 92, 246, .15);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .portal-shell { grid-template-columns: 1fr; }
  .portal-sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem;
  }
  .portal-nav { flex-direction: row; flex-wrap: wrap; }
  .portal-nav-link { padding: .45rem .65rem; font-size: .85rem; }
  .portal-nav-link span { display: none; }
  .portal-sidebar-footer { display: none; }
  .portal-topbar { padding: 1rem 1.25rem; }
  .portal-content { padding: 1rem 1.25rem 2rem; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-left { display: none; }
}
