/* ==========================================================================
   COGFOCUS™ ENTERPRISE DESIGN SYSTEM & COLOR THEME
   Tailored for CogFocus Auto Dealer Multi-Tenant Platform
   ========================================================================== */

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

:root {
  /* Brand Greens */
  --cf-green-500: #00C851;       /* Vibrant Action Green */
  --cf-green-400: #2ECC71;       /* Hover / Bright Accent */
  --cf-green-600: #009E3F;       /* Pressed / Deep Active */
  --cf-green-50:  #E8FFF1;       /* Light subtle green surface */
  --cf-green-100: #D1FADF;       /* Soft green border / badge */

  /* Deep Enterprise Navy (Left Navigation / Super Admin Portal) */
  --cf-navy-950:  #070D19;       /* Deepest Navy */
  --cf-navy-900:  #0B1426;       /* Main Sidebar / Hero panel */
  --cf-navy-800:  #0D1F3C;       /* Surface cards on dark */
  --cf-navy-700:  #132848;       /* Hover on dark items */
  --cf-navy-600:  #1E3A66;       /* Dark borders / dividers */
  --cf-navy-500:  #2C5282;       /* Subtle dark accents */

  /* Neutral Slate Palette (Clean Dealership Workspace) */
  --cf-slate-900: #0F172A;       /* Primary Headings */
  --cf-slate-800: #1E293B;       /* Dark text */
  --cf-slate-700: #334155;       /* Body copy */
  --cf-slate-600: #475569;       /* Secondary copy */
  --cf-slate-500: #64748B;       /* Muted text / labels */
  --cf-slate-400: #94A3B8;       /* Placeholders */
  --cf-slate-300: #CBD5E1;       /* Light borders */
  --cf-slate-200: #E2E8F0;       /* Standard Card Border */
  --cf-slate-100: #F1F5F9;       /* Input backgrounds / tabs */
  --cf-slate-50:  #F8FAFC;       /* App Page Background */
  --cf-white:     #FFFFFF;

  /* Status Tokens */
  --cf-status-stock:      #2563EB; /* Blue: In Stock */
  --cf-status-prep:       #8B5CF6; /* Purple: Under Prep */
  --cf-status-reserved:   #F59E0B; /* Amber: Reserved */
  --cf-status-sold:       #00C851; /* Green: Sold */
  --cf-status-danger:     #EF4444; /* Red: Overdue / Cancelled */

  /* Shadows & Radius */
  --cf-radius-sm: 6px;
  --cf-radius-md: 10px;
  --cf-radius-lg: 16px;
  --cf-radius-xl: 24px;
  --cf-radius-full: 9999px;

  --cf-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --cf-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --cf-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --cf-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Fonts */
  --cf-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --cf-font-mono: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--cf-font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--cf-slate-700);
  background-color: var(--cf-slate-50);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cf-green-500);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--cf-green-400);
  text-decoration: underline;
}

/* ==========================================================================
   Typography Helpers (Balanced Clean Scale for High Readability)
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--cf-slate-900);
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 { font-size: 18px; line-height: 1.25; }
h2 { font-size: 15.5px; line-height: 1.3; }
h3 { font-size: 14px; line-height: 1.35; }
h4 { font-size: 12.5px; font-weight: 600; }

.text-muted { color: var(--cf-slate-500); font-size: 11.5px; }
.text-xs { font-size: 10px; }
.text-sm { font-size: 12px; }
.text-mono { font-family: var(--cf-font-mono); font-size: 11.5px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ==========================================================================
   Buttons (Comfortable Compact Proportion)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--cf-font-sans);
  border-radius: var(--cf-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--cf-green-500);
  color: var(--cf-white) !important;
  border-color: var(--cf-green-500);
  box-shadow: 0 1px 2px rgba(0, 200, 81, 0.2);
}
.btn-primary:hover {
  background-color: var(--cf-green-400);
  border-color: var(--cf-green-400);
  box-shadow: 0 2px 6px rgba(0, 200, 81, 0.3);
}
.btn-primary:active {
  background-color: var(--cf-green-600);
}

.btn-dark {
  background-color: var(--cf-navy-900);
  color: var(--cf-white) !important;
  border-color: var(--cf-navy-800);
}
.btn-dark:hover {
  background-color: var(--cf-navy-800);
}

.btn-outline {
  background-color: var(--cf-white);
  color: var(--cf-slate-700) !important;
  border-color: var(--cf-slate-300);
}
.btn-outline:hover {
  background-color: var(--cf-slate-100);
  color: var(--cf-slate-900) !important;
}

.btn-danger {
  background-color: var(--cf-status-danger);
  color: var(--cf-white) !important;
}
.btn-danger:hover {
  background-color: #DC2626;
}

.btn-sm {
  padding: 3.5px 8px;
  font-size: 11px;
}
.btn-lg {
  padding: 8px 16px;
  font-size: 13.5px;
}

/* ==========================================================================
   Forms & Inputs (Clean Data Entry)
   ========================================================================== */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cf-slate-800);
  margin-bottom: 3px;
}

