/* ==========================================================================
   META ERP - Professional Jewellery Manufacturing & Gold Management ERP
   Client: HR GOLD WORKS, Hyderabad, Telangana
   Design System & Enterprise Stylesheet
   ========================================================================== */

:root {
  /* Core Color Palette - Enterprise SaaS with Subtle Gold Accents */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #1e293b;
  
  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;
  --text-sidebar: #cbd5e1;
  --text-sidebar-muted: #64748b;
  
  /* Gold Accents (Curated & Used Sparingly) */
  --gold-primary: #b45309;      /* Deep Gold/Amber for text & buttons */
  --gold-accent: #d97706;       /* Warm Gold */
  --gold-bright: #f59e0b;       /* Bright Highlight */
  --gold-light: #fef3c7;        /* Soft Gold Pill/Background */
  --gold-border: #fde68a;       /* Subtle Border */
  --gold-gradient: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  
  /* Status Colors */
  --emerald-600: #059669;
  --emerald-100: #d1fae5;
  --emerald-800: #065f46;
  
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --amber-800: #92400e;
  
  --rose-600: #e11d48;
  --rose-100: #ffe4e6;
  --rose-800: #9f1239;
  
  --sky-600: #0284c7;
  --sky-100: #e0f2fe;
  --sky-800: #075985;
  
  --indigo-600: #4f46e5;
  --indigo-100: #e0e7ff;
  --indigo-800: #3730a3;
  
  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #d97706;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-gold: 0 4px 14px 0 rgba(217, 119, 6, 0.2);
  
  /* Geometry */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, Menlo, Monaco, monospace;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* --------------------------------------------------------------------------
   App Layout
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--gold-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-gold);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title span.gold-tag {
  font-size: 0.65rem;
  background: rgba(217, 119, 6, 0.25);
  color: #fcd34d;
  border: 1px solid rgba(217, 119, 6, 0.4);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-badge-bar {
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}

.client-name {
  color: #fcd34d;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.client-loc {
  color: var(--text-light);
  font-size: 0.68rem;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem 2rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-sidebar-muted);
  padding: 1rem 0.6rem 0.4rem 0.6rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-link:hover {
  background-color: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-link.active {
  background-color: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background-color: var(--gold-accent);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-link.active svg {
  opacity: 1;
  color: var(--gold-bright);
}

.nav-pill {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.nav-pill.gold {
  background: rgba(217, 119, 6, 0.25);
  color: #fcd34d;
}

/* Collapsible Sub-menu Navigation */
.nav-item-dropdown {
  display: flex;
  flex-direction: column;
  position: relative;
}

.nav-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-dropdown-header:hover {
  background-color: var(--bg-sidebar-hover);
}

.nav-dropdown-header .nav-link-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  color: var(--text-sidebar);
  font-weight: 500;
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

/* Strict SVG sizing for Department Flow icon */
.nav-dropdown-header svg:not(.nav-dropdown-chevron),
.nav-dropdown-header .nav-link-main svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-dropdown-header:hover .nav-link-main {
  color: #ffffff;
}

.nav-dropdown-header.active {
  background-color: rgba(217, 119, 6, 0.15);
}

.nav-dropdown-header.active .nav-link-main {
  color: #fbbf24;
  font-weight: 600;
}

.nav-dropdown-header.active .nav-link-main svg {
  color: var(--gold-bright);
  opacity: 1;
}

.nav-dropdown-header.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background-color: var(--gold-accent);
}

.nav-dropdown-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-sidebar-muted);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  margin-right: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  outline: none;
  flex-shrink: 0;
}

.nav-dropdown-toggle-btn:hover {
  color: #ffffff;
}

.nav-dropdown-chevron {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  max-width: 12px !important;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(0deg); /* Points down when open */
}

.nav-item-dropdown.collapsed .nav-dropdown-chevron {
  transform: rotate(-90deg); /* Points right when collapsed */
}

/* Submenu container using CSS grid transition */
.nav-submenu-wrapper {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item-dropdown.collapsed .nav-submenu-wrapper {
  grid-template-rows: 0fr;
}

.nav-submenu-content {
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.2rem 0;
  gap: 1px;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.75rem 0.42rem 2.5rem;
  color: var(--text-sidebar-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.nav-sub-link:hover {
  color: #ffffff;
  background-color: var(--bg-sidebar-hover);
}

.nav-sub-link.active {
  color: #fbbf24;
  font-weight: 600;
  background-color: rgba(217, 119, 6, 0.12);
}

.nav-sub-link .sub-dot {
  font-size: 0.85rem;
  color: var(--gold-accent);
  opacity: 0.6;
  line-height: 1;
}

.nav-sub-link:hover .sub-dot,
.nav-sub-link.active .sub-dot {
  opacity: 1;
  color: var(--gold-bright);
}

.sidebar-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.version-tag {
  color: var(--text-muted);
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  transition: margin-left var(--transition-normal);
}

/* Top Header */
.topbar {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.menu-toggle-btn:hover {
  background: var(--bg-surface-alt);
}

.header-search {
  position: relative;
  width: 400px;
  max-width: 100%;
}

.header-search input {
  width: 100%;
  height: 38px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 4.25rem 0 2.4rem;
  font-size: 0.85rem;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--gold-accent);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-kbd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  pointer-events: none;
  box-shadow: var(--shadow-xs);
  line-height: 1.2;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.quick-action-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  height: 38px;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-action-btn:hover {
  border-color: var(--gold-accent);
  color: var(--gold-primary);
  background: var(--gold-light);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: #cbd5e1;
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: var(--rose-600);
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.user-profile-menu:hover {
  background: var(--bg-surface-alt);
  border-color: var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-sidebar);
  color: #fcd34d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  border: 2px solid #fde68a;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Breadcrumb & Blueprint Bar */
.page-top-strip {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  list-style: none;
}

.breadcrumb-list a:hover {
  color: var(--gold-primary);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-light);
}

.breadcrumb-current {
  color: var(--text-main);
  font-weight: 600;
}

.blueprint-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.blueprint-badge svg {
  color: #d97706;
}

/* Main Page Container */
.page-container {
  padding: 1.5rem 1.75rem 3rem 1.75rem;
  max-width: 1600px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Page Header Block */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title-group h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.page-actions-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Buttons & UI Elements
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--gold-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--gold-accent);
  box-shadow: var(--shadow-gold);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-alt);
  border-color: #cbd5e1;
}

.btn-navy {
  background-color: var(--bg-sidebar);
  color: #ffffff;
}

.btn-navy:hover {
  background-color: var(--bg-sidebar-hover);
}

.btn-outline-gold {
  background-color: #ffffff;
  color: var(--gold-primary);
  border-color: var(--gold-accent);
}

.btn-outline-gold:hover {
  background-color: var(--gold-light);
}

.btn-danger {
  background-color: #ffffff;
  color: var(--rose-600);
  border-color: var(--rose-100);
}

.btn-danger:hover {
  background-color: var(--rose-100);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-icon-only {
  padding: 0.45rem;
  border-radius: var(--radius-sm);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-success { background: var(--emerald-100); color: var(--emerald-800); }
.badge-warning { background: var(--amber-100); color: var(--amber-800); }
.badge-danger  { background: var(--rose-100); color: var(--rose-800); }
.badge-info    { background: var(--sky-100); color: var(--sky-800); }
.badge-indigo  { background: var(--indigo-100); color: var(--indigo-800); }
.badge-gold    { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-neutral { background: var(--bg-surface-alt); color: var(--text-muted); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* --------------------------------------------------------------------------
   Cards & Content Containers
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-fast);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 100%;
  box-sizing: border-box;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-body {
  padding: 1.25rem;
  max-width: 100%;
  box-sizing: border-box;
}

.card-footer {
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-surface-alt);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* --------------------------------------------------------------------------
   KPI Grid
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kpi-card.gold-card {
  border-top: 3px solid var(--gold-accent);
}

.kpi-top,
.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 0.45rem;
}

.kpi-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.kpi-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.kpi-meta {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-meta.trend-up {
  color: var(--emerald-600);
}
.kpi-meta.trend-neutral {
  color: var(--text-muted);
}
.kpi-meta.trend-down {
  color: var(--rose-600);
}

/* --------------------------------------------------------------------------
   Dashboard Sections Grid
   -------------------------------------------------------------------------- */
.dashboard-grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dashboard-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Gold Movement Flow Matrix */
.movement-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.movement-node {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
}

.movement-node-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.movement-node-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.25rem;
  white-space: nowrap;
}

/* Movement Node Semantic Variants */
.movement-node.node-opening {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.movement-node.node-issued {
  background: #fff5f5;
  border: 1px solid #fecdd3;
  border-left: 3px solid var(--rose-600);
}

.movement-node.node-received {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 3px solid var(--emerald-600);
}

.movement-node.node-melting {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 3px solid var(--emerald-600);
}

.movement-node.node-wastage {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid var(--amber-600);
}

.movement-node.node-closing,
.movement-node.highlight {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #f59e0b;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.12);
}

.movement-node-val.add { color: var(--emerald-600); }
.movement-node-val.minus { color: var(--rose-600); }

/* 4-column KPI Grid variant */
.kpi-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* Audit Metrics Grid (Gold Receipt) */
.audit-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

/* Drawer Stat Grids */
.drawer-stats-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.drawer-stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* SVG / CSS Bar Chart */
.chart-container {
  width: 100%;
  height: 220px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: 1rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 180px;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  flex: 1;
}

.bar-pill {
  width: 28px;
  background: #e2e8f0;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.bar-pill.primary {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
}

.bar-pill:hover {
  filter: brightness(1.1);
}

.bar-tooltip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-sidebar);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  display: none;
}

.bar-pill:hover .bar-tooltip {
  display: block;
}

.bar-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Data Tables
   -------------------------------------------------------------------------- */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.table-toolbar {
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #ffffff;
}

.table-search-box {
  position: relative;
  width: 260px;
}

.table-search-box input {
  width: 100%;
  height: 34px;
  padding: 0 0.75rem 0 2.2rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
}

.table-search-box input:focus {
  outline: none;
  background: #fff;
  border-color: var(--gold-accent);
}

.table-search-box svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px;
  height: 14px;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  height: 34px;
  padding: 0 2rem 0 0.75rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-alt);
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 14px;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold-accent);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.erp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.825rem;
}

.erp-table th {
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.6px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.erp-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.erp-table tbody tr {
  transition: background-color var(--transition-fast);
}

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

.erp-table td.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.erp-table td.weight-cell {
  font-weight: 600;
  color: #1e293b;
}

.erp-table td.fine-cell {
  color: var(--gold-primary);
  font-weight: 600;
}

.erp-table th.text-right,
.erp-table td.text-right,
.text-right {
  text-align: right !important;
}

.erp-table th.text-center,
.erp-table td.text-center,
.text-center {
  text-align: center !important;
}

/* Table Empty State */
.empty-state-row td,
.empty-state-cell {
  text-align: center !important;
  padding: 3rem 1.5rem !important;
  color: var(--text-muted);
  background-color: #ffffff;
}

.empty-state-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
  margin: 0 auto 0.75rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.empty-state-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.empty-state-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Mobile Data Cards (Responsive Table-to-Card System)
   -------------------------------------------------------------------------- */
.data-card-list {
  display: none;
}

.mobile-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: all var(--transition-fast);
  position: relative;
}

.mobile-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.mobile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.mobile-card-title {
  font-size: 1rem; /* 16px prominent mobile typography */
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.mobile-card-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-primary);
}

