/* 
 * Yarn & Fabric Inventory Management System - Global Stylesheet
 * Theme: Elegant Warm Editorial (Cream/Beige, Soft Shadows, Serif Headings, Organic Accents)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette - Elegant Warm Beige & Alabaster */
  --bg-base: #f7f5ef;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #f0ede4;
  
  --border-color: rgba(45, 38, 30, 0.08);
  --border-focus: #c2410c; /* Warm Terracotta */
  
  --text-primary: #292524; /* Warm Deep Slate */
  --text-secondary: #57534e; /* Warm Slate Gray */
  --text-muted: #8c857b;
  
  /* Brand/Page Specific Accent Colors */
  --accent-primary: #b45309; /* Warm Amber/Ochre */
  --accent-primary-rgb: 180, 83, 9;
  
  --accent-yarn: #c2410c; /* Terracotta Red-Orange */
  --accent-yarn-rgb: 194, 65, 12;
  
  --accent-fabric: #2d5a27; /* Rich Forest/Olive Green */
  --accent-fabric-rgb: 45, 90, 39;
  
  /* Status Colors */
  --color-in: #14532d; /* Forest green */
  --color-out: #991b1b; /* Rich Burgundy */
  --color-adj: #b45309; /* Ochre */
  --color-low: #d97706; /* Amber */
  
  /* Fonts & Shadows */
  --font-display: 'Lora', Georgia, serif;
  --font-sans: 'Outfit', 'Inter', sans-serif;
  
  /* Soft organic drop shadows */
  --shadow-sm: 0 2px 10px rgba(45, 38, 30, 0.03);
  --shadow-md: 0 10px 30px rgba(45, 38, 30, 0.06);
  --shadow-lg: 0 20px 50px rgba(45, 38, 30, 0.1);
  --shadow-glow-yarn: 0 0 20px rgba(194, 65, 12, 0.1);
  --shadow-glow-fabric: 0 0 20px rgba(45, 90, 39, 0.1);
  
  /* Layout Metrics */
  --sidebar-width: 260px;
  --header-height: 75px;
  --bottom-nav-height: 64px;
}

/* Reset and Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(45, 38, 30, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 38, 30, 0.2);
}

/* Typography Utility */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Application Layout Structure */
#app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar (Desktop Nav) */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  z-index: 10;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  padding: 0 4px;
}

.brand-logo {
  width: 36px;
  height: 36px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-style: italic;
  color: #1c1917;
  letter-spacing: -0.03em;
}

/* Navigation Links */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(45, 38, 30, 0.03);
  transform: translateX(2px);
}

.nav-item.active {
  color: #fff;
  background: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.15);
}

.nav-item.active svg {
  stroke: #ffffff;
  transform: scale(1.05);
}

/* Page accent rules for Sidebar */
.nav-item[data-page="yarns"].active {
  background: var(--accent-yarn);
  box-shadow: 0 4px 12px rgba(194, 65, 12, 0.15);
}
.nav-item[data-page="fabrics"].active {
  background: var(--accent-fabric);
  box-shadow: 0 4px 12px rgba(45, 90, 39, 0.15);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-indicator.connected {
  background: var(--color-in);
  box-shadow: 0 0 6px var(--color-in);
}

.status-indicator.disconnected {
  background: var(--color-out);
  box-shadow: 0 0 6px var(--color-out);
}

/* Bottom Nav (Mobile Navigation) */
#bottom-nav {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  justify-content: space-around;
  align-items: center;
  z-index: 10;
  padding: 0 8px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  gap: 4px;
  flex: 1;
  height: 100%;
}

.bottom-nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.bottom-nav-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.bottom-nav-item[data-page="dashboard"].active svg { stroke: var(--accent-primary); }
.bottom-nav-item[data-page="yarns"].active svg { stroke: var(--accent-yarn); }
.bottom-nav-item[data-page="fabrics"].active svg { stroke: var(--accent-fabric); }
.bottom-nav-item[data-page="history"].active svg { stroke: var(--text-primary); }
.bottom-nav-item[data-page="setup"].active svg { stroke: var(--text-primary); }

/* Main Content Wrapper */
#main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header Section */
#main-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--bg-surface);
}

.header-title-container h1 {
  font-size: 1.6rem;
  font-weight: 500;
  font-style: italic;
  color: #1c1917;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Button Styling (Classic organic look) */
.btn {
  background: var(--bg-surface);
  border: 1px solid #dcd8c9;
  color: var(--text-primary);
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  font-family: var(--font-sans);
}

.btn:hover {
  background: #faf9f6;
  border-color: #c4bfae;
  box-shadow: 0 2px 8px rgba(45, 38, 30, 0.05);
}

.btn-primary {
  background: var(--accent-primary);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.12);
}

.btn-primary:hover {
  background: #9a4005;
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(180, 83, 9, 0.2);
}