.form-label .required {
  color: var(--cf-status-danger);
  margin-left: 2px;
}

.form-control, .form-select {
  width: 100%;
  padding: 5px 9px;
  font-size: 12px;
  font-family: var(--cf-font-sans);
  color: var(--cf-slate-800);
  background-color: var(--cf-white);
  border: 1px solid var(--cf-slate-200);
  border-radius: var(--cf-radius-sm);
  transition: all 0.15s ease;
  height: 31px;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--cf-green-500);
  box-shadow: 0 0 0 2px rgba(0, 200, 81, 0.15);
}
.form-control::placeholder {
  color: var(--cf-slate-400);
  font-size: 11.5px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--cf-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green {
  background-color: var(--cf-green-50);
  color: var(--cf-green-600);
  border: 1px solid var(--cf-green-100);
}
.badge-blue {
  background-color: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.badge-amber {
  background-color: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}
.badge-red {
  background-color: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}
.badge-slate {
  background-color: var(--cf-slate-100);
  color: var(--cf-slate-600);
  border: 1px solid var(--cf-slate-200);
}

/* ==========================================================================
   Cards & Layout Components (Compact Elevation)
   ========================================================================== */
.card {
  background-color: var(--cf-white);
  border: 1px solid var(--cf-slate-200);
  border-radius: var(--cf-radius-sm);
  box-shadow: var(--cf-shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}

.card-header {
  padding: 9px 13px;
  border-bottom: 1px solid var(--cf-slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--cf-white);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cf-slate-900);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-body {
  padding: 12px 14px;
}

.card-footer {
  padding: 9px 13px;
  background-color: var(--cf-slate-50);
  border-top: 1px solid var(--cf-slate-200);
}

/* ==========================================================================
   KPI Summary Metric Cards (Comfortable Clean Scale)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--cf-white);
  border: 1px solid var(--cf-slate-200);
  border-radius: var(--cf-radius-sm);
  padding: 10px 13px;
  box-shadow: var(--cf-shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--cf-shadow-md);
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--cf-slate-500);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.kpi-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--cf-slate-900);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 2px;
}

.kpi-meta {
  font-size: 11px;
  color: var(--cf-slate-500);
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-meta.trend-up { color: var(--cf-green-500); font-weight: 600; }
.kpi-meta.trend-down { color: var(--cf-status-danger); font-weight: 600; }

/* ==========================================================================
   Data Tables (Comfortable Clean Scan)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background-color: var(--cf-slate-50);
  color: var(--cf-slate-600);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 9px;
  border-bottom: 1px solid var(--cf-slate-200);
  white-space: nowrap;
}

.table td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--cf-slate-200);
  color: var(--cf-slate-700);
  font-size: 11.5px;
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: #F8FAFC;
}

/* ==========================================================================
   Alert Banners (Subscriptions & Expiry)
   ========================================================================== */
.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  margin-bottom: 14px;
  border-radius: var(--cf-radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.alert-banner-warning {
  background-color: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.alert-banner-danger {
  background-color: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}
.alert-banner-success {
  background-color: var(--cf-green-50);
  color: var(--cf-green-600);
  border: 1px solid var(--cf-green-100);
}

/* ==========================================================================
   Dashboard App Shell (Sidebar + Main View)
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar (Fixed Height with Pinned Bottom Logout) */
.app-sidebar {
  width: 230px;
  background-color: var(--cf-navy-900);
  color: var(--cf-white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--cf-navy-700);
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  z-index: 20;
}

.app-sidebar .brand-header {
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--cf-navy-700);
  flex-shrink: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--cf-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cf-white);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--cf-green-400);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 8px 6px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--cf-navy-700);
  border-radius: 4px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--cf-slate-500);
  letter-spacing: 0.05em;
  padding: 8px 8px 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--cf-radius-sm);
  color: #94A3B8;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.15s ease;
}
.nav-link:hover {
  background-color: var(--cf-navy-800);
  color: var(--cf-white);
}
.nav-link.active {
  background-color: var(--cf-navy-800);
  color: var(--cf-green-400);
  font-weight: 600;
}
.nav-link svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--cf-navy-700);
  background-color: var(--cf-navy-950);
  margin-top: auto;
  flex-shrink: 0;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  margin-top: 10px;
  background-color: rgba(239, 68, 68, 0.12);
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--cf-radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s ease;
  cursor: pointer;
}
.sidebar-logout-btn:hover {
  background-color: rgba(239, 68, 68, 0.25);
  color: #FFFFFF !important;
  border-color: rgba(239, 68, 68, 0.45);
}