.mobile-card-sub {
  font-size: 0.85rem; /* 13-14px secondary */
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mobile-card-grid,
.material-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  background: var(--bg-surface-alt);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.mobile-card-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mobile-grid-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mobile-grid-item.full-width,
.material-meta .meta-full {
  grid-column: 1 / -1;
}

.mobile-grid-label {
  font-size: 0.72rem; /* 11-12px accessible labels */
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.mobile-grid-val {
  font-size: 0.95rem; /* 15-18px numeric values */
  font-weight: 700;
  color: var(--text-main);
}

.mobile-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mobile-card-footer .btn {
  min-height: 38px;
  padding: 0.4rem 0.85rem;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 0.25rem;
}

.page-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
}

.page-btn.active {
  background: var(--gold-primary);
  color: #fff;
  border-color: var(--gold-primary);
}

.page-btn:hover:not(.active) {
  background: var(--bg-surface-alt);
}

/* --------------------------------------------------------------------------
   Forms & Calculator Panels
   -------------------------------------------------------------------------- */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.form-label span.req {
  color: var(--rose-600);
}

.form-label span.help-tip {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 38px;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

select.form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px 14px;
  padding-right: 2.25rem;
  cursor: pointer;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.form-control[readonly], .form-control:disabled {
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: 0.6rem 0.75rem;
}

/* Live Calculator Display Cards */
.calc-display-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  color: #ffffff;
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.calc-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fcd34d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.calc-formula-badge {
  background: rgba(217, 119, 6, 0.25);
  border: 1px solid rgba(217, 119, 6, 0.4);
  color: #fde68a;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

.calc-metrics-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.calc-metric-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.calc-metric-box.highlight {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(217, 119, 6, 0.5);
}

.calc-metric-label {
  font-size: 0.68rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calc-metric-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

.calc-metric-val.gold {
  color: #fbbf24;
}
.calc-metric-val.green {
  color: #34d399;
}
.calc-metric-val.red {
  color: #f87171;
}

/* --------------------------------------------------------------------------
   Kanban WIP Tracking Board
   -------------------------------------------------------------------------- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  align-items: start;
  min-height: 520px;
}

.kanban-column {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 480px;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.kanban-col-title {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-count {
  font-size: 0.72rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.kanban-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 200px;
}

.kanban-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: all var(--transition-fast);
  position: relative;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.kanban-job-no {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--gold-primary);
}

.kanban-card-title {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.kanban-card-karigar {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 0.6rem;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.75rem;
}

.kanban-weight {
  font-weight: 700;
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   Reconciliation Interface
   -------------------------------------------------------------------------- */
.recon-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1rem;
  transition: all var(--transition-fast);
}

.recon-card.flagged {
  border-left: 4px solid var(--rose-600);
}

.recon-card.accepted {
  border-left: 4px solid var(--emerald-600);
}

.recon-card.pending {
  border-left: 4px solid var(--amber-600);
}

.recon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.recon-meta-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.recon-karigar {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.recon-job {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recon-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.recon-stat-box {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  text-align: center;
}

.recon-stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.recon-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.2rem;
}

.recon-stat-val.variance-plus {
  color: var(--rose-600);
}
.recon-stat-val.variance-zero {
  color: var(--emerald-600);
}

.recon-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.recon-flag-text {
  font-size: 0.75rem;
  color: var(--rose-600);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --------------------------------------------------------------------------
   Department Flow Cards
   -------------------------------------------------------------------------- */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dept-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.dept-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-color);
  transition: background var(--transition-fast);
}

.dept-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.dept-card:hover::before {
  background: var(--gold-accent);
}

.dept-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.dept-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 0.5px;
}

.dept-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.15rem;
}

.dept-demo-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.2rem;
}

