/* Luton Labs SaaS — Application Styles */

:root {
  --navy:       #0a1428;
  --blue:       #1e5eff;
  --blue-dark:  #0d3bc4;
  --cyan:       #06b6d4;
  --sidebar-w:  260px;
  --topbar-h:   64px;
  --white:      #ffffff;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-600:   #475569;
  --green:      #16a34a;
  --amber:      #d97706;
  --red:        #dc2626;
  --radius:     8px;
  --shadow:     0 1px 6px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--navy);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

/* ── Login Page ──────────────────────────────────── */
body.login-page {
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.10);
  padding: 2.75rem 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-logo { display: flex; justify-content: center; margin-bottom: 1.75rem; }
.login-logo img { height: 92px; width: auto; }

.login-heading { text-align: center; margin-bottom: 1.75rem; }
.login-heading h1 { font-size: 1.35rem; font-weight: 700; color: var(--navy); margin-bottom: 0.4rem; }

.tenant-badge {
  display: inline-block;
  background: #dceafe;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--red);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.87rem; font-weight: 500; color: #374151; margin-bottom: 0.35rem; }

input[type="email"],
input[type="password"],
input[type="text"],
select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.93rem;
  color: var(--navy);
  background: var(--gray-50);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(30,94,255,0.12);
}
input::placeholder { color: var(--gray-400); }

.field-error { font-size: 0.82rem; color: var(--red); margin-top: 0.3rem; }
.field-help  { font-size: 0.82rem; color: var(--gray-500); margin-top: 0.3rem; }

.login-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.4rem;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--blue-dark); }

.forgot-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.87rem;
  color: var(--gray-500);
  text-decoration: none;
}
.forgot-link:hover { color: var(--blue); }

.login-footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--gray-400);
}
.login-footer img { height: 24px; opacity: 0.6; }

/* ── App Layout ──────────────────────────────────── */
body.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 20;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-logo img { height: 56px; width: auto; display: block; }
.sidebar-org {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav { flex: 1; padding: 0.75rem 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,0.62);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { border-left: 3px solid var(--blue); padding-left: calc(1.25rem - 3px); }
.nav-item--soon { cursor: default; opacity: 0.45; }
.nav-item--soon:hover { background: none; color: rgba(255,255,255,0.62); }

.nav-section-label {
  padding: 1rem 1.25rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.badge-soon {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.35);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { display: block; font-size: 0.87rem; font-weight: 600; color: rgba(255,255,255,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { display: block; font-size: 0.75rem; color: rgba(255,255,255,0.4); }

.sidebar-logout {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: var(--white); }
.sidebar-logout svg { width: 18px; height: 18px; display: block; }

/* ── Main Area ───────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; gap: 0.75rem; align-items: center; }

.content { flex: 1; padding: 2rem; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-primary { background: var(--blue); color: var(--white); border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--gray-200); }
.btn-outline:hover { border-color: var(--navy); }

/* ── Panels / Cards ──────────────────────────────── */
.panel {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel--narrow { max-width: 560px; padding: 2rem; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
}
.panel-title { font-size: 0.97rem; font-weight: 700; }
.panel-link { font-size: 0.85rem; color: var(--blue); text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

/* ── Stat Cards ──────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card--soon { opacity: 0.55; }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--blue  { background: #dceafe; } .stat-icon--blue svg  { stroke: var(--blue); }
.stat-icon--amber { background: #fef3c7; } .stat-icon--amber svg { stroke: var(--amber); }
.stat-icon--green { background: #dcfce7; } .stat-icon--green svg { stroke: var(--green); }
.stat-icon--gray  { background: var(--gray-100); } .stat-icon--gray svg { stroke: var(--gray-400); }

.stat-label { font-size: 0.78rem; color: var(--gray-500); font-weight: 500; margin-bottom: 0.2rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-value--soon { font-size: 0.85rem; font-weight: 500; color: var(--gray-400); }

/* ── Tables ──────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.data-table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--navy);
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

.actions-cell { display: flex; gap: 0.75rem; align-items: center; }
.action-link { font-size: 0.82rem; font-weight: 600; color: var(--blue); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.action-link:hover { text-decoration: underline; }
.action-link--danger { color: var(--red); }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge--success, .badge--active   { background: #dcfce7; color: #15803d; }
.badge--failure, .badge--locked   { background: #fef2f2; color: var(--red); }
.badge--denied,  .badge--disabled { background: #fef3c7; color: #92400e; }

/* ── Form Actions ────────────────────────────────── */
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.panel--narrow .form-group { margin-bottom: 1.1rem; }

/* ── Welcome Banner (Member) ─────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, var(--navy), #0d2461);
  color: var(--white);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  margin-bottom: 1.75rem;
}
.welcome-banner h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.3rem; }
.welcome-banner p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.module-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.75rem;
}
.module-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.module-card p  { font-size: 0.85rem; color: var(--gray-500); }
.module-card--soon { opacity: 0.55; }

/* ── Alerts ──────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.alert--success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert--error   { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }

/* ── Utilities ───────────────────────────────────── */
.mt-6 { margin-top: 1.5rem; }
.text-sm   { font-size: 0.82rem; }
.text-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .stat-grid, .modules-grid { grid-template-columns: 1fr; }
}
