/* ============================================
   Hottex Engineers Pvt Ltd - Inventory System
   Professional Red & Black Theme
   ============================================ */

:root {
  --primary-red: #c41e3a;
  --primary-red-dark: #8b0000;
  --primary-red-light: #e63946;
  --black-dark: #0a0a0a;
  --black-medium: #1a1a1a;
  --black-soft: #2d2d2d;
  --gray-dark: #3d3d3d;
  --gray-medium: #5c5c5c;
  --gray-light: #8a8a8a;
  --white: #ffffff;
  --off-white: #f5f5f5;
  --success: #2e7d32;
  --warning: #ed6c02;
  --shadow: 0 4px 20px rgba(0,0,0,0.25);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.35);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 65px;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--off-white);
  color: var(--black-medium);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Master product photo (Product Material page) */
.mp-photo-row {
  display: flex;
  justify-content: center;
  padding: 10px 12px 0 12px;
}

.mp-photo-thumb {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 6px 18px rgba(0,0,0,0.10);
  background: #fff;
}

.mp-photo-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 14px 0;
}

.mp-photo-preview {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 10px 26px rgba(0,0,0,0.14);
  background: #fff;
}

/* ========== Layout ========== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  max-height: 100vh;
  background: linear-gradient(180deg, var(--black-dark) 0%, var(--black-medium) 100%);
  box-shadow: 4px 0 25px rgba(0,0,0,0.3);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-link span:not(.nav-icon),
.sidebar.collapsed .user-label { display: none; }
.sidebar.collapsed .logged-user { justify-content: center; }
.sidebar.collapsed .sidebar-footer .nav-link span:not(.nav-icon) { display: none; }
.sidebar.collapsed .sidebar-footer .nav-link { justify-content: center; padding: 10px; }

.sidebar.collapsed .sidebar-logo img {
  max-width: 36px;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

.sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 40px;
  border: none;
  border-radius: 0 6px 6px 0;
  background: var(--primary-red);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
  z-index: 10;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: var(--primary-red-dark);
  width: 32px;
}

.toggle-icon {
  transition: transform 0.3s ease;
  font-weight: bold;
  line-height: 1;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  background: rgba(0,0,0,0.2);
  position: relative;
  flex-shrink: 0;
}

.sidebar-logo img {
  max-width: 160px;
  height: auto;
  max-height: 45px;
  object-fit: contain;
}

.sidebar-logo-text {
  color: var(--white);
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 20px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  color: var(--gray-light);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 12px;
  margin-bottom: 10px;
}

.nav-menu {
  list-style: none;
}

.nav-item {
  margin-bottom: 4px;
}

.nav-main > .nav-item {
  margin-bottom: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-size: 14px;
  gap: 12px;
}

.nav-group-btn {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  justify-content: space-between;
}

.nav-chevron {
  font-size: 12px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.has-sub.open .nav-chevron {
  transform: rotate(180deg);
}

.sub-menu {
  list-style: none;
  margin: 4px 0 0 32px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.has-sub.open > .sub-menu {
  max-height: 500px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.nav-link.active {
  background: linear-gradient(90deg, var(--primary-red) 0%, var(--primary-red-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97373, #dc2626);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  transition: var(--transition);
}

.logout-btn:hover {
  filter: brightness(1.05);
}

.sidebar-footer .nav-link {
  padding: 10px 16px;
  font-size: 13px;
}

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: margin-left 0.3s ease, max-width 0.3s ease;
}

body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width) !important;
  max-width: calc(100vw - var(--sidebar-collapsed-width)) !important;
}

/* ========== Header ========== */
.header {
  height: var(--header-height);
  background: var(--white);
  box-shadow: 0 2px 15px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--black-dark);
}

.header-left p {
  font-size: 12px;
  color: var(--gray-medium);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--off-white);
  border-radius: 25px;
  padding: 8px 18px;
  width: 280px;
  transition: var(--transition);
}

.header-search:focus-within {
  box-shadow: 0 0 0 2px var(--primary-red);
}

.header-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  width: 100%;
  margin-left: 8px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.header-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--off-white);
  color: var(--gray-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
}

.header-btn:hover {
  background: var(--primary-red);
  color: var(--white);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-red), var(--primary-red-dark));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

/* ========== Dashboard Content ========== */
.dashboard-content {
  flex: 1;
  padding: 30px;
  min-width: 0;
  overflow-x: hidden;
}
.scrollable-main.dashboard-content {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.welcome-banner {
  background: linear-gradient(135deg, var(--black-dark) 0%, var(--black-medium) 50%, var(--primary-red-dark) 100%);
  border-radius: var(--border-radius-lg);
  padding: 28px 35px;
  margin-bottom: 30px;
  color: var(--white);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(196,30,58,0.3) 0%, transparent 70%);
  border-radius: 50%;
}

.welcome-banner h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  position: relative;
}

.welcome-banner p {
  font-size: 14px;
  opacity: 0.9;
  position: relative;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-left: 4px solid var(--primary-red);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.stat-card:nth-child(1) { border-left-color: var(--primary-red); }
.stat-card:nth-child(2) { border-left-color: var(--black-medium); }
.stat-card:nth-child(3) { border-left-color: var(--primary-red-dark); }
.stat-card:nth-child(4) { border-left-color: var(--gray-dark); }

.stat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.stat-card-title {
  font-size: 13px;
  color: var(--gray-medium);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(196, 30, 58, 0.1);
  color: var(--primary-red);
}

.stat-card:nth-child(2) .stat-card-icon { background: rgba(0,0,0,0.08); color: var(--black-medium); }
.stat-card:nth-child(3) .stat-card-icon { background: rgba(139,0,0,0.15); color: var(--primary-red-dark); }
.stat-card:nth-child(4) .stat-card-icon { background: rgba(61,61,61,0.1); color: var(--gray-dark); }

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--black-dark);
}

.stat-card-trend {
  font-size: 12px;
  margin-top: 6px;
  color: var(--success);
}

.stat-card-trend.down {
  color: var(--warning);
}

/* Dashboard Sections */
.dashboard-section {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  min-width: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--black-dark);
}

.section-link {
  font-size: 14px;
  color: var(--primary-red);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.section-link:hover {
  color: var(--primary-red-dark);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--off-white);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--black-medium);
}

.quick-action-btn:hover {
  border-color: var(--primary-red);
  background: rgba(196, 30, 58, 0.05);
  color: var(--primary-red);
}

.quick-action-btn span:first-child {
  font-size: 28px;
  margin-bottom: 8px;
}

.quick-action-btn span:last-child {
  font-size: 13px;
  font-weight: 600;
}

/* Recent Activity Table - Horizontal Scroll */
.table-scroll-wrapper {
  width: 100%;
  overflow-x: scroll;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-red) #e0e0e0;
}

.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
  padding-right: 20px;
}

.table-responsive::-webkit-scrollbar,
.table-scroll-wrapper::-webkit-scrollbar {
  height: 14px;
}

.table-responsive::-webkit-scrollbar-track,
.table-scroll-wrapper::-webkit-scrollbar-track {
  background: #e0e0e0;
  border-radius: 0 0 4px 4px;
}

.table-responsive::-webkit-scrollbar-thumb,
.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary-red);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--primary-red-dark);
}

.data-table {
  width: max-content;
  min-width: 1300px;
  border-collapse: collapse;
  table-layout: auto;
}


.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--off-white);
  border-bottom: 2px solid rgba(0,0,0,0.06);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.data-table tr:hover td {
  background: rgba(196, 30, 58, 0.03);
}

.data-table .text-center { text-align: center; }
.data-table .nowrap {
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table td.actions-col.nowrap {
  max-width: none;
  overflow: visible;
}

.data-table .inward-cell {
  max-width: 80px;
}

/* List Actions & Inward */
.actions-col {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 280px;
  min-width: 320px;
  padding: 12px 20px 12px 16px !important;
}

.btn-action {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: var(--off-white);
  color: var(--black-medium);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-action:hover {
  background: var(--primary-red);
  color: var(--white);
  border-color: var(--primary-red);
}

.btn-edit { }
.btn-add-stock { }
.btn-delete-form { margin: 0; display: inline-flex; flex-shrink: 0; }
.btn-delete { color: #b33; }
.btn-delete:hover { background: #c41e3a; color: #fff; border-color: #c41e3a; }
.total-stock-cell { font-size: 15px; color: var(--primary-red); margin-right: 10px; }


.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.in-stock { background: rgba(46, 125, 50, 0.15); color: var(--success); }
.status-badge.low-stock { background: rgba(237, 108, 2, 0.15); color: var(--warning); }
.status-badge.out-of-stock { background: rgba(196, 30, 58, 0.15); color: var(--primary-red); }

/* ========== Forms ========== */
.page-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
}

@media (max-width: 1200px) {
  .page-grid { grid-template-columns: 1fr; }
}

.form-card { flex-shrink: 0; }
.list-card { min-width: 0; }
.list-card-full { min-width: 0; max-width: 100%; }

/* ========== Page Action Bar & Add Button ========== */
.page-action-bar {
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

a.btn-add-material { text-decoration: none; color: var(--white); }
.btn-add-material {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary-red), var(--primary-red-dark));
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-material:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(196, 30, 58, 0.45);
}

.btn-add-material .btn-icon {
  width: 24px;
  height: 24px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.btn-calc-material {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--black-medium), var(--black-dark));
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-calc-material:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

/* ========== Slide-out Panel ========== */
.slide-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0);
  z-index: 1998;
  visibility: hidden;
  transition: all 0.35s ease;
}

.slide-overlay.active {
  visibility: visible;
  background: rgba(0,0,0,0.4);
}

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 460px;
  height: 100vh;
  background: var(--white);
  box-shadow: -10px 0 50px rgba(0,0,0,0.2);
  z-index: 1999;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}

.slide-panel.open {
  transform: translateX(0);
}

body.panel-open { overflow: hidden; }

.slide-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--black-dark), var(--black-medium));
  color: var(--white);
}

.slide-panel-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.slide-close {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.slide-close:hover {
  background: rgba(255,255,255,0.25);
}

.slide-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 0;
}

.slide-panel-footer {
  flex-shrink: 0;
  padding: 16px 24px;
  border-top: 1px solid #eee;
  background: #f9f9f9;
}

