/* ==========================================================================
   Shree Krishna Pragati - World-Class Enterprise SaaS Design System
   Executive Industrial Luxury Theme (Peacock Emerald, Royal Navy & Champagne Gold)
   ========================================================================== */

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

:root {
  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Executive Luxury Color Palette (Reflecting Official Mor Pankh Logo) */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #070d18;
  --bg-sidebar-elevated: #0f172a;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);

  /* Primary & Accent Hierarchy */
  --primary: #1e3a8a;          /* Deep Royal Navy */
  --primary-hover: #172554;
  --primary-light: #eff6ff;
  --primary-glow: rgba(30, 58, 138, 0.25);

  --peacock: #0284c7;          /* Royal Peacock Cyan */
  --peacock-hover: #0369a1;
  --peacock-light: #f0f9ff;
  --peacock-glow: rgba(2, 132, 199, 0.25);

  --emerald: #059669;          /* Deep Jade / Mor Pankh Green */
  --emerald-hover: #047857;
  --emerald-light: #ecfdf5;
  --emerald-glow: rgba(5, 150, 105, 0.22);

  --gold: #d97706;             /* Imperial Champagne Gold */
  --gold-hover: #b45309;
  --gold-light: #fffbeb;
  --gold-glow: rgba(217, 119, 6, 0.25);

  --danger: #e11d48;           /* Vivid Crimson Rose */
  --danger-light: #fff1f2;
  --danger-glow: rgba(225, 29, 72, 0.2);

  /* Neutral Slate Tones */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-white: #ffffff;

  --border: #e2e8f0;
  --border-subtle: rgba(226, 232, 240, 0.85);
  --border-focus: #38bdf8;

  /* Multi-Stop Ambient Shadows (Senior SaaS Quality) */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 45px -8px rgba(15, 23, 42, 0.14), 0 8px 18px -4px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 8px 20px -4px rgba(15, 23, 42, 0.06), 0 0 1px 0 rgba(15, 23, 42, 0.08);
  --shadow-card-hover: 0 8px 24px -4px rgba(15, 23, 42, 0.1), 0 2px 8px -2px rgba(15, 23, 42, 0.04), 0 0 1px 0 rgba(15, 23, 42, 0.12);

  /* Geometry & Layout */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --sidebar-width: 275px;
  --header-height: 70px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 14.5px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

p {
  margin-bottom: 0.5rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--peacock);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   Preloader Component
   ========================================================================== */
#skp-preloader {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0f1d3a 0%, #060b17 100%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#skp-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-cube-wrap {
  position: relative;
  width: 75px;
  height: 75px;
  margin-bottom: 24px;
}

.preloader-cube {
  position: absolute;
  inset: 0;
  border: 3.5px solid var(--gold);
  border-radius: var(--radius-md);
  animation: preloaderSpin 2.4s infinite cubic-bezier(0.68, -0.55, 0.27, 1.55);
  box-shadow: 0 0 30px rgba(217, 119, 6, 0.4);
}

.preloader-cube-inner {
  position: absolute;
  inset: 14px;
  background: linear-gradient(135deg, var(--peacock), var(--primary));
  border-radius: var(--radius-sm);
  animation: preloaderPulse 1.6s infinite ease-in-out;
  box-shadow: 0 0 25px rgba(2, 132, 199, 0.5);
}

@keyframes preloaderSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); border-color: #38bdf8; }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes preloaderPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

.preloader-title {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #ffffff 0%, #fef08a 50%, #bae6fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.preloader-subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.preloader-bar-wrap {
  width: 220px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.preloader-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--peacock), var(--gold), var(--emerald));
  animation: preloaderBar 1.3s infinite ease-in-out;
  border-radius: var(--radius-full);
}

@keyframes preloaderBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

/* ==========================================================================
   Application Architecture & Layout
   ========================================================================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Sidebar - Executive Obsidian Blue with Golden Highlights */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #070d18 0%, #0a1324 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 4px 0 24px -2px rgba(0, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.sidebar-brand-info h4 {
  color: #ffffff;
  font-size: 1.05rem;
  line-height: 1.2;
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #ffffff, #fef08a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand-info span {
  font-size: 0.7rem;
  color: #64748b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  padding: 12px 14px 6px;
  margin-top: 10px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 9.5px 14px;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
  font-size: 0.86rem;
  font-weight: 500;
  transition: var(--transition);
  gap: 12px;
  text-decoration: none;
  position: relative;
}

