/* ==========================================================================
   LEMASA Executive ERP System & Customer Portal Styles
   Zero cramped horizontal tables — spacious card-based architecture
   Desktop: Left sidebar tabs | Mobile: App-like bottom icon bar
   ========================================================================== */

.erp-shell {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  background: #F4F6F9;
  color: #1A222D;
  overflow: hidden;
}

.erp-shell[hidden] {
  display: none !important;
}

/* Desktop Left Sidebar */
.erp-sidebar {
  width: 256px;
  flex-shrink: 0;
  background: #0D121A;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.erp-brand-bar {
  margin-bottom: 18px;
}

.erp-user-pill {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  margin-bottom: 22px;
}

.erp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #F0B400, #C99100);
  color: #111418;
  font-weight: 800;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.erp-user-meta {
  min-width: 0;
}

.erp-user-meta strong {
  display: block;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-user-meta span {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.56);
}

.erp-side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.erp-nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease;
}

.erp-nav-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #FFFFFF;
}

.erp-nav-btn.active {
  background: rgba(233, 171, 3, 0.18);
  color: #FFD257;
  box-shadow: inset 3px 0 0 #E9AB03;
}

.erp-badge-count {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 800;
  background: #B32223;
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: 999px;
}

.erp-sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.erp-outline-btn,
.erp-logout-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.erp-outline-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.86);
}

.erp-outline-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.erp-logout-btn {
  background: rgba(179, 34, 35, 0.16);
  border: 1px solid rgba(179, 34, 35, 0.35);
  color: #FCA5A5;
}

.erp-logout-btn:hover {
  background: #B32223;
  color: #FFFFFF;
}

/* Main Workspace Panel */
.erp-main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.erp-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid rgba(15, 20, 27, 0.08);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.erp-topbar-left h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0F141B;
}

.erp-topbar-sub {
  font-size: 0.78rem;
  color: #6B7785;
}

.erp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.erp-mobile-exit {
  display: none;
}

.erp-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 36px;
}

/* KPI Grid */
.erp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.erp-kpi-card {
  background: #FFFFFF;
  border: 1px solid rgba(15, 20, 27, 0.08);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 14px rgba(15, 20, 27, 0.04);
}

.erp-kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6B7785;
  margin-bottom: 6px;
}

.erp-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0F141B;
  letter-spacing: -0.02em;
}

.erp-kpi-trend {
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #15803D;
}

.erp-kpi-trend.gold {
  color: #B47B00;
}

/* Section Toolbar (Search + Filter Pills) */
.erp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.erp-search-input {
  width: min(320px, 100%);
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid rgba(15, 20, 27, 0.14);
  background: #FFFFFF;
  font-size: 0.86rem;
  outline: none;
}

.erp-search-input:focus {
  border-color: #E9AB03;
  box-shadow: 0 0 0 3px rgba(233, 171, 3, 0.16);
}

.erp-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.erp-pill-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 20, 27, 0.12);
  background: #FFFFFF;
  font-size: 0.76rem;
  font-weight: 700;
  color: #515F5C;
  cursor: pointer;
}

.erp-pill-btn.active {
  background: #0F141B;
  color: #FFD257;
  border-color: #0F141B;
}

/* Spacious Card Grid (Replaces cramped horizontal tables) */
.erp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.erp-item-card {
  background: #FFFFFF;
  border: 1px solid rgba(15, 20, 27, 0.08);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(15, 20, 27, 0.03);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.erp-item-card:hover {
  border-color: rgba(233, 171, 3, 0.5);
  transform: translateY(-2px);
}

.erp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.erp-card-id {
  font-size: 0.7rem;
  font-weight: 800;
  color: #94A0AE;
  letter-spacing: 0.06em;
}

.erp-card-title {
  margin: 2px 0 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #0F141B;
  line-height: 1.3;
}

.erp-card-sub {
  font-size: 0.8rem;
  color: #515F5C;
}

/* Status Badges */
.status-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-green { background: #DCFCE7; color: #166534; }
.status-gold  { background: #FEF3C7; color: #92400E; }
.status-blue  { background: #DBEAFE; color: #1E40AF; }
.status-red   { background: #FEE2E2; color: #991B1B; }
.status-slate { background: #F1F5F9; color: #334155; }

/* Card Meta Grid */
.erp-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 10px 12px;
  background: #F8FAFC;
  border-radius: 11px;
  font-size: 0.78rem;
}

.erp-meta-grid span {
  display: block;
  font-size: 0.68rem;
  color: #6B7785;
}

.erp-meta-grid strong {
  color: #0F141B;
  font-weight: 700;
}

/* Progress Bar */
.erp-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.erp-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 600;
  color: #515F5C;
}

.erp-progress-bar {
  height: 7px;
  border-radius: 999px;
  background: #E9EDF2;
  overflow: hidden;
}

.erp-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #E9AB03, #F5C33B);
}

.erp-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(15, 20, 27, 0.06);
}

.erp-mini-btn {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(15, 20, 27, 0.14);
  background: #FFFFFF;
  color: #0F141B;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.erp-mini-btn:hover {
  background: #0F141B;
  color: #FFD257;
  border-color: #0F141B;
}

.erp-section-title {
  margin: 0 0 14px;
  font-size: 0.96rem;
  font-weight: 800;
  color: #0F141B;
}

.erp-overview-split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.erp-panel {
  background: #FFFFFF;
  border: 1px solid rgba(15, 20, 27, 0.08);
  border-radius: 16px;
  padding: 18px 20px;
}

.erp-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(15, 20, 27, 0.06);
}

.erp-activity-item:last-child {
  border-bottom: none;
}

.erp-activity-item strong {
  display: block;
  font-size: 0.86rem;
  color: #0F141B;
}

.erp-activity-item small {
  font-size: 0.75rem;
  color: #6B7785;
}

/* Normal Customer Portal Styling */
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(15, 20, 27, 0.08);
  margin-bottom: 18px;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.portal-box {
  background: #F7F8FA;
  border: 1px solid rgba(15, 20, 27, 0.08);
  border-radius: 13px;
  padding: 14px;
}

.portal-box small {
  font-size: 0.72rem;
  color: #6B7785;
  display: block;
}

.portal-box strong {
  font-size: 1rem;
  color: #0F141B;
}

/* Mobile ERP Bottom Nav (Hidden on Desktop) */
.erp-mobile-nav {
  display: none;
}

/* ==========================================================================
   ERP Responsive Breakpoints
   ========================================================================== */
@media (max-width: 960px) {
  .erp-overview-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .erp-sidebar {
    display: none;
  }

  .erp-topbar {
    padding: 12px 14px;
  }

  .erp-topbar-left h1 {
    font-size: 1.05rem;
  }

  .erp-topbar-sub {
    display: none;
  }

  .erp-mobile-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid rgba(15, 20, 27, 0.14);
    background: #F7F8FA;
    color: #0F141B;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
  }

  .erp-mobile-signout {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FECACA;
  }

  .erp-content {
    padding: 16px 14px 86px; /* Room for bottom icon bar */
  }

  .erp-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .erp-kpi-card {
    padding: 13px 14px;
  }

  .erp-kpi-value {
    font-size: 1.2rem;
  }

  .erp-cards-grid {
    grid-template-columns: 1fr;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  /* App-like Mobile Bottom Icon Bar for ERP (Matches Website) */
  .erp-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1150;
    width: 100%;
    max-width: 100vw;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: #0D121A;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }

  .erp-mb-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.62);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 0.64rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 0;
  }

  .erp-mb-btn.active {
    color: #E9AB03;
  }
}