.slide-panel-wide { max-width: 520px !important; }
.grn-form-cloth .grn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 20px;
  margin-bottom: 18px;
}
.grn-form-cloth .grn-grid .form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  grid-column: span 2;
}
.grn-form-cloth .grn-grid .form-row.grn-stock-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 20px;
  grid-column: span 3;
}
.stock-row-simple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 16px;
}
.stock-details-box {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: var(--border-radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px 24px;
}
.stock-detail-item { font-size: 13px; color: var(--black-medium); }
.stock-detail-item strong { color: var(--gray-medium); font-weight: 600; display: block; font-size: 11px; text-transform: uppercase; margin-bottom: 2px; }
.stock-detail-item.stock-total-highlight { grid-column: 1 / -1; background: rgba(196,30,58,0.08); padding: 10px 14px; border-radius: 6px; font-weight: 600; color: var(--primary-red); }
.stock-detail-item.stock-total-highlight strong { color: var(--primary-red); }
.stock-entry-box {
  background: #fff;
  border: 2px solid var(--primary-red);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
}
.stock-box-title { margin: 0 0 16px 0; font-size: 14px; color: var(--primary-red); text-transform: uppercase; }
.stock-entry-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px 20px;
}
.stock-entry-row input[readonly] { background: #f5f5f5; color: var(--black-medium); font-weight: 600; }
.stock-hint { font-size: 11px; font-weight: normal; color: var(--gray-medium); }
.stock-first-note { font-size: 12px; color: var(--primary-red); margin: 12px 0 0 0; padding: 10px 14px; background: rgba(196,30,58,0.08); border-radius: 6px; border-left: 3px solid var(--primary-red); }
.stock-clearance-section { margin-top: 20px; padding-top: 20px; border-top: 1px dashed #e0e0e0; }
.grn-clearance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.grn-simple-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 16px; }
.grn-form-cloth .grn-grid .form-group { margin-bottom: 0; }
.grn-form-cloth .grn-grid label { font-size: 12px; }
.grn-form-cloth .grn-grid input[readonly] { background: #f5f5f5; color: #666; }
.slide-panel-scroll { overflow-y: auto !important; }

/* PO Form */
.po-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.po-section { background: #f8f9fa; padding: 16px; border-radius: var(--border-radius); }
.po-section.full-width { grid-column: 1 / -1; }
.po-section h4 { font-size: 14px; margin-bottom: 12px; color: var(--primary-red); }
.po-items-table-wrap { overflow-x: auto; margin-bottom: 12px; border: 1px solid #e0e0e0; border-radius: 6px; }
.po-items-table { width: 100%; min-width: 600px; border-collapse: collapse; }
.po-items-table th, .po-items-table td { padding: 8px 10px; border-bottom: 1px solid #eee; font-size: 12px; }
.po-items-table th { background: #e8e8e8; font-weight: 600; }
.po-items-table input, .po-items-table select { width: 100%; padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; }
.po-items-table .po-value { background: #f5f5f5; }
.po-items-table .text-center { text-align: center; }
.po-item-row .po-qty, .po-item-row .po-rate { min-width: 70px; }
.po-item-row .po-gst { min-width: 75px; max-width: 90px; font-size: 12px; padding: 4px 6px; }
.po-item-row .po-tax-type { min-width: 90px; font-size: 11px; padding: 4px 6px; }
.po-item-row .po-total { background: #f5f5f5; }

/* PO Totals Section */
.po-totals-section {
  margin-top: 16px;
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: var(--border-radius);
  border: 1px solid #e8e8e8;
  max-width: 360px;
  margin-left: auto;
}
.po-totals-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.po-round-off-input { width: 100px; padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; font-weight: 600; text-align: right; }
.po-totals-label { font-weight: 500; color: var(--black-medium); }
.po-totals-value { font-weight: 600; font-family: monospace; }
.po-totals-tax-row { margin: 8px 0 4px; padding: 8px 0; border-top: 1px dashed #ddd; }
.po-tax-type { display: flex; gap: 20px; margin-bottom: 10px; }
.po-tax-type label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; cursor: pointer; }
.po-tax-type input[type="radio"] { accent-color: var(--primary-red); }
.po-tax-input-row { display: flex; gap: 16px; align-items: flex-end; }
.po-tax-input-row .form-group label { font-size: 12px; }
.po-tax-input-row input { max-width: 80px; }
.po-tax-amount-wrap { flex: 1; display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.po-grand-row { margin-top: 8px; padding-top: 10px; border-top: 2px solid var(--primary-red); font-size: 15px; }
.po-grand-value { font-size: 18px; color: var(--primary-red); }

/* Purchase Add - Full Page */
.header-back { color: var(--primary-red); text-decoration: none; font-size: 13px; }
.header-back:hover { text-decoration: underline; }
.po-add-form { max-width: 100%; }
.po-page-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.po-card { background: var(--white); border-radius: var(--border-radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid #e8e8e8; }
.po-card.full-width { grid-column: 1 / -1; }
.po-card-terms { width: 100%; }
.po-card-terms textarea { width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1px solid #ddd; border-radius: var(--border-radius); font-size: 14px; font-family: inherit; }
.po-card-addresses { width: 100%; }
.po-address-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.po-address-box { width: 100%; }
.po-address-box textarea { width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1px solid #ddd; border-radius: var(--border-radius); font-size: 14px; font-family: inherit; }
.po-authorised-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.po-auth-box { width: 100%; }
.po-auth-box label { display: block; font-size: 13px; font-weight: 600; color: var(--black-medium); margin-bottom: 6px; }
.po-auth-box input { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: var(--border-radius); font-size: 14px; }
.po-vendor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.po-vendor-grid .form-group-full { grid-column: 1 / -1; }
.po-vendor-row { display: flex; gap: 12px; align-items: flex-start; }
.po-vendor-row select { flex: 1; min-width: 0; }
.po-card-title { font-size: 15px; font-weight: 600; color: var(--primary-red); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #eee; }
.po-form-actions { display: flex; gap: 16px; align-items: center; padding: 20px 0; border-top: 1px solid #eee; margin-top: 8px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

.raw-material-form .form-row { margin-bottom: 16px; }
.raw-material-form .form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { margin-bottom: 16px; }
.form-row.two-col .form-group { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--black-medium);
  margin-bottom: 6px;
}

.form-group .required { color: var(--primary-red); }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-red), var(--primary-red-dark));
  color: var(--white);
}

.btn-primary:hover {
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--off-white);
  color: var(--gray-dark);
  border: 1px solid #ddd;
}

.btn-secondary:hover { background: #e8e8e8; }

.alert {
  padding: 14px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-success {
  background: rgba(46, 125, 50, 0.15);
  color: var(--success);
  border: 1px solid rgba(46, 125, 50, 0.3);
}

.alert-error {
  background: rgba(196, 30, 58, 0.1);
  color: var(--primary-red-dark);
  border: 1px solid rgba(196, 30, 58, 0.3);
}

/* ========== Toast Alert (Auto-hide, Modern) ========== */
.alert-toast {
  position: fixed;
  top: 90px;
  right: 24px;
  min-width: 320px;
  max-width: 420px;
  padding: 16px 20px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  opacity: 0;
  transform: translateX(120%);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.alert-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.alert-toast.hide {
  opacity: 0;
  transform: translateX(120%);
}

.alert-toast.alert-success {
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  color: #fff;
  border: none;
}

.alert-toast.alert-error {
  background: linear-gradient(135deg, var(--primary-red), var(--primary-red-dark));
  color: #fff;
  border: none;
}

.alert-toast .alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  flex-shrink: 0;
}

.alert-toast .alert-text { flex: 1; }

.alert-toast .alert-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,0.5);
  animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

.badge-count {
  font-size: 13px;
  background: var(--primary-red);
  color: var(--white);
  padding: 4px 12px;
  border-radius: 20px;
}

.color-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  border: 1px solid rgba(0,0,0,0.15);
}

.detail-row td { padding: 8px 16px !important; background: #fafafa !important; }
.inward-details { font-size: 12px; color: var(--gray-medium); }
.empty-state { text-align: center; padding: 40px !important; color: var(--gray-medium); }

.row-warning td { background: #fff7e6; }
.row-critical td { background: #ffe6e6; }

/* Production Issue status progress */
.status-progress {
  margin-top: 4px;
  width: 120px;
  height: 6px;
  background: #e4e7ec;
  border-radius: 999px;
  overflow: hidden;
}
.status-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb020, #f95d5d);
  transition: width 0.25s ease-out;
}

.status-summary {
  margin-bottom: 4px;
}
.status-summary-label {
  font-size: 12px;
  color: var(--gray-dark);
  margin-bottom: 4px;
}

/* Status steps line (modal) */
.status-steps-container {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  padding: 4px 2px 0;
}
.status-steps-track {
  position: absolute;
  top: 14px;
  left: 10px;
  right: 10px;
  height: 4px;
  background: #d4d9e6;
  border-radius: 999px;
}
.status-step {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.status-step-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #9aa4c8;
}
.status-step-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--gray-dark);
  text-align: center;
  line-height: 1.2;
}
.status-step.completed .status-step-circle {
  border-color: #2563eb;
  background: #2563eb;
}
.status-step.active .status-step-circle {
  border-color: #ef4444;
  background: #ef4444;
}
.status-step.completed .status-step-label,
.status-step.active .status-step-label {
  font-weight: 600;
  color: #111827;
}

/* Make status steps clickable in modal */
.status-steps-container .status-step {
  cursor: pointer;
}
.status-steps-container .status-step:hover .status-step-label {
  text-decoration: underline;
}

/* Cutting info card inside Material Usage modal */
.mu-step-card {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #e6eaf3;
  border-radius: 10px;
  background: #fbfcff;
}
.mu-step-title { margin-bottom: 4px; }
.mu-step-desc { font-size: 12px; color: var(--gray-medium); }
.mu-step-totals {
  margin-top: 6px;
  font-size: 12px;
  color: var(--gray-dark);
}

.mu-step-totals.mu-money {
  font-weight: 600;
  color: #0f766e;
}
/* Total amount between title & description (Stitching summary card) */
.mu-step-totals-inline {
  margin: 6px 0 8px;
  font-size: 13px;
}

/* Stitching amount breakdown (View Usage modal) */
.mu-stitch-bd-label {
  margin-top: 6px !important;
  margin-bottom: 6px !important;
}
.mu-stitch-bd-wrap {
  margin-bottom: 8px;
}
.mu-stitch-bd-table {
  font-size: 12px;
}
.mu-stitch-bd-table thead th {
  padding: 6px 8px !important;
  font-size: 11px !important;
}
.mu-stitch-bd-table tbody td {
  padding: 6px 8px !important;
  vertical-align: middle;
}
.mu-stitch-bd-table .mu-bd-calc {
  color: var(--gray-medium);
  font-size: 11px;
  white-space: nowrap;
}
.mu-stitch-bd-table .mu-bd-tfoot td {
  padding: 8px !important;
  background: #f0fdf4;
  border-top: 2px solid #bbf7d0;
  font-size: 12px;
}
#issueUsageModal .mu-stitch-bd-table .mu-bd-tfoot td {
  background: #f0fdf4;
}
.mu-step-prod { margin-top: 8px; }
.mu-step-prod-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.mu-step-prod-meta {
  font-size: 11px;
  color: var(--gray-medium);
  white-space: nowrap;
}
.mu-step-prod-meta.mu-meta-highlight {
  white-space: normal;
  text-align: right;
  max-width: 100%;
  line-height: 1.35;
}
.mu-step-pcs-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-medium);
}

.badge-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-status-cutting {
  background: #fff7e6;
  color: #92400e;
}
.badge-status-wip {
  background: #e0f2fe;
  color: #075985;
}
.badge-status-finished {
  background: #dcfce7;
  color: #166534;
}
.badge-status-dispatched {
  background: #fee2e2;
  color: #b91c1c;
}

/* Ready Product — compact list + detail modal */
.page-ready-product .header h1 {
  font-size: 1.35rem;
}

/* Ready Product — main: clip helps sticky header */
main.ready-product-main.page-ready-product-focus {
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  main.ready-product-main.page-ready-product-focus {
    overflow-x: clip;
  }
}

/* Ready Product — header + search / export toolbar */
body.page-ready-product .header.header-compact-ready.page-ready-product-header {
  height: auto;
  min-height: var(--header-height);
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
  z-index: 110;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

body.page-ready-product .header.page-ready-product-header .rp-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}

body.page-ready-product .header.page-ready-product-header .rp-header-title {
  margin: 0;
  line-height: 1.25;
  flex-shrink: 0;
  align-self: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--black-dark);
}

body.page-ready-product .header.page-ready-product-header .rp-header-toolbar {
  flex: 1 1 260px;
  min-width: min(100%, 200px);
  margin: 0;
  padding: 10px 14px;
  position: relative;
  z-index: 5;
}

body.page-ready-product .header.page-ready-product-header .rp-header-toolbar .stock-alerts-search-wrap {
  flex: 1 1 180px;
  min-width: 0;
  z-index: 6;
}

body.page-ready-product .header.page-ready-product-header .rp-header-toolbar .stock-alerts-label {
  margin-bottom: 4px;
}

body.page-ready-product .header.page-ready-product-header .rp-header-toolbar .stock-alerts-search-input {
  max-width: none;
  width: 100%;
}

@media (max-width: 720px) {
  body.page-ready-product .header.page-ready-product-header .rp-header-left {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  body.page-ready-product .header.page-ready-product-header .rp-header-toolbar {
    flex: 1 1 auto;
    width: 100%;
  }
  body.page-ready-product .header.page-ready-product-header .rp-header-title {
    align-self: flex-start;
  }
}

.page-kpi-label-muted {
  font-weight: 500;
  opacity: 0.85;
}
.ready-product-main .dashboard-section {
  margin-bottom: 14px;
}
.ready-section-compact .section-header-tight {
  margin-bottom: 8px;
  padding-bottom: 6px;
}
.ready-section-compact .section-title-sm {
  font-size: 15px;
}
.ready-inline-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--gray-medium);
}
.ready-footer-hint {
  margin-top: 10px;
  margin-bottom: 0;
}
.ready-footer-hint a {
  color: var(--primary, #0f766e);
  font-weight: 600;
}

.ready-sku-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ready-sku-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1px solid #99f6e4;
  border-radius: 999px;
  font-size: 12px;
}
.ready-sku-chip-code {
  font-weight: 700;
  color: #0f766e;
}
.ready-sku-chip-size {
  color: var(--gray-medium);
  font-size: 11px;
}
.ready-sku-chip-qty {
  font-weight: 700;
  color: #134e4a;
}
.ready-sku-chip-qty small {
  font-weight: 500;
  opacity: 0.75;
}

.data-table-ready-compact {
  font-size: 12px;
}
.data-table-ready-compact th,
.data-table-ready-compact td {
  padding: 8px 10px;
  vertical-align: middle;
}
.data-table-ready-compact thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--gray-medium);
}
.ready-col-action {
  width: 88px;
}
.ready-td-pi {
  white-space: nowrap;
}
.ready-td-date {
  white-space: nowrap;
  color: var(--gray-dark);
}
.ready-td-prod {
  min-width: 140px;
  max-width: 220px;
}
.ready-prod-name-truncate {
  font-size: 11px;
  color: var(--gray-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.ready-td-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.badge-status-sm {
  font-size: 10px;
  padding: 2px 7px;
}
.ready-pend-pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.ready-pend-pill.is-ok {
  background: #dcfce7;
  color: #166534;
}
.ready-pend-pill.is-warn {
  background: #ffedd5;
  color: #9a3412;
}
.btn-outline-ready {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #0d9488;
  background: #fff;
  color: #0f766e;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-outline-ready:hover {
  background: #0d9488;
  color: #fff;
}
tr.ready-row {
  cursor: pointer;
}
tr.ready-row:hover {
  background: #f8fafc;
}

.ready-pi-code {
  color: var(--primary, #0f766e);
  font-weight: 700;
  font-size: 12px;
}

/* Ready detail modal — compact box, same polish as Production Issue popups */
#readyProductDetailModal .ready-detail-modal {
  max-width: min(96vw, 640px) !important;
  width: 100%;
  padding: 0 !important;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.22);
}
#readyProductDetailModal .ready-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 16px;
  background: linear-gradient(135deg, var(--black-dark), var(--black-medium));
  color: #fff;
  border-bottom: none;
  border-radius: 0;
  flex-shrink: 0;
}
#readyProductDetailModal .ready-detail-head-text {
  flex: 1;
  min-width: 0;
}
#readyProductDetailModal .ready-detail-kicker {
  display: block;
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
}
#readyProductDetailModal .ready-detail-title-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}
#readyProductDetailModal .rd-title-chip {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 9px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
#readyProductDetailModal .rd-title-chip-pi {
  background: rgba(196, 30, 58, 0.28);
  color: #fecdd3;
  border: 1px solid rgba(248, 113, 113, 0.45);
}
#readyProductDetailModal .rd-title-chip-sku {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
#readyProductDetailModal .rd-title-chip-sep {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 300;
  font-size: 17px;
  user-select: none;
}
#readyProductDetailModal .ready-detail-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
}
#readyProductDetailModal .ready-detail-sub .badge-status {
  vertical-align: middle;
}
#readyProductDetailModal .ready-detail-body {
  padding: 14px 16px 18px;
  max-height: min(72vh, 520px);
  overflow-y: auto;
  background: #f1f5f9;
  -webkit-overflow-scrolling: touch;
}