.btn-refresh svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Page Containers */
.page {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  display: none;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.page.active {
  display: block;
}

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

/* Dashboard Page Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

/* Elegant Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(45, 38, 30, 0.15);
}

/* Stat Cards Subtle Indicators */
.card-stat::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.card-stat.yarn::after { background: var(--accent-yarn); }
.card-stat.yarn:hover { border-color: rgba(194, 65, 12, 0.25); }

.card-stat.fabric::after { background: var(--accent-fabric); }
.card-stat.fabric:hover { border-color: rgba(45, 90, 39, 0.25); }

.card-stat.low-stock::after { background: var(--color-low); }
.card-stat.low-stock:hover { border-color: rgba(217, 119, 6, 0.25); }

.card-stat.total-stock::after { background: var(--accent-primary); }
.card-stat.total-stock:hover { border-color: rgba(180, 83, 9, 0.25); }

.card-stat.health::after { background: #10b981; }
.card-stat.health:hover { border-color: rgba(16, 185, 129, 0.25); }

.card-stat.active-sku::after { background: #6366f1; }
.card-stat.active-sku:hover { border-color: rgba(99, 102, 241, 0.25); }

.card-stat.net-flow::after { background: #ec4899; }
.card-stat.net-flow:hover { border-color: rgba(236, 72, 153, 0.25); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon-wrapper {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yarn .stat-icon-wrapper { background: rgba(194, 65, 12, 0.06); color: var(--accent-yarn); }
.fabric .stat-icon-wrapper { background: rgba(45, 90, 39, 0.06); color: var(--accent-fabric); }
.low-stock .stat-icon-wrapper { background: rgba(217, 119, 6, 0.06); color: var(--color-low); }
.total-stock .stat-icon-wrapper { background: rgba(180, 83, 9, 0.06); color: var(--accent-primary); }
.health .stat-icon-wrapper { background: rgba(16, 185, 129, 0.06); color: #10b981; }
.active-sku .stat-icon-wrapper { background: rgba(99, 102, 241, 0.06); color: #6366f1; }
.net-flow .stat-icon-wrapper { background: rgba(236, 72, 153, 0.06); color: #ec4899; }

.stat-icon-wrapper svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--font-sans);
  line-height: 1.1;
  margin-bottom: 4px;
  color: #1c1917;
}

.stat-subtext {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Dashboard Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.chart-card {
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

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

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select.select-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  font-style: italic;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1c1917;
}

.card-title svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  color: var(--text-muted);
}

.chart-container {
  flex-grow: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

/* Recent Activity Listing */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #fbfaf7;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  border-left: 3px solid transparent;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
}

.activity-item:hover {
  background: #f4f2e9;
}

.activity-item.in { border-left-color: var(--color-in); }
.activity-item.out { border-left-color: var(--color-out); }
.activity-item.adj { border-left-color: var(--color-adj); }

.activity-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.activity-sku {
  font-weight: 700;
  color: var(--text-primary);
}

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

.activity-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.activity-qty {
  font-weight: 700;
  font-size: 0.9rem;
}

.activity-item.in .activity-qty { color: var(--color-in); }
.activity-item.out .activity-qty { color: var(--color-out); }
.activity-item.adj .activity-qty { color: var(--color-adj); }

.activity-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.activity-item.in .activity-badge { background: rgba(20, 83, 45, 0.08); color: var(--color-in); }
.activity-item.out .activity-badge { background: rgba(153, 27, 27, 0.08); color: var(--color-out); }
.activity-item.adj .activity-badge { background: rgba(180, 83, 9, 0.08); color: var(--color-adj); }


/* Setup & Instructions Page */
.setup-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setup-card {
  padding: 36px;
}

.setup-header {
  text-align: center;
  margin-bottom: 28px;
}

.setup-header h2 {
  font-size: 1.8rem;
  font-style: italic;
  margin-bottom: 8px;
}

.setup-description {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.95rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-container svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #dcd8c9;
  padding: 10px 14px 10px 42px;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.12);
}

.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.step-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: #fbfaf7;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.step-number {
  background: var(--accent-primary);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-details h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.step-details p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.step-details pre {
  margin-top: 12px;
  background: #faf8f5;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  max-width: 100%;
}


/* Catalog/List Screen Styles */
.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.search-filter-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
  max-width: 480px;
}

.search-container {
  position: relative;
  flex-grow: 1;
}

.search-container svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid #dcd8c9;
  padding: 8px 12px 8px 36px;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.filter-select {
  background: #ffffff;
  border: 1px solid #dcd8c9;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  font-family: var(--font-sans);
}

.filter-select:focus {
  border-color: var(--accent-primary);
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  background: #ffffff;
  border: 1px solid #dcd8c9;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: #fbfaf7;
  border-color: #c4bfae;
}

.chip.active {
  background: var(--accent-primary);
  border-color: transparent;
  color: #fff;
}

/* Page specific chip active states */
.yarn-page .chip.active { background: var(--accent-yarn); }
.fabric-page .chip.active { background: var(--accent-fabric); }

/* Data Display: Grid of Cards */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.item-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  background: #ffffff;
  border: 1px solid var(--border-color);
}

/* Soft amber pulses for low stock warning borders */
.item-card.low-stock-warning {
  border-color: rgba(217, 119, 6, 0.4);
  animation: pulse-border 2.5s infinite ease-in-out;
}

@keyframes pulse-border {
  0% { border-color: rgba(217, 119, 6, 0.25); }
  50% { border-color: rgba(217, 119, 6, 0.6); box-shadow: 0 0 10px rgba(217, 119, 6, 0.05); }
  100% { border-color: rgba(217, 119, 6, 0.25); }
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 8px;
}

.item-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.3;
  color: #1c1917;
}

.item-sku-tag {
  font-weight: 700;
  font-size: 0.75rem;
  background: #faf8f5;
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.item-spec {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.item-color {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(45, 38, 30, 0.15);
}

.item-stock-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: auto;
}

.stock-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 500;
}

.stock-value-container {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.stock-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #1c1917;
}

.stock-unit {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.item-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.item-badge.in-stock { background: rgba(20, 83, 45, 0.08); color: var(--color-in); }
.item-badge.low-stock { background: rgba(217, 119, 6, 0.08); color: var(--color-low); }
.item-badge.out-of-stock { background: rgba(153, 27, 27, 0.08); color: var(--color-out); }


/* Timeline and History View */
.timeline-card {
  padding: 0;
  overflow: hidden;
}

.timeline-list {
  display: flex;
  flex-direction: column;
}

.timeline-row {
  display: grid;
  grid-template-columns: 110px 120px 1fr 130px 140px 120px;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  background: #ffffff;
  transition: background-color 0.2s ease;
}

.timeline-row:hover:not(.header) {
  background: #fbfaf7;
}

.timeline-row.header {
  font-weight: 600;
  color: var(--text-secondary);
  background: #faf9f6;
  border-bottom: 2px solid var(--border-color);
  padding: 12px 24px;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.timeline-sku {
  font-weight: 700;
}

.timeline-remarks {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-qty {
  font-weight: 700;
  text-align: right;
  font-size: 0.95rem;
}

.timeline-row.in .timeline-qty { color: var(--color-in); }
.timeline-row.out .timeline-qty { color: var(--color-out); }
.timeline-row.adj .timeline-qty { color: var(--color-adj); }


/* Detail Panel Overlay (Slide-out from Right) */
#detail-overlay {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid var(--border-color);
  z-index: 20;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

#detail-overlay.open {
  right: 0;
}

.overlay-header {
  padding: 24px 30px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fbfaf7;
}

.overlay-header h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
}

.overlay-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.overlay-close svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.overlay-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 30px;
  background-color: #fcfbfa;
}

.overlay-info-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.overlay-stock-panel {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  justify-content: space-around;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stock-panel-val {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.info-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.info-value.sku {
  font-weight: 700;
}

.overlay-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Dialog Overlay backdrop */
#overlay-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(45, 38, 30, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 15;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#overlay-backdrop.open {
  display: block;
  opacity: 1;
}


/* Empty States and Loading Indicators */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(247, 245, 239, 0.9);
  backdrop-filter: blur(4px);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(180, 83, 9, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  stroke-width: 1.8;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 320px;
}


/* Responsive Layout Adjustments */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (max-width: 768px) {
  :root {
    --header-height: 65px;
    --sidebar-width: 0px;
  }
  
  #sidebar {
    display: none; /* Hide sidebar */
  }
  
  #bottom-nav {
    display: flex; /* Show bottom-nav on mobile */
  }
  
  #main-wrapper {
    padding-bottom: var(--bottom-nav-height);
  }
  
  #main-header {
    padding: 0 20px;
  }
  
  .header-title-container h1 {
    font-size: 1.3rem;
  }
  
  .page {
    padding: 20px;
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
  }
  
  .card {
    padding: 16px;
  }
  
  .stat-value {
    font-size: 1.7rem;
  }
  
  .timeline-row {
    grid-template-columns: 85px 1fr 65px;
    gap: 12px;
    padding: 12px 16px;
    font-size: 0.8rem;
  }
  
  /* Hide specific columns on mobile for readable lists */
  .timeline-row .col-type,
  .timeline-row .col-remarks,
  .timeline-row .col-unit {
    display: none;
  }
  
  .timeline-row.header {
    display: none;
  }
  
  #detail-overlay {
    width: 100vw;
    right: -100vw;
  }
  
  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .search-filter-box {
    max-width: 100%;
  }
  
  .filter-chips {
    justify-content: flex-start;
  }
}

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