.dept-stats-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin: 1rem 0;
  background: var(--bg-surface-alt);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.dept-stat-item {
  display: flex;
  flex-direction: column;
}

.dept-stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.dept-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.dept-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--gold-primary);
  font-weight: 600;
}

/* Department Stage Pipeline */
.workflow-pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.25rem 0;
  position: relative;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem;
  scrollbar-width: thin;
}

.workflow-pipeline::-webkit-scrollbar {
  height: 4px;
}
.workflow-pipeline::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.workflow-pipeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-accent), var(--border-color));
  z-index: 1;
}

.stage-step {
  position: relative;
  z-index: 2;
  background: #ffffff;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--gold-accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.stage-step:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--gold-primary);
}

.stage-number {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  border-radius: 50% !important;
  background: var(--gold-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Modals & Drawers
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  transition: all var(--transition-fast);
}

.modal-backdrop.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: var(--bg-surface-alt);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-alt);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Detail Drawer */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.drawer-backdrop.open .drawer-panel {
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 150;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid var(--border-color);
  animation: slideInUp 0.25s ease-out;
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast-success { border-left: 4px solid var(--emerald-600); }
.toast-warning { border-left: 4px solid var(--amber-600); }
.toast-error   { border-left: 4px solid var(--rose-600); }
.toast-info    { border-left: 4px solid var(--sky-600); }

.toast-icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.toast-success .toast-icon { color: var(--emerald-600); }
.toast-warning .toast-icon { color: var(--amber-600); }
.toast-error   .toast-icon { color: var(--rose-600); }
.toast-info    .toast-icon { color: var(--sky-600); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.toast-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 2px;
}

/* --------------------------------------------------------------------------
   Blueprint Notice Banner
   -------------------------------------------------------------------------- */
.blueprint-alert-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: #92400e;
}