#readyProductDetailModal .rd-detail-single {
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 14px 14px 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.rd-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 4px;
}
.rd-stage-table-pend th:last-child,
.rd-stage-table-pend td:last-child {
  min-width: 200px;
  max-width: 320px;
  text-align: left;
  font-weight: 500;
  vertical-align: top;
}
.rd-pend-cell {
  font-size: 12px;
  line-height: 1.4;
  color: #9a3412;
}
.rd-pend-cell.rd-pend-clear {
  color: #94a3b8;
  font-weight: 400;
}
.rd-pend-cell.rd-pend-ok {
  color: #15803d;
  font-weight: 600;
}
.rd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .rd-grid {
    grid-template-columns: 1fr;
  }
}
.rd-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-medium);
  margin-bottom: 8px;
}

.rd-flow-track {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
.rd-flow-seg {
  min-width: 2px;
  height: 100%;
  transition: width 0.25s ease;
}
.rd-seg-0 { background: #64748b; }
.rd-seg-1 { background: #f59e0b; }
.rd-seg-2 { background: #3b82f6; }
.rd-seg-3 { background: #22c55e; }
.rd-seg-4 { background: #a855f7; }
.rd-seg-5 { background: #0ea5e9; }
.rd-seg-6 { background: #f97316; }
.rd-seg-7 { background: #ef4444; }

.rd-flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--gray-dark);
}
.rd-flow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.rd-leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.rd-leg-0 { background: #64748b; }
.rd-leg-1 { background: #f59e0b; }
.rd-leg-2 { background: #3b82f6; }
.rd-leg-3 { background: #22c55e; }
.rd-leg-4 { background: #a855f7; }
.rd-leg-5 { background: #0ea5e9; }
.rd-leg-6 { background: #f97316; }
.rd-leg-7 { background: #ef4444; }

.rd-stage-table {
  font-size: 12px;
}
.rd-stage-table th,
.rd-stage-table td {
  padding: 6px 10px;
}

.rd-pend-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.rd-pend-list li {
  margin-bottom: 8px;
}
.rd-pend-ok {
  color: #15803d;
  font-weight: 600;
}
.rd-pend-warn {
  color: #9a3412;
}

.rd-card {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fafafa;
}
.rd-card-muted {
  background: #f8fafc;
}
.rd-card-dispatch {
  background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
  border-color: #fecaca;
}
.rd-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-medium);
  margin-bottom: 8px;
}
.rd-card-meta {
  margin: 0;
  font-size: 13px;
  color: var(--gray-dark);
}
.rd-card-body {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--black-medium, #1e293b);
}

.text-success-strong {
  color: #15803d;
  font-weight: 600;
}

/* Production Issue — embedded (direct URL ?embed=1) */
body.pi-embed-view .sidebar,
body.pi-embed-view .sidebar-toggle {
  display: none !important;
}
body.pi-embed-view .main-content {
  margin-left: 0 !important;
  max-width: 100% !important;
}
body.pi-embed-view .pi-hide-in-embed {
  display: none !important;
}
.main-content-pi-embed {
  padding-top: 0;
}
.pi-embed-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}
.pi-embed-topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px;
  font-size: 13px;
}
.pi-embed-topbar-title {
  font-weight: 700;
}
.pi-embed-focus-badge {
  opacity: 0.95;
  font-size: 12px;
}
.pi-embed-open-full {
  margin-left: auto;
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pi-embed-open-full:hover {
  color: #ecfdf5;
}
.pi-embed-status-pill {
  white-space: nowrap;
}
tr.pi-focus-highlight {
  outline: 3px solid #0d9488;
  outline-offset: -2px;
  background: #f0fdfa !important;
  transition: background 0.3s ease, outline 0.3s ease;
}

/* Reports: production stage graph */
.prod-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}
.prod-bar .seg { height: 100%; display: block; }
.seg-pending { background: #94a3b8; }
.seg-cut { background: #f59e0b; }
.seg-st { background: #3b82f6; }
.seg-fin { background: #22c55e; }
.seg-qc { background: #a855f7; }
.seg-pr { background: #0ea5e9; }
.seg-pk { background: #f97316; }
.seg-dp { background: #ef4444; }
.prod-bar-legend {
  margin-top: 4px;
  font-size: 10px;
  color: var(--gray-medium);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.prod-bar-legend .c {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: -1px;
}
.prod-bar-legend .pending { background: #94a3b8; }
.prod-bar-legend .cut { background: #f59e0b; }
.prod-bar-legend .st { background: #3b82f6; }
.prod-bar-legend .fin { background: #22c55e; }
.prod-bar-legend .qc { background: #a855f7; }
.prod-bar-legend .pr { background: #0ea5e9; }
.prod-bar-legend .pk { background: #f97316; }
.prod-bar-legend .dp { background: #ef4444; }

.inner-table {
  margin-top: 2px;
}
.inner-table th,
.inner-table td {
  font-size: 12px;
  padding: 6px 8px !important;
  line-height: 1.25;
}

/* Multi-product rows in Production Issue */
.mp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mp-row {
  padding: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fafbff;
}

/* Material Usage modal grouping */
.mu-product-block {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0,0,0,0.12);
}
.mu-product-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.mu-product-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.mu-product-meta {
  font-size: 11px;
  color: var(--gray-medium);
  white-space: nowrap;
}

.mu-meta-highlight {
  font-weight: 700;
  color: #b91c1c;
}

.mu-summary-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--gray-dark);
  font-weight: 600;
}

/* Material Usage (View) — same compact shell as Stitching / Cutting allocation modals */
.modal-content.pi-usage-view-modal {
  max-width: min(94vw, 680px) !important;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
}

/* Sales / Dispatch — size-wise breakdown in list + wider detail modal */
#salesDetailModal .modal-content.pi-usage-view-modal {
  max-width: min(96vw, 860px) !important;
}
.sales-dispatch-breakdown-cell {
  vertical-align: top;
  min-width: 280px;
  max-width: 480px;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}
.sales-dispatch-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.35;
  background: #fafbfc;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e8ecf2;
}
.sales-dispatch-mini thead th {
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5c6570;
  background: #eef1f6;
  border-bottom: 1px solid #dde3ec;
  text-align: left;
}
.sales-dispatch-mini thead th.text-right {
  text-align: right;
}
.sales-dispatch-mini tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: middle;
}
.sales-dispatch-mini tbody tr:last-child td {
  border-bottom: none;
}
.sales-dispatch-col-pcode {
  white-space: nowrap;
  max-width: 120px;
}
.sales-dispatch-col-size {
  color: #374151;
  font-weight: 600;
}
.sales-dispatch-col-num {
  white-space: nowrap;
  min-width: 4.5em;
}
.sales-dispatch-pending-warn {
  color: #b45309;
  background: rgba(251, 191, 36, 0.12);
}
.sales-dispatch-pending-ok {
  color: #15803d;
}
#salesDetailModal .sales-modal-dispatch-table {
  font-size: 12px;
}
#salesDetailModal .sales-modal-dispatch-table th,
#salesDetailModal .sales-modal-dispatch-table td {
  padding: 7px 9px;
}

/* Ready Product — PI grouped rows, mini table per issue (matches sales dispatch style) */
.ready-product-main .sales-dispatch-breakdown-cell {
  min-width: 300px;
  max-width: 560px;
}
.ready-products-line-table .ready-mini-action-col {
  white-space: nowrap;
  width: 1%;
  padding-left: 6px !important;
  padding-right: 6px !important;
  vertical-align: middle;
}
.ready-products-line-table .btn-outline-ready {
  padding: 4px 10px;
  font-size: 11px;
  line-height: 1.2;
}

/* Page role clarity — Sales vs Ready Product KPI strips */
.page-role-lead {
  max-width: 920px;
  line-height: 1.55;
  font-size: 14px;
  color: var(--gray-dark);
}
.page-role-lead a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.section-explainer {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
  max-width: 900px;
}
.page-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.page-kpi-card {
  background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.page-kpi-card-primary {
  border-color: #bbf7d0;
  background: linear-gradient(145deg, #f0fdf4 0%, #ecfdf5 100%);
}
.page-kpi-card-warn {
  border-color: #fde68a;
  background: linear-gradient(145deg, #fffbeb 0%, #fef9c3 55%, #fff 100%);
}
.page-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  line-height: 1.35;
  margin-bottom: 6px;
}
.page-kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.1;
}
.page-kpi-card-primary .page-kpi-value {
  color: #166534;
}
.page-kpi-card-warn .page-kpi-value {
  color: #a16207;
}
.page-kpi-unit {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
}
.page-kpi-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #64748b;
}
.text-muted-soft {
  color: #64748b !important;
  font-weight: 500;
}
/* Raw Material Entry — clip avoids breaking sticky header vs overflow-x:hidden on main */
main.page-raw-material-entry {
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  main.page-raw-material-entry {
    overflow-x: clip;
  }
}

/* Raw Material Entry — title + lead beside each other, primary action in header (no clip) */
main.page-raw-material-entry > .header.page-raw-material-header {
  height: auto;
  min-height: var(--header-height);
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
  z-index: 110;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

main.page-raw-material-entry > .header .rm-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  flex: 1;
  min-width: 0;
}

main.page-raw-material-entry > .header .rm-header-title {
  margin: 0;
  line-height: 1.25;
  flex-shrink: 0;
  align-self: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--black-dark);
}

main.page-raw-material-entry > .header .rm-header-toolbar {
  flex: 1 1 260px;
  min-width: min(100%, 200px);
  margin: 0;
  margin-bottom: 0;
  padding: 10px 14px;
  position: relative;
  z-index: 5;
}

main.page-raw-material-entry > .header .rm-header-toolbar .stock-alerts-search-wrap {
  flex: 1 1 180px;
  min-width: 0;
  z-index: 6;
}

main.page-raw-material-entry > .header .rm-header-toolbar .stock-alerts-label {
  margin-bottom: 4px;
}

main.page-raw-material-entry > .header .rm-header-toolbar .stock-alerts-search-input {
  max-width: none;
  width: 100%;
}

main.page-raw-material-entry > .header .rm-header-actions {
  flex-shrink: 0;
  align-self: center;
}

@media (max-width: 720px) {
  main.page-raw-material-entry > .header .rm-header-left {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  main.page-raw-material-entry > .header .rm-header-toolbar {
    flex: 1 1 auto;
    width: 100%;
  }
  main.page-raw-material-entry > .header .rm-header-title {
    align-self: flex-start;
  }
}

@media (max-width: 640px) {
  main.page-raw-material-entry > .header.page-raw-material-header {
    flex-direction: column;
    align-items: stretch;
  }
  main.page-raw-material-entry > .header .rm-header-actions {
    width: 100%;
  }
  main.page-raw-material-entry > .header .rm-header-actions .btn-add-material {
    width: 100%;
    justify-content: center;
  }
}

/* Raw Material Entry — list card stacking */
main.page-raw-material-entry .rm-list-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

main.page-raw-material-entry .dashboard-content {
  position: relative;
  z-index: 0;
}

/* Production Issue — main clip + header search / export */
main.page-production-issue:not(.main-content-pi-embed) {
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  main.page-production-issue:not(.main-content-pi-embed) {
    overflow-x: clip;
  }
}

main.page-production-issue:not(.main-content-pi-embed) > .header.page-production-issue-header {
  height: auto;
  min-height: var(--header-height);
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
  z-index: 110;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  flex: 1;
  min-width: 0;
}

main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-title {
  margin: 0;
  line-height: 1.25;
  flex-shrink: 0;
  align-self: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--black-dark);
}

main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-toolbar {
  flex: 1 1 260px;
  min-width: min(100%, 200px);
  margin: 0;
  padding: 10px 14px;
  position: relative;
  z-index: 5;
}

main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-toolbar .stock-alerts-search-wrap {
  flex: 1 1 180px;
  min-width: 0;
  z-index: 6;
}

main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-toolbar .stock-alerts-label {
  margin-bottom: 4px;
}

main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-toolbar .stock-alerts-search-input {
  max-width: none;
  width: 100%;
}

@media (max-width: 720px) {
  main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-left {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-toolbar {
    flex: 1 1 auto;
    width: 100%;
  }
  main.page-production-issue:not(.main-content-pi-embed) > .header .prod-issue-header-title {
    align-self: flex-start;
  }
}

/* Sales page — dispatch-first columns */
.sales-th-dispatch,
.sales-th-pending {
  white-space: nowrap;
}
.sales-th-dispatch {
  background: rgba(22, 163, 74, 0.1) !important;
  color: #14532d !important;
}
.sales-th-pending {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #92400e !important;
}
.sales-th-packed {
  color: #64748b !important;
}
.sales-td-dispatch {
  background: rgba(22, 163, 74, 0.06);
  font-weight: 700;
  color: #14532d;
}
.sales-td-pending {
  background: rgba(245, 158, 11, 0.08);
  font-weight: 700;
  color: #92400e;
}
.sales-dispatch-mini-sales-focus .sales-th-dispatch {
  background: rgba(22, 163, 74, 0.14) !important;
}
.sales-dispatch-mini-sales-focus .sales-th-pending {
  background: rgba(245, 158, 11, 0.14) !important;
}
.sales-dispatch-done-em {
  color: #15803d;
  font-weight: 800;
}
.sales-section-dispatched .section-title {
  font-size: 17px;
}
.sales-modal-dispatch-strong {
  color: #15803d;
  font-weight: 800;
}
.sales-modal-totals-line .sales-total-em {
  color: #14532d;
  font-weight: 700;
}
/* Ready Product — packed-first */
.ready-th-em {
  color: #166534;
  font-weight: 800;
}
.ready-th-packed-sum {
  background: rgba(22, 163, 74, 0.1) !important;
  color: #14532d !important;
}
.ready-th-pend-sum {
  background: rgba(245, 158, 11, 0.1) !important;
  color: #92400e !important;
}
.ready-td-packed-total {
  background: rgba(22, 163, 74, 0.06);
  font-weight: 800;
  color: #14532d;
}
.ready-td-dispatch-left {
  font-weight: 800;
  color: #92400e;
}
.ready-mini-packed-focus .ready-th-packed-ready {
  background: rgba(22, 163, 74, 0.14) !important;
  color: #14532d !important;
}
.ready-mini-packed-focus .ready-th-dispatch-left {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #92400e !important;
}
.ready-packed-em {
  color: #15803d;
  font-weight: 800;
}

.sales-actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.sales-dispatch-form-modal .form-group label {
  font-size: 12px;
  font-weight: 600;
}

/* Stock alerts — search + export toolbar */
.stock-alerts-section-head {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stock-alerts-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
  margin-bottom: 10px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  position: relative;
  z-index: 2;
}

.stock-alerts-search-wrap {
  flex: 1;
  min-width: min(100%, 280px);
  position: relative;
  z-index: 3;
}

.stock-alerts-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 6px;
}

.stock-alerts-search-input {
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  background: #fff;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
}

.stock-alerts-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.stock-alerts-search-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.stock-alerts-export-wrap .btn {
  min-height: 42px;
  padding-left: 18px;
  padding-right: 18px;
}

.stock-alerts-toolbar-hint {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
}

@media (max-width: 576px) {
  .stock-alerts-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .stock-alerts-search-input {
    max-width: none;
  }
  .stock-alerts-export-wrap .btn {
    width: 100%;
  }
}

/* List toolbar — pagination + per page (shared: stock alerts, raw material, MRF, PI, ready product, etc.) */
.list-toolbar-pager-slot {
  margin-top: 12px;
}
.list-toolbar-pager-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.list-toolbar-pager-meta {
  font-size: 13px;
  color: #64748b;
  flex: 1 1 200px;
  min-width: 0;
  line-height: 1.4;
}
.list-toolbar-pager-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.list-toolbar-pager-pages {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.list-toolbar-pager-pages .btn-sm {
  min-width: 2.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 12px;
}
.list-toolbar-pager-per-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
  margin: 0;
}
.list-toolbar-pager-per-text {
  white-space: nowrap;
}
.list-toolbar-pager-per-select {
  min-width: 92px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

@media (max-width: 576px) {
  .list-toolbar-pager-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .list-toolbar-pager-nav {
    justify-content: center;
  }
  .list-toolbar-pager-per-label {
    justify-content: space-between;
  }
}

/* List pages: title + search/export in header (inventory, purchase, suppliers, …) */
main.page-ltp {
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  main.page-ltp {
    overflow-x: clip;
  }
}
.page-ltp > .header.page-ltp-h {
  height: auto;
  min-height: var(--header-height);
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
  z-index: 110;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.page-ltp > .header .page-ltp-h-left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  flex: 1;
  min-width: 0;
}
.page-ltp > .header .page-ltp-h-title {
  margin: 0;
  line-height: 1.25;
  flex-shrink: 0;
  align-self: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--black-dark);
}
.page-ltp > .header .page-ltp-h-toolbar {
  flex: 1 1 260px;
  min-width: min(100%, 200px);
  margin: 0;
  padding: 10px 14px;
  position: relative;
  z-index: 5;
}
.page-ltp > .header .page-ltp-h-toolbar .stock-alerts-search-wrap {
  flex: 1 1 180px;
  min-width: 0;
  z-index: 6;
}
.page-ltp > .header .page-ltp-h-toolbar .stock-alerts-label {
  margin-bottom: 4px;
}
.page-ltp > .header .page-ltp-h-toolbar .stock-alerts-search-input {
  max-width: none;
  width: 100%;
}
@media (max-width: 720px) {
  .page-ltp > .header .page-ltp-h-left {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .page-ltp > .header .page-ltp-h-toolbar {
    flex: 1 1 auto;
    width: 100%;
  }
  .page-ltp > .header .page-ltp-h-title {
    align-self: flex-start;
  }
}

/* In-section list toolbar (sales tables, sales orders, UOM) */
.list-toolbar-inline-section {
  margin-bottom: 12px;
}

/* Reports page — header + filters card + export + table */
main.page-reports .header.reports-page-header {
  height: auto;
  min-height: var(--header-height);
  align-items: flex-start;
  padding-top: 16px;
  padding-bottom: 16px;
}

main.page-reports .header .header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding-right: 12px;
}

.reports-header-lead {
  margin: 0;
  max-width: min(100%, 920px);
  line-height: 1.55;
  font-size: 13px;
  color: var(--gray-medium);
}

.reports-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.reports-filters-section {
  margin-bottom: 18px;
}

.reports-section-header-tight {
  margin-bottom: 6px;
  padding-bottom: 8px;
}

.reports-section-intro {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
  max-width: 900px;
}

.reports-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px 18px;
  align-items: end;
}

.reports-filter-field {
  margin-bottom: 0 !important;
}

.reports-filter-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 6px;
}

.reports-filter-form .form-control,
.reports-filter-form select.form-control,
.reports-filter-form input.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  box-sizing: border-box;
}

.reports-filter-form .form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.reports-filter-actions {
  min-width: 148px;
}

.reports-filter-actions-label {
  display: block;
  min-height: 17px;
  margin-bottom: 6px;
}

.reports-apply-btn {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reports-export-section .section-header {
  margin-bottom: 10px;
  padding-bottom: 0;
  border-bottom: none;
}

.reports-pipeline-section .section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.reports-on-screen-tag {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Reports — compact export (dropdown + CSV / PDF) */
.report-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.report-export-compact-wrap {
  margin-bottom: 20px;
  padding: 16px 18px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.report-export-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
}
.report-export-compact-label {
  font-weight: 700;
  font-size: 14px;
  color: #334155;
  white-space: nowrap;
  display: flex;
  align-items: center;
  padding: 4px 0;
}
.report-export-select {
  flex: 1;
  min-width: min(100%, 260px);
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  box-sizing: border-box;
}

.page-reports .report-export-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.report-export-hint {
  margin: 12px 0 0 !important;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}
@media (max-width: 768px) {
  .report-export-compact {
    flex-direction: column;
    align-items: stretch;
  }
  .report-export-compact .report-export-select {
    max-width: none;
  }
  .report-export-compact .report-export-actions {
    width: 100%;
  }
  .report-export-compact .report-export-actions .btn {
    flex: 1;
    min-width: 0;
    min-height: 44px;
  }
  .reports-filter-grid {
    grid-template-columns: 1fr;
  }
}

#issueUsageModal .modal-header {
  padding: 12px 16px;
}
#issueUsageModal .modal-header h3 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0;
  padding-right: 8px;
  word-break: break-word;
}
#issueUsageModal .modal-body {
  padding: 12px 14px 14px;
  max-height: min(72vh, 580px);
}
#issueUsageModal .pi-usage-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-medium);
}
#issueUsageModal .pi-usage-steps.status-steps-container {
  margin-bottom: 8px;
  padding: 2px 0 0;
}
#issueUsageModal .pi-usage-steps .status-steps-track {
  top: 12px;
  left: 8px;
  right: 8px;
  height: 3px;
}
#issueUsageModal .pi-usage-steps .status-step-circle {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
#issueUsageModal .pi-usage-steps .status-step-label {
  margin-top: 4px;
  font-size: 10px;
  max-width: 56px;
  line-height: 1.15;
}
#issueUsageModal .table-responsive {
  margin-top: 6px !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#issueUsageModal .data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 0;
  font-size: 12px;
}
#issueUsageModal .data-table thead th {
  padding: 8px 10px;
  background: #f6f8fc;
  color: #394150;
  border-bottom: 1px solid #e6ebf3;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}
#issueUsageModal .data-table tbody td {
  padding: 7px 10px;
  vertical-align: top;
}
#issueUsageModal .data-table tbody tr:hover {
  background: #fafcff;
}
#issueUsageModal .data-table th.text-right,
#issueUsageModal .data-table td.text-right {
  white-space: nowrap;
}
#issueUsageModal .mu-product-block {
  margin-top: 10px;
  padding-top: 10px;
}
#issueUsageModal .mu-product-head strong {
  font-size: 13px;
}
#issueUsageModal .mu-product-meta,
#issueUsageModal .mu-summary-label {
  font-size: 11px;
}
#issueUsageModal .mu-step-card {
  padding: 8px 10px;
  margin-top: 6px;
}
#issueUsageModal .mu-step-desc {
  font-size: 11px;
  line-height: 1.45;
}
#issueUsageModal .mu-step-prod-meta {
  font-size: 10px;
}
#issueUsageModal .inner-table {
  margin-top: 6px !important;
}
#issueUsageModal .mu-btn-cutting-pending,
#issueUsageModal .btn-open-cutting-pending,
#issueUsageModal .mu-btn-stitching-pending,
#issueUsageModal .btn-open-stitching-pending,
#issueUsageModal .mu-btn-finishing-pending,
#issueUsageModal .btn-open-finishing-pending,
#issueUsageModal .mu-btn-qc-pending,
#issueUsageModal .btn-open-qc-pending,
#issueUsageModal .mu-btn-press-pending,
#issueUsageModal .btn-open-press-pending,
#issueUsageModal .mu-btn-pack-pending,
#issueUsageModal .btn-open-pack-pending {
  position: relative;
  z-index: 5;
  cursor: pointer;
  pointer-events: auto;
}