/* Password Toggle Field */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-wrapper input {
  padding-right: 40px !important;
  width: 100%;
}
.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--cf-slate-400);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease;
}
.password-toggle-btn:hover {
  color: var(--cf-slate-700);
}

/* App Main Content */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: 46px;
  background-color: var(--cf-white);
  border-bottom: 1px solid var(--cf-slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-tenant-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--cf-slate-100);
  padding: 2.5px 8px;
  border-radius: var(--cf-radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--cf-slate-700);
  font-family: var(--cf-font-mono);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 7px;
}

.user-avatar {
  width: 27px;
  height: 27px;
  background-color: var(--cf-green-50);
  border: 1px solid var(--cf-green-100);
  color: var(--cf-green-600);
  font-weight: 700;
  border-radius: var(--cf-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.app-content {
  padding: 14px 18px;
  flex: 1;
}

/* ==========================================================================
   Enterprise Sign-In Screen (Compact Clean Scale)
   ========================================================================== */
.auth-page-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.auth-hero-pane {
  flex: 1.1;
  background-color: var(--cf-navy-900);
  color: var(--cf-white);
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-hero-pane::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 200, 81, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-brand-logo {
  width: 36px;
  height: 36px;
  background-color: var(--cf-white);
  border-radius: var(--cf-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--cf-white);
}
.auth-brand-tag {
  font-size: 9.5px;
  color: var(--cf-green-400);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-hero-content {
  max-width: 480px;
  margin: 24px 0;
}

.auth-hero-content h1 {
  color: var(--cf-white);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.auth-hero-content p {
  color: #94A3B8;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 22px;
}

.auth-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: #E2E8F0;
}

.check-icon {
  width: 19px;
  height: 19px;
  background-color: rgba(0, 200, 81, 0.15);
  color: var(--cf-green-500);
  border-radius: var(--cf-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.auth-hero-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #64748B;
  border-top: 1px solid var(--cf-navy-700);
  padding-top: 18px;
}

.auth-hero-footer a {
  color: #94A3B8;
  margin-left: 14px;
}

.auth-form-pane {
  flex: 0.9;
  background-color: var(--cf-white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 48px;
}

.auth-form-wrapper {
  width: 100%;
  max-width: 460px;
}

.auth-form-wrapper h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--cf-slate-900);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.auth-form-wrapper .subtitle {
  color: var(--cf-slate-600);
  font-size: 14px;
  margin-bottom: 22px;
  line-height: 1.45;
}

.auth-form-wrapper .form-group {
  margin-bottom: 16px;
}

.auth-form-wrapper .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--cf-slate-800);
  margin-bottom: 6px;
}

.auth-form-wrapper .form-control,
.auth-form-wrapper .form-select {
  height: 44px;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 8px;
  border: 1.5px solid var(--cf-slate-300);
  background-color: #FAFAFA;
  transition: all 0.2s ease;
}

.auth-form-wrapper .form-control:focus,
.auth-form-wrapper .form-select:focus {
  border-color: var(--cf-green-500);
  background-color: var(--cf-white);
  box-shadow: 0 0 0 3px rgba(0, 200, 81, 0.18);
}

.auth-form-wrapper .form-control::placeholder {
  font-size: 13.5px;
  color: var(--cf-slate-400);
}

.auth-form-wrapper .password-toggle-btn {
  right: 12px;
}

.auth-form-wrapper .btn-primary {
  height: 46px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  margin-top: 14px;
}

.sso-btn {
  width: 100%;
  padding: 9px;
  background-color: var(--cf-navy-900);
  color: var(--cf-white);
  border: 1px solid var(--cf-navy-800);
  border-radius: var(--cf-radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 18px;
  transition: background-color 0.15s ease;
}
.sso-btn:hover {
  background-color: var(--cf-navy-800);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--cf-slate-400);
  font-size: 11px;
  font-weight: 500;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--cf-slate-200);
}
.divider::before { margin-right: 10px; }
.divider::after { margin-left: 10px; }

/* Responsive */
@media (max-width: 1024px) {
  .auth-hero-pane { display: none; }
  .auth-form-pane { padding: 40px 24px; }
  .app-sidebar { width: 72px; }
  .app-sidebar .brand-title, .app-sidebar .brand-subtitle, .app-sidebar .nav-link span, .app-sidebar .nav-section-title { display: none; }
}