.blueprint-alert-banner svg {
  flex-shrink: 0;
  color: #b45309;
}

/* --------------------------------------------------------------------------
   Tabbed Navigation (Segmented Pill Style)
   -------------------------------------------------------------------------- */
.nav-tabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 1 auto;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.6);
}

.tab-btn.active {
  color: var(--gold-primary);
  background: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tab-txt-short {
  display: none;
}

.tab-txt-full {
  display: inline;
}

/* --------------------------------------------------------------------------
   Permission Matrix Grid
   -------------------------------------------------------------------------- */
.matrix-table th, .matrix-table td {
  text-align: center;
}
.matrix-table th:first-child, .matrix-table td:first-child {
  text-align: left;
}

.checkbox-toggle {
  width: 18px;
  height: 18px;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

/* Mobile Permission Matrix Components */
.matrix-mobile-toolbar {
  display: none;
  padding: 0.75rem 1rem 0.25rem 1rem;
}

.matrix-filter-pills {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-surface-alt);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: 100%;
}

.matrix-filter-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.matrix-filter-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.matrix-mobile-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--shadow-xs);
}

.matrix-module-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.matrix-role-block {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.matrix-role-block.admin-block {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.22);
}

.matrix-role-block.dept-block {
  background: rgba(14, 165, 233, 0.06);
  border: 1px solid rgba(14, 165, 233, 0.22);
}