/* Sales / Dispatch detail — same compact shell & typography as Material Usage (Cutting Summary) */
#salesDetailModal .modal-header {
  padding: 12px 16px;
}
#salesDetailModal .modal-header h3 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0;
  padding-right: 8px;
  word-break: break-word;
}
#salesDetailModal .modal-body {
  padding: 12px 14px 14px;
  max-height: min(72vh, 580px);
  overflow-y: auto;
}
#salesDetailModal .pi-usage-hint {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-medium);
}
#salesDetailModal .table-responsive {
  margin-top: 6px !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#salesDetailModal .data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 0;
  font-size: 12px;
}
#salesDetailModal .data-table thead th {
  padding: 8px 10px;
  background: #f6f8fc;
  color: #394150;
  border-bottom: 1px solid #e6ebf3;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}
#salesDetailModal .data-table tbody td {
  padding: 7px 10px;
  vertical-align: top;
}
#salesDetailModal .data-table tbody tr:hover {
  background: #fafcff;
}
#salesDetailModal .data-table th.text-right,
#salesDetailModal .data-table td.text-right {
  white-space: nowrap;
}
#salesDetailModal .mu-step-card {
  padding: 8px 10px;
  margin-top: 6px;
}
#salesDetailModal .mu-step-card:first-of-type {
  margin-top: 0;
}
#salesDetailModal .mu-step-title {
  font-size: 13px;
  margin-bottom: 2px;
}
#salesDetailModal .mu-step-desc {
  font-size: 11px;
  line-height: 1.45;
}
#salesDetailModal .mu-step-totals {
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.4;
}
#salesDetailModal .mu-step-prod {
  margin-top: 6px;
}
#salesDetailModal .mu-step-prod-head strong {
  font-size: 12px;
}
#salesDetailModal .mu-step-prod-meta {
  font-size: 10px;
}
#salesDetailModal .inner-table {
  margin-top: 6px !important;
}
#salesDetailModal .mu-summary-label {
  font-size: 11px;
  margin-top: 2px;
}
#salesDetailModal .sales-mu-total-row td {
  background: #f0f4fa;
  font-weight: 700;
  border-top: 1px solid #e6ebf3;
}

