/* ========================================================
   STOCKFLOW | MODULE STYLES (TASK PULSE INVENTORY REDESIGN)
   ======================================================== */

/* ========================================================
   1. DASHBOARD ROW 1: 4 KPI CARDS (TASK PULSE FIDELITY)
   ======================================================== */
.kpi-row-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

@media (max-width: 1200px) {
  .kpi-row-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-row-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-pulse-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

/* Large circular icon badge on the left (Task Pulse style) */
.kpi-circle-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-circle-icon.icon-orange {
  background-color: var(--color-primary-soft);
  color: var(--color-primary);
}

.kpi-circle-icon.icon-coral {
  background-color: #FFE4E6;
  color: #F43F5E;
}

.kpi-circle-icon.icon-amber {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
}

.kpi-circle-icon.icon-purple {
  background-color: var(--color-purple-soft);
  color: var(--color-purple);
}

.kpi-info-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.kpi-info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.kpi-info-main {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.kpi-info-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.kpi-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.kpi-trend-pill.trend-up {
  color: var(--color-success);
  background-color: var(--color-success-soft);
}

.kpi-trend-pill.trend-down {
  color: var(--color-danger);
  background-color: var(--color-danger-soft);
}

.kpi-trend-pill.trend-neutral {
  color: var(--color-primary);
  background-color: var(--color-primary-soft);
}

.kpi-info-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================================
   2. DASHBOARD ROW 2: SPLINE CHART (65%) + DUE SOON (35%)
   ======================================================== */
.dash-row-overview {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

@media (max-width: 1024px) {
  .dash-row-overview {
    grid-template-columns: 1fr;
  }
}

.chart-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.chart-legend-dots {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-right: 5px;
}

.chart-spline-container {
  width: 100%;
  height: 250px;
  position: relative;
}

/* Due Soon / Important Alerts List */
.due-soon-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.due-soon-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.due-soon-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.due-soon-item:hover {
  background-color: rgba(248, 250, 252, 0.6);
}

.due-soon-circle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.due-soon-circle.due-coral {
  background-color: #FFE4E6;
  color: #F43F5E;
}

.due-soon-circle.due-green {
  background-color: var(--color-success-soft);
  color: var(--color-success);
}

.due-soon-circle.due-amber {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
}

.due-soon-circle.due-blue {
  background-color: var(--color-info-soft);
  color: var(--color-info);
}

.due-soon-details {
  flex: 1;
  overflow: hidden;
}

.due-soon-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.due-soon-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.due-soon-date-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  background-color: var(--color-primary-soft);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ========================================================
   3. DASHBOARD ROW 3: TEAM MEMBERS (33%) + DONUT STATUS (34%) + RECENT ACTIVITY (33%)
   ======================================================== */
.dash-row-trio {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

@media (max-width: 1100px) {
  .dash-row-trio {
    grid-template-columns: 1fr;
  }
}

/* Panel 1: Team Members List */
.team-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.team-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.team-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
  background: linear-gradient(135deg, #64748B, #475569);
  overflow: hidden;
}

.team-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-info {
  flex: 1;
}

.team-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.team-role {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.team-status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
}

.status-online {
  background-color: var(--color-success-soft);
  color: var(--color-success-text);
}

.status-busy {
  background-color: var(--color-warning-soft);
  color: var(--color-warning-text);
}

.status-offline {
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
}

/* Panel 2: Task / Inventory Status Donut Chart */
.donut-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.donut-svg-wrap {
  width: 170px;
  height: 170px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-center-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.donut-center-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.donut-legend-grid {
  width: 100%;
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
}

.donut-legend-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
}

.donut-legend-pct {
  font-weight: 700;
  color: var(--text-primary);
}

/* Panel 3: Recent Activity Feed */
.recent-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.activity-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #FFFFFF;
  background: #3B82F6;
  margin-top: 2px;
}

.activity-details {
  flex: 1;
}

.activity-text {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

.activity-text strong {
  color: var(--text-primary);
}

.activity-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================================
   4. DASHBOARD ROW 4: OPERATIONAL KANBAN BOARD (4 COLUMNS)
   ======================================================== */
.dash-row-kanban {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
  margin-bottom: var(--space-6);
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.kanban-title-wrap {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.kanban-title {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.kanban-subtitle {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.kanban-columns-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1200px) {
  .kanban-columns-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kanban-columns-grid {
    grid-template-columns: 1fr;
  }
}

/* Individual Pastel Kanban Column */
.kanban-col {
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kanban-col.col-healthy {
  background-color: #F0FDF4;
  border: 1px solid #DCFCE7;
}

.kanban-col.col-low {
  background-color: #FEFCE8;
  border: 1px solid #FEF9C3;
}

.kanban-col.col-warning {
  background-color: #FFF7ED;
  border: 1px solid #FFEDD5;
}

.kanban-col.col-danger {
  background-color: #FEF2F2;
  border: 1px solid #FEE2E2;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.kanban-col-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kanban-col-count {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: 0 1px 3px rgba(20, 27, 52, 0.03);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}

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

.kanban-card-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.kanban-add-btn {
  height: 34px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  transition: all var(--transition-fast);
}

.kanban-add-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ========================================================
   5. SCANNER / DISPATCH STATION (LIGHT SLEEK THEME)
   ======================================================== */
.dispatch-station {
  display: grid;
  grid-template-columns: 1.1fr 1.9fr;
  gap: var(--space-6);
}

@media (max-width: 900px) {
  .dispatch-station {
    grid-template-columns: 1fr;
  }
}

.scanner-viewfinder-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.camera-preview-box {
  width: 100%;
  height: 270px;
  background: #0F172A;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video-elem {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-laser-line {
  position: absolute;
  top: 15%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--color-primary);
  box-shadow: 0 0 12px 2px var(--color-primary);
  animation: laser-scan 2s ease-in-out infinite alternate;
  z-index: 5;
}

@keyframes laser-scan {
  0% { top: 15%; }
  100% { top: 85%; }
}

.scanner-reticle {
  position: absolute;
  width: 170px;
  height: 170px;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 4;
}

.allocation-breakdown-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-4);
}

.allocation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.allocation-item.highlight {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.allocation-item:last-child {
  margin-bottom: 0;
}

/* ========================================================
   6. QR CODE LABEL & WORKSPACE
   ======================================================== */
.qr-workspace-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-6);
}

@media (max-width: 900px) {
  .qr-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.qr-label-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  min-height: 420px;
}

.thermal-label-mockup {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  width: 290px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  font-family: var(--font-family);
}

.thermal-label-brand {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.thermal-label-brand svg {
  color: var(--color-primary);
}

.thermal-label-qr {
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thermal-label-qr canvas,
.thermal-label-qr svg {
  max-width: 160px;
  height: auto;
}

.thermal-label-details {
  width: 100%;
  border-top: 1px dashed #CBD5E1;
  padding-top: 8px;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: left;
}

.thermal-label-row {
  display: flex;
  justify-content: space-between;
  line-height: 1.45;
}

.thermal-label-sku {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

/* ========================================================
   7. INVENTORY BATCH ACCORDION
   ======================================================== */
.batch-subrow {
  background-color: var(--bg-surface-alt);
}

.batch-subrow td {
  padding: var(--space-4) var(--space-6) !important;
}

.batch-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.batch-mini-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* ========================================================
   8. GUIDED PRESENTATION TOUR MODAL / CARD
   ======================================================== */
.tour-step-card {
  position: fixed;
  z-index: var(--z-tour);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: 0 20px 40px rgba(20, 27, 52, 0.18), 0 0 20px rgba(255, 87, 34, 0.2);
  max-width: 380px;
  width: calc(100% - 32px);
  transition: all var(--transition-normal);
}

.tour-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.tour-badge {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tour-step-title {
  font-size: var(--text-md);
  font-weight: 800;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.tour-step-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.tour-step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-pulse-anchor {
  position: relative;
}

.tour-pulse-anchor::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--color-primary);
  border-radius: inherit;
  animation: tour-glow 1.8s infinite;
  pointer-events: none;
}

@keyframes tour-glow {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.06); opacity: 0; }
}

/* ========================================================
   9. FIFO vs FEFO COMPARATOR PANEL
   ======================================================== */
.comparator-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-top: var(--space-6);
  box-shadow: var(--shadow-xs);
}

.comparator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-top: var(--space-4);
}

@media (max-width: 768px) {
  .comparator-grid {
    grid-template-columns: 1fr;
  }
}

.comparator-col {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