.sidebar-nav-item i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  color: #64748b;
  transition: var(--transition);
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(3px);
}

.sidebar-nav-item:hover i {
  color: #38bdf8;
}

.sidebar-nav-item.active {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.22) 0%, rgba(30, 58, 138, 0.12) 100%);
  color: #ffffff;
  font-weight: 600;
  border-left: 3.5px solid #38bdf8;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.sidebar-nav-item.active i {
  color: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.35);
}

.user-quick-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--peacock), var(--emerald));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.user-meta {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.64rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(2, 132, 199, 0.25);
  color: #7dd3fc;
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Main Content Area */
.app-main {
  flex: 1 1 0%;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

/* Header Navbar - Frosted Luxury Glass */
.app-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.03);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.sidebar-toggle-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-main);
  border-color: #cbd5e1;
}

.page-title-badge {
  min-width: 0;
}

.page-title-badge h1 {
  font-size: 1.32rem;
  margin: 0;
  line-height: 1.2;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.page-title-badge span {
  font-size: 0.77rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.quick-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-backup-header {
  background: #0f172a;
  color: #38bdf8;
  border: 1px solid #334155;
  font-weight: 600;
}

.header-live-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}

.user-menu-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.header-user-btn {
  border-radius: 50px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-logout-btn {
  color: #ef4444;
  padding: 6px 10px;
}

.live-dot {
  width: 8.5px;
  height: 8.5px;
  border-radius: var(--radius-full);
  background: var(--emerald);
  display: inline-block;
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.6);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.25); }
}

/* Page Body Container */
.page-container {
  flex: 1 1 0%;
  padding: 30px 32px 40px;
  max-width: 1600px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ==========================================================================
   Luxury Cards & Containers
   ========================================================================== */
.skp-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 26px;
  margin-bottom: 24px;
  transition: var(--transition);
  position: relative;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.skp-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(203, 213, 225, 0.8);
}

/* App Footer Bar */
.app-footer-bar {
  padding: 16px 28px;
  font-size: 0.78rem;
  color: #94a3b8;
  border-top: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.card-title-group h3 {
  font-size: 1.18rem;
  margin-bottom: 3px;
  font-weight: 800;
  color: #0f172a;
}

.card-title-group p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Executive KPI Stat Cards (World-Class Redesign)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.09), 0 0 1px 0 rgba(15, 23, 42, 0.12);
  border-color: #cbd5e1;
}

/* Top Accent Line */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, var(--primary), var(--peacock));
}