/* Keep Cutting modal compact */
#cuttingModal .modal-content {
  max-width: 520px !important;
}

#cuttingModal .table-responsive {
  overflow-x: visible;
}

#cuttingModal .data-table {
  width: auto;
  min-width: 0;
}

#cuttingModal .data-table th:nth-child(1),
#cuttingModal .data-table td:nth-child(1) {
  max-width: 260px;
  white-space: normal;
}

#cuttingModal .data-table th:nth-child(2),
#cuttingModal .data-table th:nth-child(3),
#cuttingModal .data-table td:nth-child(2),
#cuttingModal .data-table td:nth-child(3) {
  width: 110px;
  text-align: right;
}

/* Cutting modal: qty & rate inputs same width */
#cuttingModal input[type="number"] {
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
}

/* Stitching modal: same compact layout as Cutting */
#stitchingModal .modal-content {
  max-width: 520px !important;
}

#stitchingModal .table-responsive {
  overflow-x: visible;
}

#stitchingModal .data-table {
  width: auto;
  min-width: 0;
}

#stitchingModal .data-table th:nth-child(2),
#stitchingModal .data-table th:nth-child(3),
#stitchingModal .data-table td:nth-child(2),
#stitchingModal .data-table td:nth-child(3),
#stitchingModal .data-table th:nth-child(4),
#stitchingModal .data-table td:nth-child(4) {
  width: 110px;
  text-align: right;
}

#stitchingModal input[type="number"] {
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
}

/* Finishing modal: same compact layout as Cutting / Stitching */
#finishingModal .modal-content {
  max-width: 520px !important;
}

#finishingModal .table-responsive {
  overflow-x: visible;
}

#finishingModal .data-table {
  width: auto;
  min-width: 0;
}

#finishingModal .data-table th:nth-child(1),
#finishingModal .data-table td:nth-child(1) {
  max-width: 260px;
  white-space: normal;
}

#finishingModal .data-table th:nth-child(2),
#finishingModal .data-table th:nth-child(3),
#finishingModal .data-table td:nth-child(2),
#finishingModal .data-table td:nth-child(3),
#finishingModal .data-table th:nth-child(4),
#finishingModal .data-table td:nth-child(4) {
  width: 110px;
  text-align: right;
}

#finishingModal input[type="number"] {
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
}

/* QC Check modal: same compact box as Cutting / Finishing */
#qcModal .modal-content {
  max-width: 520px !important;
}

#qcModal .table-responsive {
  overflow-x: visible;
}

#qcModal .data-table {
  width: auto;
  min-width: 0;
}

#qcModal .data-table th:nth-child(1),
#qcModal .data-table td:nth-child(1) {
  max-width: 260px;
  white-space: normal;
}

#qcModal .data-table th:nth-child(2),
#qcModal .data-table th:nth-child(3),
#qcModal .data-table td:nth-child(2),
#qcModal .data-table td:nth-child(3),
#qcModal .data-table th:nth-child(4),
#qcModal .data-table td:nth-child(4) {
  width: 110px;
  text-align: right;
}

#qcModal input[type="number"] {
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
}

/* Press modal: same compact box as QC / Finishing */
#pressModal .modal-content {
  max-width: 520px !important;
}

#pressModal .table-responsive {
  overflow-x: visible;
}

#pressModal .data-table {
  width: auto;
  min-width: 0;
}

#pressModal .data-table th:nth-child(1),
#pressModal .data-table td:nth-child(1) {
  max-width: 260px;
  white-space: normal;
}