.matrix-role-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: #fef3c7;
  color: #92400e;
}

.role-badge.dept {
  background: #e0f2fe;
  color: #075985;
}

.matrix-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem;
}

.matrix-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  padding: 0.3rem 0.15rem;
  min-height: 34px;
  user-select: none;
}

.matrix-checkbox-label input[type="checkbox"] {
  accent-color: var(--gold-primary);
  width: 16px;
  height: 16px;
  min-width: 16px;
  cursor: pointer;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff;
    color: #000000;
  }
  .sidebar, .topbar, .page-actions-group, .table-toolbar, .table-pagination, .btn, .toast-container {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .page-container {
    padding: 0 !important;
  }
  .card, .table-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  .print-only-header {
    display: block !important;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5rem;
  }
}

.print-only-header {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
  .dashboard-grid-2col {
    grid-template-columns: 1fr;
  }
  .movement-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .calc-metrics-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .audit-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dept-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }
  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .form-grid-3, .form-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .recon-stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .audit-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .menu-toggle-btn {
    display: flex;
  }
  .header-search {
    display: none;
  }
  .topbar {
    padding: 0 1rem;
  }
  .page-container {
    padding: 1rem 1rem 3rem 1rem;
  }

  /* Intelligent 2x3 KPI Grid on Mobile (Never 1-column stack) */
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi-card {
    padding: 0.85rem;
  }
  .kpi-value {
    font-size: 1.25rem;
  }

  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  /* Gold Movement: Required 2-column with full-width Opening & Closing */
  .movement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .movement-grid .node-opening,
  .movement-grid .node-closing {
    grid-column: 1 / -1;
    padding: 0.95rem 1rem;
  }
  .movement-grid .node-closing {
    border-width: 2px;
  }
  .movement-node {
    padding: 0.75rem 0.6rem;
  }
  .movement-node-val {
    font-size: 1.05rem;
  }

  /* Live Calculator 5-metric row: 2 + 2 + 1 (5th metric spans 1 / -1) */
  .calc-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .calc-metrics-row > :nth-child(5):last-child {
    grid-column: 1 / -1;
  }

  /* Receipt Audit 5-metric grid: 2 + 2 + 1 (Variance spans 1 / -1) */
  .audit-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .audit-metrics-grid > :nth-child(5):last-child,
  .audit-metrics-grid .audit-variance-node {
    grid-column: 1 / -1;
  }

  /* Reconciliation 5-metric row: 2 + 2 + 1 (Variance spans 1 / -1) */
  .recon-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .recon-stats-row > :last-child {
    grid-column: 1 / -1;
  }

  .dept-grid {
    grid-template-columns: 1fr;
  }
  .kanban-board {
    grid-template-columns: 1fr;
  }

  /* Department Workflow Pipeline: Responsive Vertical Stepper */
  .workflow-pipeline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin: 0.75rem 0;
    padding-left: 44px;
    position: relative;
    overflow-x: visible;
  }

  /* Connecting vertical gold progress line - centered exactly at 16px */
  .workflow-pipeline::before {
    top: 24px;
    bottom: 24px;
    left: 16px;
    right: auto;
    width: 2px;
    transform: translateX(-50%);
    height: auto;
    background: linear-gradient(180deg, var(--gold-accent) 0%, rgba(217, 119, 6, 0.25) 100%);
    z-index: 1;
  }

  .stage-step {
    position: relative;
    z-index: 2;
    background: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: normal;
    transition: all var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
  }

  .stage-step:hover {
    border-color: var(--gold-accent);
    box-shadow: var(--shadow-sm);
  }

  /* Numbered node circle - centered exactly at 16px horizontally, 50% vertically */
  .stage-number {
    position: absolute;
    top: 50%;
    left: -28px;
    transform: translate(-50%, -50%) !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 2px solid var(--gold-accent) !important;
    color: var(--gold-primary) !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 3;
    flex-shrink: 0;
  }

  .stage-step span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
    flex: 1;
  }

  .stage-step::after {
    content: '→';
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold-accent);
    opacity: 0.6;
    margin-left: 0.5rem;
  }

  .stage-step:last-child::after {
    content: '✓';
    color: var(--emerald-600);
    opacity: 0.9;
  }
  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.75rem;
    width: 100%;
  }

  .form-group {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .form-control,
  select.form-control,
  input.form-control {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  select.form-control {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  /* Card and Card Header mobile polish */
  .card {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
  }

  .card-header .card-title {
    font-size: 0.95rem;
    white-space: normal;
    word-break: break-word;
  }

  .card-header .badge {
    align-self: flex-start;
    white-space: normal;
    word-break: break-word;
  }

  .card-body {
    padding: 1rem 0.85rem;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Live Calculator Card */
  .calc-display-card {
    padding: 1rem 0.85rem;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .calc-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .calc-formula-badge {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
  }

  /* Form action buttons on mobile */
  form div[style*="justify-content: flex-end"] {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }
  form div[style*="justify-content: flex-end"] .btn {
    width: 100% !important;
    justify-content: center;
  }

  /* Table-to-Card Responsive Transformation - Resilient for all mobile viewports */
  .table-responsive.mobile-table-hide,
  .has-mobile-cards .table-responsive,
  .card.has-mobile-cards .table-responsive,
  .table-card:not(.keep-table-scroll) .table-responsive,
  .has-mobile-cards > .table-responsive,
  .matrix-table-container {
    display: none !important;
  }
  .table-card .data-card-list,
  .has-mobile-cards .data-card-list,
  .card.has-mobile-cards .data-card-list,
  .card .data-card-list,
  .data-card-list {
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem;
  }
  .keep-table-scroll .table-responsive,
  .table-scroll-mobile {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .matrix-mobile-toolbar {
    display: flex !important;
  }

  /* Table Toolbar & Filters on Mobile */
  .table-toolbar {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .table-search-box {
    width: 100%;
  }
  .table-filters {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .table-filters .filter-select {
    flex: 1;
    min-width: 130px;
  }

  /* Mobile Segmented Nav Tabs */
  .nav-tabs {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
    margin-bottom: 1rem;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .tab-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.55rem 0.35rem;
    font-size: 0.78rem;
    border-radius: 7px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .tab-txt-short {
    display: inline !important;
  }
  .tab-txt-full {
    display: none !important;
  }

  /* Page Header & Action Buttons on Mobile */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .page-actions-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }
  .page-actions-group .btn {
    flex: 1 1 auto;
    justify-content: center;
    white-space: nowrap;
  }

  /* Mobile Topbar Polish */
  .topbar {
    padding: 0 0.85rem;
  }
  .topbar-right {
    gap: 0.5rem;
  }
  .user-profile-menu .user-meta {
    display: none;
  }
  .user-profile-menu svg {
    display: none;
  }
  .user-profile-menu {
    padding: 2px;
  }

  /* Page container prevent horizontal blowout */
  body, html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .app-container,
  .app-layout,
  .main-wrapper,
  .page-container {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
}

/* Small Screens (<= 480px): Maintain Intelligent Grids, DO NOT collapse to 1fr */
@media (max-width: 480px) {
  .quick-action-btn span {
    display: none;
  }
  .quick-action-btn {
    padding: 0 0.65rem;
  }
  .page-container {
    padding: 0.75rem 0.75rem 2.5rem 0.75rem;
  }

  /* KPI Grid remains 2-column */
  .kpi-grid,
  .kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }
  .kpi-card {
    padding: 0.75rem 0.65rem;
  }
  .kpi-title {
    font-size: 0.7rem;
  }
  .kpi-icon {
    width: 26px;
    height: 26px;
  }
  .kpi-icon svg {
    width: 14px;
    height: 14px;
  }
  .kpi-value {
    font-size: 1.12rem;
  }
  .kpi-unit {
    font-size: 0.75rem;
  }
  .kpi-meta {
    font-size: 0.68rem;
  }

  /* Drawer 3-metric grid: 2 + 1 */
  .drawer-stats-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .drawer-stats-grid-3 > :last-child {
    grid-column: 1 / -1;
  }
}

/* Very Small Mobile Screens (<= 380px) */
@media (max-width: 380px) {
  .page-container {
    padding: 0.65rem 0.5rem 2.5rem 0.5rem;
  }

  .kpi-grid,
  .kpi-grid-4 {
    gap: 6px;
  }
  .kpi-card {
    padding: 0.65rem 0.5rem;
  }
  .kpi-title {
    font-size: 0.66rem;
    letter-spacing: 0;
  }
  .kpi-value {
    font-size: 1.02rem;
  }
  .kpi-unit {
    font-size: 0.7rem;
  }

  /* Gold Movement: keep 2-column, tight padding, clean typography */
  .movement-grid {
    gap: 8px;
  }
  .movement-node {
    padding: 0.65rem 0.45rem;
  }
  .movement-node-label {
    font-size: 0.66rem;
    letter-spacing: 0.2px;
  }
  .movement-node-val {
    font-size: 0.95rem;
  }
  .movement-grid .node-opening,
  .movement-grid .node-closing {
    padding: 0.75rem 0.6rem;
  }

  .calc-metrics-row,
  .audit-metrics-grid,
  .recon-stats-row {
    gap: 6px;
  }
  .calc-metric-box {
    padding: 0.6rem 0.4rem;
  }
  .calc-metric-val {
    font-size: 1rem;
  }
  .recon-stat-box {
    padding: 0.55rem 0.35rem;
  }
  .recon-stat-val {
    font-size: 0.95rem;
  }
}