.kpi-card.accent-emerald::before {
  background: linear-gradient(90deg, #059669, #10b981);
}
.kpi-card.accent-cyan::before {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}
.kpi-card.accent-amber::before {
  background: linear-gradient(90deg, #d97706, #fbbf24);
}
.kpi-card.accent-rose::before {
  background: linear-gradient(90deg, #e11d48, #f43f5e);
}

.kpi-data span {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 6px;
}

.kpi-data h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: #0f172a;
  line-height: 1.15;
  margin-bottom: 8px;
  font-family: var(--font-heading);
}

.kpi-data small {
  font-size: 0.77rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.icon-blue {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.icon-emerald {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #047857;
  border: 1px solid #a7f3d0;
}
.icon-cyan {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #0284c7;
  border: 1px solid #bae6fd;
}
.icon-amber {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #b45309;
  border: 1px solid #fde68a;
}
.icon-rose {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  color: #be123c;
  border: 1px solid #fecdd3;
}

/* ==========================================================================
   Buttons & Micro-Interactions
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: var(--font-sans);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
  color: #ffffff;
  border-color: #172554;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(180deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border-color: #065f46;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  border-color: #9f1239;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border);
  color: #334155;
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  border-color: #92400e;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.btn-accent:hover {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 13px;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   Form Controls & Modern Inputs
   ========================================================================== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
  letter-spacing: -0.01em;
}

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

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
  box-shadow: var(--shadow-xs);
}

.form-control:hover, .form-select:hover {
  border-color: #cbd5e1;
}

.form-control:focus, .form-select:focus {
  border-color: var(--peacock);
  box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.15);
  background-color: #ffffff;
}

.form-control[readonly], .form-control:disabled {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
  border-color: #e2e8f0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* ==========================================================================
   Enterprise Data Tables (Stripe & Linear Clean Standard with Smart Scrolling)
   ========================================================================== */
.table-responsive,
.smart-scroll-table {
  width: 100%;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  position: relative;
}

/* Custom Sleek Scrollbar */
.table-responsive::-webkit-scrollbar,
.smart-scroll-table::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track,
.smart-scroll-table::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.table-responsive::-webkit-scrollbar-thumb,
.smart-scroll-table::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.smart-scroll-table::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.skp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.86rem;
  margin: 0;
}

/* Sticky Headers Across All Tables */
.table-responsive thead th,
.table-responsive .skp-table thead th,
.table-responsive .table thead th,
.smart-scroll-table thead th {
  position: sticky !important;
  top: 0 !important;
  background: #f1f5f9 !important;
  z-index: 10 !important;
  box-shadow: 0 1.5px 2px rgba(0,0,0,0.06);
}

/* Sticky Footers for summary totals */
.table-responsive tfoot td,
.table-responsive .skp-table tfoot td,
.table-responsive .table tfoot td,
.smart-scroll-table tfoot td {
  position: sticky !important;
  bottom: 0 !important;
  background: #f8fafc !important;
  z-index: 9 !important;
  box-shadow: 0 -1.5px 2px rgba(0,0,0,0.06);
}

.skp-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 13px 18px;
  border-bottom: 1.5px solid var(--border);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.skp-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-body);
  vertical-align: middle;
  transition: background-color 0.15s ease;
}

.skp-table tbody tr:hover td {
  background-color: #f8fafc;
}

.skp-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status Badges - Modern Pill Style */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3.5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.badge-danger {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}
.badge-info {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
.badge-neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Flash Messages / Alerts */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-xs);
}

.alert-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.alert-error {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}
.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
.alert-info {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-subtle);
}

.modal-box.modal-lg {
  max-width: 900px;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.modal-body {
  padding: 26px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   Factory Enterprise UI Components (Command Center, Splits & Filter Grids)
   ========================================================================== */
.command-center-card {
  background: linear-gradient(135deg, #070d18 0%, #0d1a33 50%, #081122 100%);
  color: white;
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin-bottom: 24px;
}

.command-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.command-center-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.3), rgba(217, 119, 6, 0.08));
  border: 1px solid rgba(217, 119, 6, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.badge-erp-active {
  background: rgba(217, 119, 6, 0.15);
  color: #fde68a;
  border: 1px solid rgba(217, 119, 6, 0.35);
  padding: 6px 14px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.command-center-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 12px;
}

.command-center-grid .btn-cmd {
  justify-content: flex-start;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: var(--transition);
}

.dashboard-split-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-stock-box {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-bar-flex {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
}

.sticky-settlement-form {
  position: sticky;
  top: 20px;
}

.eod-volume-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  border: 1.5px solid #000;
  padding: 14px;
  margin-bottom: 20px;
  background: #f8fafc;
  font-size: 0.88rem;
  border-radius: 6px;
}

/* ==========================================================================
   Mobile Responsive Suite (World-Class Factory Smartphone & Tablet Optimization)
   ========================================================================== */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* --- Breakpoint: <= 1024px (Small Laptops & Tablets Landscape) --- */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
    z-index: 10000;
    width: 285px;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.45);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: inline-flex !important;
  }
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .sidebar-toggle-btn {
    display: inline-flex !important;
  }
  .page-container {
    padding: 20px 16px;
    width: 100%;
    max-width: 100%;
  }
  .app-header {
    padding: 0 16px;
  }
}