#pressModal .data-table th:nth-child(2),
#pressModal .data-table th:nth-child(3),
#pressModal .data-table td:nth-child(2),
#pressModal .data-table td:nth-child(3),
#pressModal .data-table th:nth-child(4),
#pressModal .data-table td:nth-child(4) {
  width: 110px;
  text-align: right;
}

#pressModal input[type="number"] {
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
}

/* Packing modal: same compact box as Press / QC */
#packingModal .modal-content {
  max-width: 520px !important;
}

#packingModal .table-responsive {
  overflow-x: visible;
}

#packingModal .data-table {
  width: auto;
  min-width: 0;
}

#packingModal .data-table th:nth-child(1),
#packingModal .data-table td:nth-child(1) {
  max-width: 260px;
  white-space: normal;
}

#packingModal .data-table th:nth-child(2),
#packingModal .data-table th:nth-child(3),
#packingModal .data-table td:nth-child(2),
#packingModal .data-table td:nth-child(3),
#packingModal .data-table th:nth-child(4),
#packingModal .data-table td:nth-child(4) {
  width: 110px;
  text-align: right;
}

#packingModal input[type="number"] {
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
}

/* Production Issue flow (panel top) */
.prod-flow {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f5f7fb;
  border: 1px solid #e0e4f0;
}
.prod-flow-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.prod-flow-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-dark);
}
.prod-flow-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-red);
}
.prod-flow-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding-top: 8px;
}
.prod-flow-steps::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 8px;
  right: 8px;
  height: 3px;
  background: #dde1ee;
  border-radius: 999px;
}
.prod-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.prod-step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary-red);
}
.prod-step-text {
  margin-top: 6px;
  font-size: 11px;
  color: var(--gray-dark);
  text-align: center;
}

/* ========== Login Page ========== */
.login-page { background: linear-gradient(135deg, var(--black-dark) 0%, var(--black-medium) 50%, var(--primary-red-dark) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-wrapper { width: 100%; max-width: 420px; }
.login-box { background: var(--white); border-radius: var(--border-radius-lg); box-shadow: 0 25px 50px rgba(0,0,0,0.4); padding: 40px; }
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { max-width: 180px; max-height: 50px; margin-bottom: 8px; }
.login-title { font-size: 28px; font-weight: 700; color: var(--black-dark); margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--gray-medium); }
.login-desc { font-size: 12px; color: var(--gray-light); margin-top: 6px; }
.login-form .form-group { margin-bottom: 18px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-block:hover { transform: none; }

/* ========== Login Page - New Design (Reference Style) ========== */
.login-page-new {
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #2d3748;
  position: relative;
}
.login-page-new::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35);
  pointer-events: none;
  z-index: 1;
}
.login-page-new:not([style*="background-image"])::before {
  background: transparent;
}
.login-page-new:not([style*="background-image"]) {
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #4a5568 100%);
}
.login-top-banner {
  background: linear-gradient(90deg, #2d3748 0%, #1a202c 100%);
  padding: 14px 28px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  position: relative;
  z-index: 20;
}
.login-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.login-banner-logo { height: 42px; width: auto; }
.login-banner-logo-placeholder {
  width: 42px; height: 42px;
  background: #f97316;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.login-banner-text { display: flex; flex-direction: column; gap: 2px; }
.login-banner-title { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.login-banner-subtitle { font-size: 12px; color: rgba(255,255,255,0.85); letter-spacing: 0.3px; }
/* New split layout */
.login-wrapper-new {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 450px;
  position: relative;
  z-index: 10;
}
.login-box-new {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 16px;
  padding: 40px 44px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.08);
}
.login-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-modal-logo { height: 70px; width: auto; }
.login-modal-logo-placeholder {
  width: 44px; height: 44px;
  background: #f97316;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.login-modal-header-center {
  justify-content: center;
}
.login-modal-brand { font-size: 26px; font-weight: 700; color: #f97316; }
.login-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 6px;
  text-align: center;
}
.login-modal-welcome {
  font-size: 13px;
  color: #4a5568;
  margin-bottom: 24px;
  text-align: center;
}
.login-form-new .form-group-new { margin-bottom: 18px; }
.login-form-new label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 6px;
}
.input-with-icon {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.input-with-icon .input-icon {
  padding: 0 14px;
  font-size: 16px;
  color: #a0aec0;
}
.input-with-icon input {
  flex: 1;
  border: none;
  padding: 14px 16px 14px 0;
  font-size: 15px;
  outline: none;
}
.input-with-icon input::placeholder { color: #cbd5e0; }
.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.login-remember {
  font-size: 13px;
  color: #4a5568;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-remember input { width: 16px; height: 16px; cursor: pointer; }
.login-forgot {
  font-size: 13px;
  color: #f97316;
  text-decoration: none;
}
.login-forgot:hover { text-decoration: underline; }
.btn-login-new {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: #f97316;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-login-new:hover { background: #ea580c; }
.login-legal-links {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: #64748b;
}
.login-legal-links a {
  color: #c41230;
  text-decoration: none;
  font-weight: 600;
}
.login-legal-links a:hover { text-decoration: underline; }
.login-legal-sep { margin: 0 8px; color: #94a3b8; }
.login-request {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: #4a5568;
}
.login-request a { color: #f97316; text-decoration: none; }
.login-request a:hover { text-decoration: underline; }
.login-developed {
  margin-top: 6px;
  font-size: 11px;
  color: #2d3748;
  text-align: center;
}
.login-alert {
  margin-bottom: 16px;
  padding: 10px 14px;
  font-size: 13px;
}

/* Sidebar footer user */
.logged-user { padding: 12px 16px; margin-bottom: 8px; background: rgba(255,255,255,0.05); border-radius: var(--border-radius); }
.user-label { display: block; color: rgba(255,255,255,0.9); font-size: 12px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-link { font-size: 12px; color: var(--primary-red-light); text-decoration: none; }
.logout-link:hover { text-decoration: underline; }

.sidebar-developed {
  margin-top: 8px;
  font-size: 11px;
  color: #ffffff;
  text-align: center;
  opacity: 0.9;
}

/* User Management */
.role-badge { padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.role-badge.admin { background: rgba(196,30,58,0.2); color: var(--primary-red-dark); }
.role-badge.user { background: rgba(0,0,0,0.1); color: var(--black-medium); }
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.text-muted { color: var(--gray-light); font-size: 12px; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: var(--white); padding: 24px; border-radius: var(--border-radius-lg); max-width: 400px; width: 90%; box-shadow: var(--shadow-hover); }
.modal-content h3 { margin-bottom: 12px; }
.modal-content p { margin-bottom: 16px; color: var(--gray-medium); }

.inward-modal { max-width: 560px; max-height: 85vh; display: flex; flex-direction: column; }
.inward-modal .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; background: linear-gradient(135deg, var(--black-dark), var(--black-medium)); color: #fff; border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; }
.inward-modal .modal-header h3 { margin: 0; font-size: 16px; }
.inward-modal .modal-body { padding: 20px; overflow-y: auto; max-height: 60vh; }

.add-item-modal {
  max-width: 520px !important;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
}
.add-item-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--black-dark), var(--black-medium));
  color: #fff;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  flex-shrink: 0;
}
.add-item-modal .modal-header h3 { margin: 0; font-size: 16px; }
.add-item-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.add-item-modal .modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #eee;
  background: #f9f9f9;
  flex-shrink: 0;
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.item-thumb { max-width: 50px; max-height: 50px; object-fit: contain; border-radius: 4px; }
.img-cell .no-img { color: var(--gray-medium); font-size: 12px; }

.image-upload-group { margin-bottom: 20px; }
.image-upload-box {
  position: relative;
  border: 2px dashed #c00;
  border-radius: 8px;
  padding: 20px;
  background: #fff5f5;
  text-align: center;
}
.image-upload-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.image-upload-label {
  display: block;
  cursor: pointer;
  margin: 0;
}
.upload-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.upload-text { color: #c00; font-weight: 600; font-size: 14px; }
/* Under Construction */
.under-construction-card {
  max-width: 480px;
  margin: 60px auto;
  padding: 48px 32px;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
  border: 2px dashed var(--gray-light);
}
.uc-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.8; }
.under-construction-card h2 { color: var(--primary-red); margin-bottom: 12px; font-size: 24px; }
.under-construction-card p { color: var(--gray-medium); margin-bottom: 24px; line-height: 1.6; }

.details-modal {
  max-width: 480px !important;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
}
.details-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--black-dark), var(--black-medium));
  color: #fff;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  flex-shrink: 0;
}
.details-modal .modal-header h3 { margin: 0; font-size: 16px; }
.details-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
  flex: 1;
  min-height: 0;
}
.details-popup-grid { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  gap: 16px;
}
.detail-row:last-child { border-bottom: none; }
.details-modal .detail-row { align-items: flex-start; }
.details-modal .detail-value { font-size: 14px; color: var(--black-medium); word-wrap: break-word; }
.detail-label { font-weight: 600; color: var(--gray-medium); font-size: 12px; text-transform: uppercase; min-width: 120px; flex-shrink: 0; }
.detail-value { font-size: 14px; color: var(--black-medium); }
.details-modal-wide { max-width: 860px !important; }
.inward-card { padding: 16px; margin-bottom: 12px; background: #f8f8f8; border-radius: var(--border-radius); border-left: 4px solid var(--primary-red); }
.inward-card:last-child { margin-bottom: 0; }
.inward-card-head { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--gray-medium); }
.inward-card-head .inv-qty { font-weight: 600; color: var(--black-medium); }
.inward-card-head .inv-by { margin-left: auto; }
.inward-card-detail { font-size: 13px; color: var(--black-medium); line-height: 1.5; }
.inv-detail-line { margin-bottom: 4px; }
.inv-detail-line:last-child { margin-bottom: 0; }
.no-inward-msg { text-align: center; padding: 40px; color: var(--gray-medium); }

/* Product Material Page */
.product-material-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
}

@media (max-width: 1100px) {
  .product-material-grid { grid-template-columns: 1fr; }
}

.product-list { display: flex; flex-direction: column; gap: 16px; }

.product-card {
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  padding: 16px;
  background: #fafafa;
}

.product-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8e8e8;
}

.product-head-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.product-card-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.product-card-left {
  flex: 1;
  min-width: 0;
}

.product-card-right {
  width: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mp-photo-empty {
  width: 140px;
  height: 140px;
  border-radius: 14px;
  border: 1px dashed rgba(0,0,0,0.22);
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-medium);
  font-size: 12px;
}

.mp-qty {
  width: 110px;
  min-width: 110px;
  flex: 0 0 auto;
}

.mp-cost {
  width: 120px;
  min-width: 120px;
  flex: 0 0 auto;
}

.product-card-head strong { color: var(--primary-red); font-size: 14px; }
.product-card-head span { color: var(--black-medium); }
.product-size { color: var(--gray-medium); font-size: 12px; }

.product-materials { margin-bottom: 10px; }
.material-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #fff;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 13px;
  gap: 8px;
}

.material-row span:first-child { flex: 1; }
.mat-rate, .mat-line {
  font-size: 12px;
  color: var(--gray-medium);
  white-space: nowrap;
}
.mat-line {
  color: var(--black-medium);
  font-weight: 600;
}
.material-actions { display: flex; gap: 4px; }
.inline-form { display: inline; margin: 0; }
.btn-icon-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon-sm:hover { background: var(--off-white); }
.btn-edit-mat:hover { border-color: var(--primary-red); color: var(--primary-red); }
.btn-del:hover { border-color: var(--primary-red); color: var(--primary-red); }

.empty-mat { font-size: 12px; color: var(--gray-light); padding: 8px 0; }
.empty-state-p { padding: 20px; color: var(--gray-medium); text-align: center; }

.form-row-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.form-row-inline input[type="text"],
.form-row-inline input[type="number"] {
  flex: 1;
  min-width: 100px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.form-row-inline select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  min-width: 90px;
}

.cost-summary {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 13px;
}
.cost-summary strong { color: var(--primary-red-dark); }

.cost-stages {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cost-stages span {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #eee;
  color: var(--gray-medium);
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 680px) {
  .form-row.two-col { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .product-card-body { flex-direction: column-reverse; }
  .product-card-right { width: 100%; justify-content: flex-start; }
  .mp-photo-thumb, .mp-photo-empty { width: 120px; height: 120px; }
}

.calculator-section .calculator-form { margin-bottom: 20px; }
.calc-result { margin-top: 20px; }
.calc-result h4 { margin-bottom: 12px; font-size: 16px; }
.calc-table { min-width: 100% !important; }

/* Category page */
.category-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.category-toolbar-search .category-search-input {
  min-width: 200px;
  max-width: min(320px, 86vw);
  padding: 8px 12px;
  font-size: 14px;
}
.category-search-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.category-no-results {
  text-align: center;
  padding: 24px 16px;
  color: var(--gray-medium);
  font-size: 15px;
  margin-top: 8px;
}
.category-page { padding: 24px 30px; }
.category-empty {
  text-align: center;
  padding: 60px 40px;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  border: 2px dashed #e0e0e0;
}
.category-empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }
.category-empty h3 { font-size: 22px; color: var(--black-dark); margin-bottom: 8px; }
.category-empty p { color: var(--gray-medium); margin-bottom: 24px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}
.category-card-new {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #e8e8e8;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.category-card-new:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.cat-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
  border-bottom: 1px solid #eee;
}
.cat-icon { font-size: 32px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: rgba(196,30,58,0.1); border-radius: 12px; }
.cat-info { flex: 1; min-width: 0; }
.cat-info h3 { font-size: 17px; font-weight: 700; color: var(--black-dark); margin: 0 0 2px 0; }
.cat-code { font-size: 12px; color: var(--primary-red); font-weight: 600; }
.cat-field-count { font-size: 12px; color: var(--gray-medium); background: #f0f0f0; padding: 4px 10px; border-radius: 20px; }
.cat-fields-box { padding: 18px 20px; }
.cat-no-fields { font-size: 13px; color: var(--gray-light); margin: 0 0 12px 0; }
.cat-field-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.field-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  color: var(--black-medium);
  border: 1px solid #e8e8e8;
}
.tag-label { font-weight: 500; }
.tag-req-badge { font-size: 10px; padding: 2px 6px; background: rgba(196,30,58,0.15); color: var(--primary-red); border-radius: 4px; font-weight: 600; }
.tag-del-form { display: inline-flex; margin: 0; padding: 0; align-items: center; vertical-align: middle; }
.tag-remove {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  margin: -2px 0 -2px 2px;
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.tag-remove:hover { color: var(--primary-red); background: rgba(196,30,58,0.08); }
.cat-add-field { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #e0e0e0; }
.add-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.add-field-row input[type="text"] { flex: 1; min-width: 90px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; }
.add-field-row input[type="text"]:focus { outline: none; border-color: var(--primary-red); box-shadow: 0 0 0 2px rgba(196,30,58,0.15); }
.add-field-row .field-type-select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; min-width: 100px; }
.add-field-row .field-options-input { flex: 1; min-width: 160px; }
.tag-type-badge { font-size: 10px; color: #666; background: #f0f0f0; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }
.req-checkbox { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: normal; color: var(--gray-medium); white-space: nowrap; }
.req-checkbox input { width: auto; }
.btn-add-field {
  padding: 8px 16px;
  background: var(--primary-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add-field:hover { background: var(--primary-red-dark); }
.category-list { display: flex; flex-direction: column; gap: 16px; }
.category-card { background: var(--white); border-radius: var(--border-radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid #e8e8e8; }
.category-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.category-head strong { color: var(--primary-red); font-size: 14px; }
.category-head span { color: var(--black-medium); }
.category-fields { margin-bottom: 12px; }
.field-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--off-white); border-radius: 4px; margin-bottom: 6px; font-size: 13px; }
.field-row span:first-child { flex: 1; }
.req-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--gray-light); color: #fff; }
.empty-fields { font-size: 12px; color: var(--gray-light); padding: 8px 0; margin-bottom: 12px; }
.add-field-form .form-row-inline { margin-top: 8px; }
.req-check { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: normal; }
.req-check input { width: auto; }

/* Dynamic category fields container */
.form-hint { font-size: 12px; color: var(--gray-medium); margin-top: 6px; }
.added-by-show { font-size: 13px; color: var(--gray-medium); margin: 16px 0 8px; padding: 0; }
.category-fields-container { margin: 16px 0; }
.category-fields-container:not(:empty) {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}
.category-fields-container .form-group { margin-bottom: 14px; }
.category-fields-container .form-group:last-child { margin-bottom: 0; }
.category-fields-container input, .category-fields-container select { width: 100%; }
.details-cell { max-width: 200px; }
.detail-tag { display: inline-block; margin-right: 6px; margin-bottom: 4px; font-size: 12px; }

/* Purchase View Page */
.po-view-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid #e8e8e8;
  max-width: 900px;
  margin: 0 auto;
}
.po-view-company-header { border-bottom: 2px solid var(--primary-red); padding-bottom: 12px; margin-bottom: 16px; display: flex; align-items: center; gap: 20px; }
.po-view-company-header .po-logo { flex-shrink: 0; }
.po-view-company-header .po-logo img { height: 70px; width: auto; display: block; }
.po-view-company-header .po-company-info { flex: 1; text-align: center; }
.po-view-company-header .company-name { font-size: 28px; font-weight: bold; color: var(--primary-red); }
.po-view-company-header .company-tagline { font-size: 11px; color: #666; margin-top: 4px; }
.po-view-company-header .company-addr { font-size: 12px; margin-top: 8px; }
.po-info-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 20px; }
.po-info-table { border: 1px solid #ccc; border-collapse: collapse; font-size: 12px; }
.po-info-table th, .po-info-table td { border: 1px solid #ccc; padding: 10px 12px; text-align: left; vertical-align: top; }
.po-info-table thead th { background: #f0f0f0; font-weight: 600; color: var(--primary-red); font-size: 13px; }
.po-info-table .info-label { width: 120px; font-weight: 600; color: #555; background: #f9f9f9; }
.po-info-table .info-value { font-size: 12px; }
@media (max-width: 768px) { .po-info-tables { grid-template-columns: 1fr; } }
.po-tc-table { width: 100%; margin-bottom: 20px; }
.po-tc-table thead th { text-align: left; }
.po-addr-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 20px; }
.po-addr-table .info-label { width: 90px; }
@media (max-width: 768px) { .po-addr-tables { grid-template-columns: 1fr; } }
.po-view-card .two-col { display: flex; gap: 32px; margin-bottom: 20px; flex-wrap: wrap; }
.po-view-card .col { flex: 1; min-width: 200px; }
.po-view-card .label { font-size: 11px; color: #666; text-transform: uppercase; margin-bottom: 4px; }
.po-view-card .value { font-size: 13px; }
.po-view-card .po-meta { text-align: right; }
.po-view-card .po-meta .po-number { font-size: 18px; font-weight: bold; color: var(--primary-red); }
.po-view-card table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
.po-view-card th, .po-view-card td { border: 1px solid #e0e0e0; padding: 10px 12px; text-align: left; }
.po-view-card th { background: #f5f5f5; font-size: 11px; text-transform: uppercase; font-weight: 600; }
.po-view-card .text-right { text-align: right; }
.po-view-card .tc-section { margin: 16px 0; font-size: 12px; padding: 12px; background: #fafafa; border-radius: 6px; }
.po-view-card .addr-section { margin: 8px 0; font-size: 12px; white-space: pre-line; }
.po-view-card .totals { margin-left: auto; width: 280px; border: none !important; }
.po-view-card .totals tr { border: none; }
.po-view-card .totals td { border: none; padding: 6px 8px; }
.po-view-card .grand-total { font-size: 15px; font-weight: bold; color: var(--primary-red); }
.po-view-card .sign-row { margin-top: 32px; display: flex; gap: 60px; padding-top: 16px; border-top: 1px solid #eee; }
.po-view-card .sign-box { flex: 1; }
.po-view-card .sign-label { font-size: 11px; color: #666; border-top: 1px solid #333; padding-top: 6px; margin-top: 40px; }
.btn-print-po { padding: 10px 20px; background: var(--primary-red); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn-print-po:hover { background: #a01830; }
@media print {
  .sidebar, .sidebar-toggle, .no-print { display: none !important; }
  .app-wrapper { display: block !important; overflow: visible !important; height: auto !important; }
  .main-content { margin-left: 0 !important; width: 100% !important; overflow: visible !important; height: auto !important; min-height: auto !important; }
  .dashboard-content, .scrollable-main { overflow: visible !important; height: auto !important; min-height: auto !important; max-height: none !important; }
  .dashboard-content { padding: 0 10px !important; margin: 0 !important; }
  .po-view-card { box-shadow: none; border: none; padding: 0; max-width: 100%; }
  body, html { padding: 0; margin: 0; background: #fff !important; overflow: visible !important; height: auto !important; }
  .po-view-card table { break-inside: auto; }
}

/* ========== Dashboard Dark Theme ========== */
body.dashboard-dark .main-content.dashboard-main {
  background: #1e293b;
}
body.dashboard-dark .dashboard-content-dark {
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}
.header-dark {
  background: #0f172a !important;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.header-dark .header-left h1 {
  color: #fff !important;
  font-size: 20px;
}
.header-dark .header-left p {
  color: #94a3b8;
  font-size: 12px;
}
.header-search-dark {
  background: rgba(255,255,255,0.08) !important;
}
.header-search-dark input {
  color: #e2e8f0;
}
.header-search-dark input::placeholder {
  color: #64748b;
}
.header-btn-dark {
  background: rgba(255,255,255,0.08) !important;
  color: #94a3b8;
}
.header-btn-dark:hover {
  background: rgba(249,115,22,0.3) !important;
  color: #f97316;
}
.notif-btn { position: relative; }
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #0f172a;
}
.user-profile-dropdown {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  margin-left: 8px;
}
.user-avatar-dark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.user-name { font-size: 14px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: #94a3b8; }
.dashboard-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr 320px;
  gap: 24px;
  margin-bottom: 24px;
}
.dashboard-widget {
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}
.widget-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.widget-header h3 {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin: 0;
}
.widget-sub {
  font-size: 11px;
  color: #64748b;
  margin-left: auto;
}
.widget-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.widget-btn {
  padding: 4px 12px;
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
}
.widget-menu {
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
}
.widget-link {
  font-size: 12px;
  color: #f97316;
  text-decoration: none;
  font-weight: 600;
}
.widget-link:hover { color: #fb923c; text-decoration: underline; }
.widget-body {
  padding: 20px;
  min-height: 180px;
}
.widget-body-center { display: flex; justify-content: center; align-items: center; }
.widget-list .widget-body { padding: 0; min-height: 200px; }
.top-items-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.top-item:last-child { border-bottom: none; }
.top-item.empty {
  padding: 30px;
  color: #64748b;
  justify-content: center;
}
.item-icon { font-size: 20px; }
.item-detail { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.item-name { color: #e2e8f0; font-weight: 500; }
.item-meta { font-size: 11px; color: #64748b; }
.item-stock {
  font-weight: 700;
  color: #22c55e;
  font-family: monospace;
}
.item-stock.low { color: #f97316; }
.item-status {
  font-size: 11px;
  color: #64748b;
  padding: 4px 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
}
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.metric-card {
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px;
}
.metric-title {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}
.metric-unit { font-size: 14px; font-weight: 500; color: #64748b; }
.metric-trend {
  font-size: 12px;
  margin-top: 6px;
  color: #22c55e;
}
.metric-trend.up::before {
  content: '✓ ';
}
.widget-wide { grid-column: span 2; }
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.activity-table th,
.activity-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.activity-table th {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.activity-table td { color: #e2e8f0; }
.empty-cell { text-align: center; color: #64748b; padding: 30px !important; }
.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-po { background: rgba(59,130,246,0.3); color: #60a5fa; }
.badge-inward { background: rgba(34,197,94,0.3); color: #4ade80; }
@media (max-width: 1200px) {
  .dashboard-grid-row { grid-template-columns: 1fr 1fr; }
  .widget-wide { grid-column: span 2; }
}
@media (max-width: 992px) {
  .dashboard-metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid-row { grid-template-columns: 1fr; }
  .widget-wide { grid-column: span 1; }
}
@media (max-width: 576px) {
  .dashboard-metrics { grid-template-columns: 1fr; }
  .user-info { display: none; }
  .category-grid { grid-template-columns: 1fr; }
  .add-field-row { flex-direction: column; align-items: stretch; }
}

/* Mobile Responsive */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .header-search {
    display: none;
  }
  
  .dashboard-content {
    padding: 16px;
  }
}

/* ========== Material Requisition (list / form / view) — responsive ========== */

main.mrf-list-page {
  overflow-x: hidden;
}
@supports (overflow-x: clip) {
  main.mrf-list-page {
    overflow-x: clip;
  }
}

/* MRF list — header search + export */
.mrf-page-header-list.header {
  height: auto;
  min-height: var(--header-height);
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
  z-index: 110;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.mrf-page-header-list .mrf-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  flex: 1;
  min-width: 0;
}
.mrf-page-header-list .mrf-header-title {
  margin: 0;
  line-height: 1.25;
  flex-shrink: 0;
  align-self: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--black-dark);
}
.mrf-page-header-list .mrf-header-toolbar {
  flex: 1 1 260px;
  min-width: min(100%, 200px);
  margin: 0;
  padding: 10px 14px;
  position: relative;
  z-index: 5;
}
.mrf-page-header-list .mrf-header-toolbar .stock-alerts-search-wrap {
  flex: 1 1 180px;
  min-width: 0;
  z-index: 6;
}
.mrf-page-header-list .mrf-header-toolbar .stock-alerts-label {
  margin-bottom: 4px;
}
.mrf-page-header-list .mrf-header-toolbar .stock-alerts-search-input {
  max-width: none;
  width: 100%;
}

@media (max-width: 720px) {
  .mrf-page-header-list .mrf-header-left {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .mrf-page-header-list .mrf-header-toolbar {
    flex: 1 1 auto;
    width: 100%;
  }
  .mrf-page-header-list .mrf-header-title {
    align-self: flex-start;
  }
}

/* Page headers: stack on narrow screens, no horizontal spill */
.mrf-list-page .dashboard-content,
.mrf-form-page .dashboard-content,
.mrf-view-page .dashboard-content {
  min-width: 0;
}

@media (max-width: 767px) {
  .mrf-page-header.header {
    height: auto;
    min-height: var(--header-height);
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 12px 16px;
    row-gap: 12px;
  }
  .mrf-page-header .header-left {
    flex: 1 1 100%;
    min-width: 0;
  }
  .mrf-page-header .header-left h1 {
    font-size: 17px;
    line-height: 1.25;
    word-break: break-word;
  }
  .mrf-page-header .header-left p {
    font-size: 11px;
  }
  .mrf-page-header .header-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  .mrf-page-header .header-right .btn {
    flex: 1 1 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* List: desktop table */
.material-requisition-list .table-responsive {
  padding-right: 0;
}
.material-requisition-list .data-table.mrf-list-table {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  table-layout: auto;
}
@media (min-width: 768px) {
  .material-requisition-list .data-table.mrf-list-table {
    min-width: 680px;
  }
}
.material-requisition-list .mrf-list-table td {
  word-break: break-word;
  vertical-align: middle;
}
.material-requisition-list .mrf-list-table .mrf-list-actions {
  white-space: normal;
  max-width: none;
  overflow: visible;
}
.material-requisition-list .mrf-list-table .mrf-list-actions .btn-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* List: mobile = stacked cards (no sideways scroll) */
@media (max-width: 767px) {
  .material-requisition-list .mrf-list-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }
  .material-requisition-list .mrf-list-table tbody tr {
    display: block;
    margin-bottom: 14px;
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 4px 14px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }
  .material-requisition-list .mrf-list-table tbody td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
  }
  .material-requisition-list .mrf-list-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 4px;
  }
  .material-requisition-list .mrf-list-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--gray-medium);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 0 0 100%;
    margin-bottom: 2px;
  }
  .material-requisition-list .mrf-list-table td.empty-state {
    display: block;
    text-align: center;
    padding: 28px 16px;
  }
  .material-requisition-list .mrf-list-table td.empty-state::before {
    display: none;
  }
  .material-requisition-list .mrf-list-table td.mrf-list-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .material-requisition-list .mrf-list-table td.mrf-list-actions .btn-action {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    box-sizing: border-box;
  }
  .material-requisition-list .mrf-list-table td.mrf-list-actions form {
    display: block;
    width: 100%;
  }
  .material-requisition-list .mrf-list-table td.mrf-list-actions form .btn-action {
    width: 100%;
  }
  .material-requisition-list .section-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .material-requisition-list.dashboard-section {
    padding: 16px;
  }
}

/* Material Requisition — data entry form */
.mrf-form-page .mrf-section {
  margin-bottom: 20px;
}
.mrf-header-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 14px 20px;
}
@media (max-width: 767px) {
  .mrf-form-page .mrf-section .section-header {
    flex-direction: column;
    align-items: stretch !important;
  }
  .mrf-form-page .mrf-section .section-header .mrf-add-row-btn {
    width: 100%;
    min-height: 44px;
  }
  .mrf-form-page .mrf-submit-row .btn-lg {
    width: 100%;
    min-height: 48px;
  }
  .mrf-add-row-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .mrf-add-row-bar .mrf-add-row-btn {
    width: 100%;
    min-height: 44px;
  }
  .mrf-add-row-bar .form-hint {
    margin: 8px 0 0 0 !important;
  }
}
/* Override global .table-responsive { width: max-content } — that widens the wrapper past the viewport
   so .dashboard-content's overflow-x: hidden clips columns with no way to scroll. */
.mrf-form-page .mrf-lines-wrap.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  padding-right: 0;
  border: 1px solid #e8e8e8;
  border-radius: var(--border-radius);
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-red) #e8e8e8;
}
.mrf-lines-table {
  min-width: 1100px;
  width: max-content;
  font-size: 13px;
}
.mrf-lines-table .form-control-sm {
  padding: 4px 8px;
  font-size: 12px;
}
.mrf-lines-table td {
  vertical-align: middle;
}
.mrf-add-row-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}
.mrf-submit-row {
  margin-top: 24px;
  margin-bottom: 40px;
}
.mrf-view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* MRF document on screen (view page) */
.mrf-view-page .mrf-view-card {
  padding: 16px;
  min-width: 0;
}
.mrf-view-card .mrf-doc {
  font-family: Arial, sans-serif;
  font-size: 11px;
  color: #1a1a1a;
  max-width: 1000px;
  margin: 0 auto;
  background: #fff;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-sizing: border-box;
}
.mrf-view-card .mrf-banner-red {
  background: #c41230;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: clamp(11px, 2.8vw, 15px);
  padding: 10px 8px;
  letter-spacing: 0.02em;
  line-height: 1.3;
  word-break: break-word;
}
.mrf-view-card .mrf-banner-gray {
  background: #4a4a4a;
  color: #fff;
  text-align: center;
  font-size: clamp(9px, 2.2vw, 10px);
  padding: 8px 6px;
  line-height: 1.45;
  word-break: break-word;
}
.mrf-view-card .mrf-doc-title {
  text-align: center;
  font-size: clamp(13px, 3vw, 15px);
  margin: 14px 0 12px;
  font-weight: 700;
}
.mrf-view-card .mrf-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.mrf-view-card .mrf-meta-cell {
  width: 50%;
  vertical-align: top;
  padding: 4px;
}
.mrf-view-card .mrf-kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.mrf-view-card .mrf-kv th {
  text-align: left;
  padding: 6px 8px;
  background: #f3f4f6;
  border: 1px solid #ddd;
  width: 42%;
}
.mrf-view-card .mrf-kv td {
  padding: 6px 8px;
  border: 1px solid #ddd;
  word-break: break-word;
}
.mrf-view-card .mrf-items-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  border: 1px solid #eee;
  border-radius: 6px;
}
.mrf-view-card .mrf-items-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}
.mrf-view-card .mrf-items-table th,
.mrf-view-card .mrf-items-table td {
  border: 1px solid #333;
  padding: 5px 4px;
  vertical-align: top;
}
.mrf-view-card .mrf-items-table thead th {
  background: #e8e8e8;
  font-weight: 700;
  text-align: center;
}
.mrf-view-card .mrf-items-table .c-sno {
  width: 28px;
  text-align: center;
}
.mrf-view-card .mrf-items-table .c-num {
  text-align: right;
  white-space: nowrap;
}
.mrf-view-card .mrf-items-table .c-tc {
  width: 36px;
  text-align: center;
}
.mrf-view-card .mrf-signatures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid #333;
}
.mrf-view-card .mrf-sign-box {
  min-height: 72px;
  font-size: 10px;
  word-break: break-word;
}
.mrf-view-card .mrf-sign-label {
  font-weight: 700;
  margin-bottom: 20px;
}
.mrf-view-card .mrf-sign-name {
  font-weight: 600;
}
.mrf-view-card .mrf-sign-title {
  color: #555;
  margin-top: 4px;
}

@media (max-width: 767px) {
  .mrf-view-page .mrf-view-card {
    padding: 12px;
  }
  .mrf-view-card .mrf-meta-table,
  .mrf-view-card .mrf-meta-table tbody,
  .mrf-view-card .mrf-meta-table tr,
  .mrf-view-card .mrf-meta-cell {
    display: block;
    width: 100%;
  }
  .mrf-view-card .mrf-meta-cell {
    padding: 0 0 8px 0;
  }
  .mrf-view-card .mrf-signatures {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .mrf-view-card .mrf-sign-box {
    min-height: 64px;
  }
}
@media (max-width: 400px) {
  .mrf-view-card .mrf-signatures {
    grid-template-columns: 1fr;
  }
}

.btn-danger-text {
  background: transparent;
  border: none;
  color: #b91c1c;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
}