/* --- Breakpoint: <= 992px (Tablets Portrait) --- */
@media (max-width: 992px) {
  /* Hide desktop header quick-actions and live clock to prevent header jamming */
  .quick-actions-bar {
    display: none !important;
  }
  .header-live-time {
    display: none !important;
  }

  /* Two Column Layouts stack vertically on tablets & mobile */
  .dashboard-split-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .sticky-settlement-form {
    position: static !important;
  }

  .form-row, .form-row-2, .form-row-3, .form-row-4 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .invoice-type-grid {
    grid-template-columns: 1fr !important;
  }

  .filter-bar-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* --- Breakpoint: <= 768px (Smartphones Standard & Phablets) --- */
@media (max-width: 768px) {
  /* Header Compact Mode for Mobile Phones */
  .app-header {
    height: 58px;
    padding: 0 12px;
  }

  .header-left {
    gap: 10px;
    flex: 1;
    min-width: 0;
  }

  .page-title-badge h1 {
    font-size: 1.05rem;
    max-width: 165px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-title-badge span {
    display: none !important;
  }

  .header-right {
    gap: 8px;
  }

  .user-menu-wrap .btn-user-name {
    display: none !important;
  }

  .header-user-btn {
    padding: 7px 10px !important;
  }

  .header-logout-btn {
    padding: 7px 10px !important;
  }

  /* KPI Grid: 2 columns on mobile for compact factory dashboard */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .kpi-card {
    padding: 12px 12px !important;
    border-radius: 12px !important;
  }

  .kpi-data span {
    font-size: 0.68rem !important;
  }

  .kpi-data h2 {
    font-size: 1.25rem !important;
    margin: 4px 0 !important;
  }

  .kpi-data small {
    font-size: 0.65rem !important;
    line-height: 1.2;
  }

  .kpi-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 0.95rem !important;
  }

  /* Command Center Mobile Grid */
  .command-center-card {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  .command-center-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .command-center-grid .btn-cmd {
    padding: 10px 8px !important;
    font-size: 0.76rem !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    border-radius: 8px !important;
  }

  .command-center-grid .btn-cmd i {
    font-size: 0.95rem !important;
  }

  /* Cards & Action Headers */
  .skp-card {
    padding: 16px 14px !important;
    border-radius: 14px !important;
    margin-bottom: 16px !important;
  }

  .card-header-flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .card-header-flex > div:last-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .card-header-flex .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Filter Bars on Mobile */
  .filter-bar-flex {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .filter-bar-flex > div,
  .filter-bar-flex > .form-group {
    width: 100% !important;
    min-width: 100% !important;
  }

  .filter-bar-flex .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .filter-bar-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .filter-bar-grid .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Dashboard Stock Box */
  .dashboard-stock-box {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .dashboard-stock-box .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Responsive Tables with smooth horizontal touch swipe & smart vertical scroll */
  .table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 460px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    margin-bottom: 12px;
  }

  .table-responsive .skp-table {
    min-width: 540px;
  }

  .skp-table th, .skp-table td {
    padding: 10px 10px !important;
    font-size: 0.8rem !important;
    white-space: nowrap;
  }

  /* EOD Operational Volume Grid on Mobile */
  .eod-volume-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 10px !important;
  }

  .eod-report-wrap {
    padding: 14px 10px !important;
    margin-bottom: 20px !important;
  }

  /* Modals full width on mobile */
  .modal-box {
    max-width: 95vw !important;
    width: 95vw !important;
    margin: 10px auto;
  }

  .modal-body {
    padding: 16px !important;
  }
}

/* --- Breakpoint: <= 480px (Compact Mobile Phones) --- */
@media (max-width: 480px) {
  .page-container {
    padding: 12px 8px !important;
  }

  .page-title-badge h1 {
    font-size: 0.95rem;
    max-width: 130px;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .command-center-grid {
    grid-template-columns: 1fr !important;
  }

  .command-center-grid .btn-cmd {
    padding: 12px 14px !important;
    font-size: 0.84rem !important;
    min-height: 44px !important;
  }

  .eod-volume-grid {
    grid-template-columns: 1fr !important;
  }

  /* Form touch target accessibility */
  .form-control, .form-select, .btn {
    min-height: 42px;
    font-size: 0.92rem;
  }
}
