/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400;1,9..40,500&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Andari Brand Colors - Neutral base with teal accent */
  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #f5f5f5;
  --stroke: #e0e0e0;
  --text: #1a1a1a;
  --muted: #666666;
  --muted2: #999999;
  --text-inverse: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);

  /* Andari Teal - Primary brand color from logo */
  --andari-teal: #0F766E;
  --andari-teal-light: #14b8a6;
  --andari-teal-dark: #0d5d56;

  /* Status colors - refined to work with Andari palette */
  --blue: #0F766E; /* Use Andari teal for primary actions */
  --blue-light: #14b8a6;
  --red: #dc2626;
  --yellow: #d97706;
  --orange: #ea580c;
  --green: #059669;
  --gray: #6b7280;

  /* Semantic surface colors */
  --surface-success: #f0fdf4;
  --surface-warning: #fffbeb;
  --surface-error: #fef2f2;
  --surface-info: #eff6ff;

  /* Warm neutrals */
  --bg-warm: #fafaf9;
  --bg-subtle: #f8fafc;

  /* Typography */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* Animation durations */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== ANIMATION KEYFRAMES ==================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* History Table Styles */
.historyTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.historyTable thead {
  background: var(--panel2);
  border-bottom: 2px solid var(--stroke);
}

.historyTable th {
  padding: 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  position: relative;
  user-select: none;
}

.historyTable th:not(:last-child) {
  cursor: pointer;
  transition: background-color 0.2s;
}

.historyTable th:not(:last-child):hover {
  background-color: rgba(15, 118, 110, 0.08);
}

.historyTable th.sort-asc::after,
.historyTable th.sort-desc::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.historyTable th.sort-asc::after {
  border-bottom: 6px solid var(--andari-teal);
}

.historyTable th.sort-desc::after {
  border-top: 6px solid var(--andari-teal);
}

.historyTable td {
  padding: 12px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--stroke);
}

.historyTable tbody tr.sampleRow {
  transition: background-color 0.2s;
}

.historyTable tbody tr.sampleRow:hover {
  background: var(--panel2);
}

.historyTable tbody tr.sampleRow.expanded,
.historyTable tbody tr.styleRow.expanded {
  background: #f0fdfa;
  border-bottom: 2px solid var(--andari-teal);
}

.historyTable tbody tr.historyRow,
.historyTable tbody tr.samplesRow {
  background: #f8fafc;
}

.historyTable tbody tr.historyRow td,
.historyTable tbody tr.samplesRow td {
  padding: 0;
  border-bottom: 1px solid var(--stroke);
}

.historyTable tbody tr.styleRow:hover {
  background: var(--panel2);
  transition: background-color 0.2s;
}

.historyTable .emptyMessage {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}

.historyTable th.samplesPhotoCol,
.historyTable td.samplesPhotoCol {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
  box-sizing: border-box;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-feature-settings: 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
  min-height: 100vh;
  overflow: visible;
  position: relative;
  z-index: 1;
}

main,
.main {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--duration-normal, 250ms) cubic-bezier(0.16, 1, 0.3, 1);
}

main.loaded,
.main.loaded {
  opacity: 1;
}

.header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--stroke);
  flex-wrap: nowrap;
  width: 100%;
  overflow: visible;
  z-index: 1000;
  isolation: isolate;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  min-width: 0;
  max-width: calc(100% - 400px);
}

.brand h1 {
  color: var(--blue);
}

@media (max-width: 767px) {
  .brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 180px);
  }
  
  .brand h1 {
    font-size: 20px;
  }
  
  .brand .subtitle {
    font-size: 12px;
  }
  
  .brand .logo {
    width: 90px;
    height: 60px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .brand {
    max-width: calc(100% - 450px);
  }
  
  .brand h1 {
    font-size: 24px;
  }
  
  .brand .logo {
    width: 100px;
    height: 67px;
  }
}

.logo {
  width: 120px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  overflow: visible;
}

.logo svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 1024px) {
  h1 {
    font-size: 22px;
  }
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 3px;
  align-items: center;
  min-width: 0;
  padding: 0 10px;
  overflow: visible;
  flex-wrap: nowrap;
  position: relative;
  z-index: 100;
}


.navLink {
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
}

.navLink:hover {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.08);
}

.navLink.active {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.12);
  font-weight: 600;
}

.navLink.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--andari-teal);
  border-radius: 2px 2px 0 0;
}

/* Dropdown Navigation */
.navDropdown {
  position: relative;
  display: inline-block;
  z-index: 1000;
}

.navDropdownToggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.navDropdownToggle:hover {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.08);
}

.navDropdown.active .navDropdownToggle,
.navDropdownToggle:focus {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.12);
  outline: none;
}

.navDropdown.active .navDropdownToggle {
  font-weight: 600;
}

.navDropdown.active .navDropdownToggle::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--andari-teal);
  border-radius: 2px 2px 0 0;
}

.dropdownIcon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.navDropdown.active > .navDropdownToggle > .dropdownIcon {
  transform: rotate(180deg);
}

.navDropdownMenu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 180px;
  width: max-content;
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  z-index: 99999;
  overflow: visible;
  pointer-events: none;
  display: none;
  padding: 0;
  line-height: normal;
}

.navDropdown.active .navDropdownMenu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
  display: block !important;
  background: var(--panel) !important;
  animation: fadeInDown var(--duration-fast) var(--ease-out);
}

/* ==================== OVERFLOW "MORE" MENU ==================== */

.navOverflowDropdown {
  flex-shrink: 0;
}

.navOverflowDropdown .navDropdownMenu {
  left: 0;
  right: auto;
}

.navOverflowMenu {
  max-height: 70vh;
  overflow-y: auto;
}

.navOverflowSection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
  font-family: inherit;
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}

.navOverflowSection:hover {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.05);
}

.navOverflowSection .dropdownIcon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.navOverflowSection.open {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.08);
}

.navOverflowSection.open .dropdownIcon {
  transform: rotate(180deg);
}

.navOverflowSectionItems {
  display: none;
}

.navOverflowSectionItems.open {
  display: block;
}

.navOverflowSectionItems .navDropdownItem {
  padding-left: 24px;
}

.navOverflowMenu > .navLink {
  border-bottom: 1px solid var(--stroke);
}

/* ==================== HAMBURGER BUTTON ==================== */

.hamburgerBtn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 1001;
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

.hamburgerBtn:hover {
  background: rgba(15, 118, 110, 0.08);
  border-color: var(--andari-teal);
}

.hamburgerBtn:focus-visible {
  outline: 2px solid var(--andari-teal);
  outline-offset: 2px;
}

.hamburgerIcon {
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
  display: block;
  transition: background var(--duration-fast) ease;
}

.hamburgerIcon::before,
.hamburgerIcon::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 2px;
  background: var(--text);
  left: 0;
  transition: transform var(--duration-fast) ease, top var(--duration-fast) ease;
}

.hamburgerIcon::before { top: -6px; }
.hamburgerIcon::after { top: 6px; }

.hamburgerBtn.active .hamburgerIcon {
  background: transparent;
}

.hamburgerBtn.active .hamburgerIcon::before {
  transform: rotate(45deg);
  top: 0;
}

.hamburgerBtn.active .hamburgerIcon::after {
  transform: rotate(-45deg);
  top: 0;
}

/* ==================== NAV BACKDROP ==================== */

.navBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 998;
}

.navBackdrop.visible {
  display: block;
}

/* ==================== RESPONSIVE NAV (≤1024px) ==================== */

@media (max-width: 1024px) {
  .hamburgerBtn {
    display: flex;
  }

  .navOverflowDropdown {
    display: none !important;
  }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px;
    overflow: visible;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    z-index: 999;
  }

  .header.navOpen .nav {
    display: flex;
    animation: navSlideDown var(--duration-fast) var(--ease-out);
  }

  @keyframes navSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .brand {
    flex: 1;
    max-width: none;
  }

  /* Mobile nav links — full width */
  .nav .navLink {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
  }

  /* Mobile nav dropdowns — accordion style */
  .nav .navDropdown {
    display: block;
    width: 100%;
    z-index: auto;
  }

  .nav .navDropdownToggle {
    width: 100%;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 8px;
  }

  .nav .navDropdown.open .navDropdownToggle {
    color: var(--andari-teal);
    background: rgba(15, 118, 110, 0.08);
  }

  .nav .navDropdown.open > .navDropdownToggle > .dropdownIcon {
    transform: rotate(180deg);
  }

  .nav .navDropdownMenu {
    position: static !important;
    display: none;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0 0 4px;
    background: transparent !important;
    min-width: unset;
    width: 100%;
    z-index: auto;
  }

  .nav .navDropdown.open .navDropdownMenu {
    display: block !important;
    animation: none;
  }

  .nav .navDropdownMenu .navDropdownItem {
    padding: 10px 16px 10px 36px;
    border-bottom: none;
    border-radius: 6px;
    font-size: 14px;
  }

  .nav .navDropdownMenu .navDropdownItem:hover {
    background: rgba(15, 118, 110, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hamburgerIcon,
  .hamburgerIcon::before,
  .hamburgerIcon::after {
    transition: none;
  }

  .header.navOpen .nav {
    animation: none;
  }
}

.historyTable thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.tableActions {
  display: flex;
  gap: 8px;
}

/* Row Action Menu (kebab + context menu) */
.ramKebab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--panel2);
  color: var(--text);
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}

.ramKebab:hover,
.ramKebab--open {
  background: var(--stroke);
}

.ramMenu {
  position: fixed;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1000;
  overflow: hidden;
  padding: 4px 0;
  animation: fadeInDown var(--duration-fast) var(--ease-out);
}

.ramItem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.ramItem:hover,
.ramItem:focus {
  background: var(--andari-teal);
  color: white;
  outline: none;
}

.ramItem--danger {
  color: var(--red);
}

.ramItem--danger:hover,
.ramItem--danger:focus {
  background: var(--red);
  color: white;
}

.ramItem--success {
  color: #28a745;
  font-weight: 600;
}

.ramItem--success:hover,
.ramItem--success:focus {
  background: #28a745;
  color: white;
}

.ramIcon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.ramLabel {
  flex: 1;
}

.ramSeparator {
  height: 1px;
  background: var(--stroke);
  margin: 4px 0;
}

/* Clickable identifier links in tables */
.clickableId {
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}
.clickableId:hover {
  text-decoration: underline;
}

/* Photo Thumbnail Tooltip Styles */
.photoThumbnailContainer {
  position: relative;
  display: inline-block;
}

.photoThumbnail {
  display: block;
  cursor: pointer;
}

.photoTooltip {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%) translateX(8px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  margin-left: 8px;
}

.photoThumbnailContainer:hover .photoTooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.photoTooltipImage {
  max-width: 400px;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 2px solid var(--stroke);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  background: var(--bg);
  padding: 4px;
  display: block;
}

.btn.icon {
  padding: 6px 8px;
  min-width: 32px;
  justify-content: center;
  text-align: center;
}

.btn.icon.danger {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.btn.icon.danger:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.btn.icon.danger[disabled] {
  background: transparent;
  color: #ccc;
  border-color: var(--stroke);
  cursor: not-allowed;
}

.btn.icon[disabled] {
  background: #ccc;
  color: #666;
  cursor: not-allowed;
}

@media (max-width: 767px) {
  .navDropdownMenu {
    left: auto;
    right: 0;
    min-width: 160px;
  }
}

.navDropdownItem {
  display: block !important;
  padding: 12px 18px !important;
  color: #1a1a1a !important;
  text-decoration: none !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.15s ease;
  border-bottom: 1px solid var(--stroke);
  background: white !important;
  visibility: visible !important;
  opacity: 1 !important;
  white-space: nowrap;
}

.navDropdownItem:last-child {
  border-bottom: none;
}

.navDropdownItem:hover {
  background: rgba(15, 118, 110, 0.08) !important;
  color: var(--andari-teal) !important;
}

.navDropdownItem.active {
  background: rgba(15, 118, 110, 0.12) !important;
  color: var(--andari-teal) !important;
  font-weight: 600;
  position: relative;
}

.navDropdownItem.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--andari-teal);
}

/* ==================== Global Search ==================== */

/* Trigger button in header */
.globalSearchTrigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--muted2);
  font-size: 13px;
  font-family: inherit;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-left: auto;
}

.globalSearchTrigger:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(15, 118, 110, 0.04);
}

.globalSearchTriggerLabel {
  pointer-events: none;
}

.globalSearchKbd {
  flex-shrink: 0;
  font-size: 10px;
  font-family: inherit;
  color: var(--muted2);
  background: var(--bg);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
  pointer-events: none;
}

/* Overlay backdrop */
.globalSearchOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 9999;
  justify-content: center;
  align-items: flex-start;
  padding-top: min(20vh, 160px);
}

.globalSearchOverlay.open {
  display: flex;
  animation: searchOverlayFadeIn 0.15s ease-out;
}

@keyframes searchOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes searchModalSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal container */
.globalSearchModal {
  width: 90%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: searchModalSlideIn 0.2s var(--ease-out);
}

.globalSearchModal .globalSearchInputGroup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
}

.globalSearchIcon {
  flex-shrink: 0;
  color: var(--muted2);
}

.globalSearchInput {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
}

.globalSearchInput::placeholder {
  color: var(--muted2);
}

.globalSearchModalKbd {
  flex-shrink: 0;
  font-size: 10px;
  font-family: inherit;
  color: var(--muted2);
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.4;
  pointer-events: none;
}

.globalSearchDropdown {
  display: none;
  max-height: 400px;
  overflow-y: auto;
}

.globalSearchCategory {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.globalSearchItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.globalSearchItem:hover,
.globalSearchItem.highlighted {
  background: var(--panel2);
}

.globalSearchItemLabel {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 50%;
}

.globalSearchItemDetail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.globalSearchEmpty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted2);
  font-size: 13px;
}

/* Dark mode overrides */
[data-theme="dark"] .globalSearchTrigger {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .globalSearchTrigger:hover {
  border-color: var(--blue-light);
  color: var(--blue-light);
  background: rgba(20, 184, 166, 0.08);
}

[data-theme="dark"] .globalSearchOverlay {
  background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .globalSearchModal {
  background: var(--panel);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .globalSearchModal .globalSearchInputGroup {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .globalSearchKbd,
[data-theme="dark"] .globalSearchModalKbd {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Responsive: compact trigger on small screens */
@media (max-width: 767px) {
  .globalSearchTriggerLabel,
  .globalSearchTrigger .globalSearchKbd {
    display: none;
  }

  .globalSearchTrigger {
    padding: 8px;
  }
}

@media (max-width: 1024px) {
  .globalSearchTriggerLabel {
    display: none;
  }
}

/* Print: hide search */
@media print {
  .globalSearchTrigger,
  .globalSearchOverlay {
    display: none !important;
  }
}

/* Trash + notification bell always side by side */
.headerIcons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.userInfo {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 6px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
  border: 1px solid rgba(15, 118, 110, 0.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  min-width: 130px;
  max-width: 170px;
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 1200;
}

@media (max-width: 1024px) {
  .userInfo {
    min-width: 120px;
    max-width: 160px;
    padding: 8px 10px;
  }
}

.userName {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  text-align: right;
}

.userRole {
  font-size: 12px;
  color: var(--muted2);
  text-align: right;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  align-self: flex-end;
}

.userRole.admin {
  color: var(--andari-teal);
  background: rgba(15, 118, 110, 0.1);
  font-weight: 600;
}

.userRole.programmer {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  font-weight: 500;
}

.userRole.user {
  color: var(--muted);
  background: rgba(107, 114, 128, 0.1);
  font-weight: 500;
}

.userRole.anonymous {
  color: var(--red);
  background: rgba(220, 38, 38, 0.1);
}

/* User dropdown menu */
.userMenuTrigger {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 0;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.userMenuTrigger:hover {
  opacity: 0.8;
}

.userMenuTrigger .dropdownIcon {
  flex-shrink: 0;
  color: var(--muted2);
  transition: transform 0.2s ease;
}

.userInfo.menuOpen .userMenuTrigger .dropdownIcon {
  transform: rotate(180deg);
}

.userMenu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1300;
  overflow: hidden;
}

.userInfo.menuOpen .userMenu {
  display: block;
}

.userMenuItem {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.15s;
}

.userMenuItem:hover {
  background: var(--panel2);
}

.userMenuItem.signout {
  color: var(--red);
  border-top: 1px solid var(--stroke);
}

.userInfo .btn {
  font-size: 13px;
  padding: 6px 12px;
}

.userInfo .btn.small {
  font-size: 12px;
  padding: 5px 10px;
}

/* Status Cards */
.statusCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.statusCard {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out);
}

.statusCard.clickable {
  cursor: pointer;
}

.statusCard:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.overseasStatusSection {
  margin-bottom: 24px;
}

.overseasStatusSection:last-child {
  margin-bottom: 0;
}

.overseasStatusSection.collapsed {
  margin-bottom: 12px;
  padding: 0 !important;
}

.overseasStatusSection.collapsed h2 {
  margin: 0 !important;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.overseasTableCount {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9em;
}

.statusCardContent {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.statusCardTitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 8px;
}

.statusCardCount {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-family: var(--font-mono);
}

.statusCardIcon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.statusCardIcon.notStarted {
  background: #f3f4f6;
  color: #6b7280;
}

.statusCardIcon.programming {
  background: #dbeafe;
  color: #2563eb;
}

.statusCardIcon.knitting {
  background: #e9d5ff;
  color: #9333ea;
}

.statusCardIcon.informationNeeded {
  background: #fecaca;
  color: #dc2626;
}

.statusCardIcon.waitingForFinishing {
  background: #fef3c7;
  color: #f59e0b;
}

.statusCardIcon.inProgress {
  background: #dbeafe;
  color: #2563eb;
}

.statusCardIcon.completed {
  background: #d1fae5;
  color: #10b981;
}

.statusCardIcon.internalReview {
  background: #f5f3ff;
  color: #8b5cf6;
}

.statusCardIcon.sentForReview {
  background: #dbeafe;
  color: #3b82f6;
}

.statusCardIcon.feedbackReceived {
  background: #fff7ed;
  color: #f97316;
}

.statusCardIcon.feedbackReviewed {
  background: #f0fdf4;
  color: #22c55e;
}

.statusCardSubtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Add Sample Button */
.addSampleSection {
  margin-bottom: 32px;
}

.btnAddSample {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  width: 100%;
  justify-content: center;
}

.btnAddSample:hover {
  background: var(--blue-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* View Labels */
.viewLabel {
  margin-bottom: 24px;
}

.viewLabel h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

/* Filters */
.filtersSection {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border: 1px solid #e0eef8;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.filterRow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.filterLabel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filterLabel span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.filterSelect {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.filterSelect:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filterSelect[type="text"] {
  appearance: none;
  background-image: none;
  padding-right: 12px;
}

.filterActions {
  display: flex;
  justify-content: flex-start;
  margin-top: 16px;
}

.btnAddFilter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--panel2);
  color: var(--blue);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btnAddFilter:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.additionalFilters {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.filterLabelWrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filterLabelWrapper .filterSelect {
  flex: 1;
  margin: 0;
}

.filterLabelWrapper span {
  white-space: nowrap;
  min-width: fit-content;
}

.filterRemoveBtn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--panel2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.filterRemoveBtn:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.filterMenu {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 200px;
}

.filterMenuContent {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filterMenuItem {
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.filterMenuItem:hover {
  background: var(--panel2);
  color: var(--blue);
}

/* Queue List */
.queueList {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 24px;
  min-height: 400px;
  box-shadow: var(--shadow);
}

.emptyMessage {
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  margin: 60px 0;
}

/* Queue Items */
.queueItem {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--panel);
  transition: all 0.2s;
}

.queueItem:hover {
  box-shadow: var(--shadow);
  border-color: var(--blue);
}

.queueItem.dragging {
  opacity: 0.5;
}

.queueItem.drag-over {
  border-color: var(--blue);
  background: #eff6ff;
}

/* Queue Group Headers (Group by Programmer) */
.queueGroupHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  margin: 12px 0 4px 0;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text);
}
.queueGroupHeader:first-child { margin-top: 0; }
.queueGroupHeader:hover { background: var(--hover, #f1f5f9); }
.queueGroupHeader.collapsed { margin-bottom: 0; border-radius: 8px; }

.queueGroupHeaderToggle {
  font-size: 11px;
  color: var(--muted);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.queueGroupHeaderName { font-weight: 600; }
.queueGroupHeaderCount {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}
.queueGroupItems.collapsed { display: none; }

.queuePosition {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel2);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.queuePosition.dragHandle {
  cursor: grab;
  background: var(--blue);
  color: white;
}

.queueItemPhoto {
  flex-shrink: 0;
  width: 90px;
  min-width: 90px;
  max-width: 90px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
}

.queueItemPhoto .photoThumbnailContainer {
  width: 100%;
}

.queueItemPhoto .photoThumbnail {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.queueItemContent {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

/* Primary fields span full width and appear bolder */
.queueItemField.primary {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 4px;
}

.queueItemField.primary .queueItemValue {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.queueItemField.primary .queueItemLabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.queueItemField {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queueItemLabel {
  font-size: 12px;
  font-weight: 500;
  color: #555;
}

.queueItemValue {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* Overdue and due-today highlighting for queue cards */
.queueItemValue.overdue {
  color: var(--red);
  font-weight: 600;
}

.queueItemValue.overdue::after {
  content: 'Overdue';
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fef2f2;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #fecaca;
  vertical-align: middle;
}

.queueItemValue.dueToday {
  color: var(--orange);
  font-weight: 600;
}

.queueItemValue.dueToday::after {
  content: 'Due Today';
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fff7ed;
  color: var(--orange);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #fed7aa;
  vertical-align: middle;
}

.queueItemValue.dueSoon {
  color: var(--yellow);
  font-weight: 600;
}

.queueItemActions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.statusSelect {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--panel2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  min-width: 120px;
}

/* Status badge pill (domestic + overseas samples) — shared look/feel */
.statusBadge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.statusCell {
  white-space: nowrap;
}

.statusBadge.pending,
.statusBadge.notStarted {
  background: #f3f4f6;
  color: #374151;
  border-color: #9ca3af;
}

.statusBadge.programming {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}

.statusBadge.knitting {
  background: #e9d5ff;
  color: #6b21a8;
  border-color: #9333ea;
}

.statusBadge.informationNeeded {
  background: #fecaca;
  color: #991b1b;
  border-color: #dc2626;
}

.statusBadge.waitingForFinishing {
  background: #fef3c7;
  color: #92400e;
  border-color: #fbbf24;
}

.statusBadge.inProgress {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}

.statusBadge.completed {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

.statusBadge.cancelled {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef4444;
}

.statusBadge.internalReview {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #8b5cf6;
}

.statusBadge.sentForReview {
  background: #eff6ff;
  color: #1e40af;
  border-color: #3b82f6;
}

.statusBadge.feedbackReceived {
  background: #fff7ed;
  color: #9a3412;
  border-color: #f97316;
}

.statusBadge.feedbackReviewed {
  background: #f0fdf4;
  color: #166534;
  border-color: #6b7280;
}

/* Overseas status badge colors */
.statusBadge.submitted {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}

.statusBadge.overseasInProgress {
  background: #fef3c7;
  color: #92400e;
  border-color: #fbbf24;
}

.statusBadge.shipped {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #6366f1;
}

.statusBadge.received {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

.statusBadge.final {
  background: #ecfdf5;
  color: #065f46;
  border-color: #10b981;
  font-weight: 600;
}

.statusBadge.inProduction {
  background: #fff7ed;
  color: #9a3412;
  border-color: #f97316;
  font-weight: 600;
}

/* Production order status badges */
.statusBadge.productionDraft {
  background: #f3f4f6;
  color: #374151;
  border-color: #9ca3af;
}
.statusBadge.productionConfirmed {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}
.statusBadge.productionInProduction {
  background: #fff7ed;
  color: #9a3412;
  border-color: #f97316;
}
.statusBadge.productionCompleted {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}
.statusBadge.productionShipped {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #6366f1;
}
.statusBadge.productionDelivered {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}
.statusBadge.productionCancelled {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef4444;
}

/* Cutting ticket status badges */
.statusBadge.ctDraft {
  background: #f3f4f6;
  color: #374151;
  border-color: #9ca3af;
}
.statusBadge.ctIssued {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}
.statusBadge.ctInProgress {
  background: #fff7ed;
  color: #9a3412;
  border-color: #f97316;
}
.statusBadge.ctCompleted {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

/* Production status card icons */
.statusCardIcon.productionDraft { background: #f3f4f6; color: #6b7280; }
.statusCardIcon.productionConfirmed { background: #dbeafe; color: #2563eb; }
.statusCardIcon.productionInProduction { background: #fff7ed; color: #ea580c; }
.statusCardIcon.productionCompleted { background: #d1fae5; color: #10b981; }
.statusCardIcon.productionShipped { background: #e0e7ff; color: #6366f1; }
.statusCardIcon.productionDelivered { background: #d1fae5; color: #059669; }

/* Overseas status card icon colors */
.statusCardIcon.submitted {
  background: #dbeafe;
  color: #2563eb;
}

.statusCardIcon.overseasInProgress {
  background: #fef3c7;
  color: #f59e0b;
}

.statusCardIcon.shipped {
  background: #e0e7ff;
  color: #6366f1;
}

.statusCardIcon.received {
  background: #d1fae5;
  color: #10b981;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--panel2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease, border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease, transform var(--duration-fast) ease;
}

.btn:hover {
  background: var(--stroke);
}

.btn.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.btn.primary:hover {
  background: var(--blue-light);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn.small.active {
  background: var(--andari-teal);
  color: #fff;
  border-color: var(--andari-teal);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
}

/* Form Styles (for create page) */
.formCard {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.formCard h2 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

/* Filter section headings are smaller than page/form headings */
.formCard[aria-label="Filters"] {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border-color: #e0eef8;
}

.formCard[aria-label="Filters"] h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Style info panel on edit/create forms */
.styleInfoPanel {
  padding: 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #f5f5f5 100%);
  border: 1px solid #d1e7dd;
  border-radius: 8px;
  margin-bottom: 20px;
}

.yarnSectionPanel {
  padding: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f5f5 100%);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 20px;
}

.trimSectionPanel {
  padding: 16px;
  background: linear-gradient(135deg, #faf5ff 0%, #f5f5f5 100%);
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  margin-bottom: 20px;
}

.colorwaySectionPanel {
  padding: 16px;
  background: linear-gradient(135deg, #f0fdfa 0%, #f5f5f5 100%);
  border: 1px solid #99f6e4;
  border-radius: 8px;
  margin-bottom: 20px;
}

.colorwayTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.colorwayTable th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 8px 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.colorwayTable td {
  padding: 4px 8px;
}

.colorwayTable input,
.colorwayTable select {
  width: 100%;
  box-sizing: border-box;
}

.colorwayTable .colorwayRemoveBtn {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
}

.colorwayTable .colorwayRemoveBtn:hover {
  opacity: 1;
}

.sampleDetailsSectionPanel {
  padding: 16px;
  background: linear-gradient(135deg, #fff1f2 0%, #f5f5f5 100%);
  border: 1px solid #fecdd3;
  border-radius: 8px;
  margin-bottom: 20px;
}

.costingSectionPanel {
  padding: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #f5f5f5 100%);
  border: 1px solid #fde68a;
  border-radius: 8px;
  margin-bottom: 20px;
}

.datesSectionPanel {
  padding: 16px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 20px;
}

.yarnSectionPanel h3,
.trimSectionPanel h3,
.colorwaySectionPanel h3,
.sampleDetailsSectionPanel h3,
.costingSectionPanel h3,
.datesSectionPanel h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
}

/* Costing readiness banner */
.costingBanner {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.costingBanner.ready {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.costingBanner.notReady {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.sampleForm {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.formRow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 16px;
}
.formRow:last-child {
  margin-bottom: 0;
}

.sectionFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--bg);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}

.formLabel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formLabel span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.formInput {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.formInput:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.formInput.price-rule-compact {
  max-width: 80px;
}

.formInput.price-rule-price {
  max-width: 90px;
}

/* Price rule row drag and drop */
.price-rule-row.dragging {
  opacity: 0.5;
  background: var(--surface-alt);
}

.price-rule-row.drag-over {
  border-top: 2px solid var(--andari-teal);
  background: rgba(15, 118, 110, 0.05);
}

.price-rule-row .drag-handle {
  user-select: none;
}

.price-rule-row .drag-handle:active {
  cursor: grabbing;
}

/* Table row drag and drop (machine types, gauges, sizes) */
tbody tr.dragging {
  opacity: 0.5;
  background: var(--surface-alt);
}

tbody tr.drag-over {
  border-top: 2px solid var(--blue);
  background: rgba(59, 130, 246, 0.08);
}

.formInput[readonly] {
  background-color: #f5f5f5;
  cursor: not-allowed;
  color: #666;
}

.formInput[readonly]:focus {
  border-color: var(--stroke);
  box-shadow: none;
}

select.formInput {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.formActions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

/* Sticky form actions (shared across style and sample edit pages) */
.stickyActions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--stroke);
  padding: 12px 0 4px 0;
  margin-top: 16px;
  z-index: 10;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.stickyActions .btn {
  min-width: 120px;
  text-align: center;
}

.stickyActions .stickyActionsRight {
  margin-left: auto;
}

/* Unsaved changes badge */
.unsavedBadge {
  display: none;
  font-size: 12px;
  color: var(--orange, #e67e22);
  background: var(--surface-warning, #fef3cd);
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.unsavedBadge.visible {
  display: inline-block;
}

/* Form breadcrumb */
.formBreadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.formBreadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.formBreadcrumb a:hover {
  color: var(--andari-teal);
  text-decoration: underline;
}

.formBreadcrumb .sep {
  margin: 0 6px;
  color: var(--muted);
  opacity: 0.5;
}

/* ==================== ITERATION NAVIGATION ==================== */

.iterationNav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}

.iterationLink {
  color: var(--andari-teal);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--duration-fast) ease;
}

.iterationLink:hover {
  background: var(--panel2);
}

.iterationLink.next {
  margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════════
   Style Form Sections (style-create.html)
   ══════════════════════════════════════════════════════════════════ */

.styleFormSection {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  margin-top: 20px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.styleFormSection:first-of-type {
  margin-top: 16px;
}

.styleFormSection:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.styleFormSection .sectionHeader {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease;
}

.styleFormSection:not(.collapsed) .sectionHeader {
  border-bottom-color: inherit;
}

.styleFormSection .sectionHeader:hover {
  filter: brightness(0.97);
}

.styleFormSection .sectionHeader .sectionIcon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.styleFormSection .sectionHeader .chevron {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.2s ease;
  margin-left: auto;
  width: 14px;
  text-align: center;
}

.styleFormSection.collapsed .sectionHeader .chevron {
  transform: rotate(-90deg);
}

.styleFormSection .sectionBody {
  padding: 16px;
}

.styleFormSection.collapsed .sectionBody {
  display: none;
}

/* Section color variants */
.styleFormSection[data-section="identity"] { border-color: #99f6e4; }
.styleFormSection[data-section="identity"] .sectionHeader { background: linear-gradient(135deg, #f0fdfa 0%, #f8fffe 100%); }
.styleFormSection[data-section="identity"] .sectionIcon { color: #0d9488; }

.styleFormSection[data-section="specs"] { border-color: #bfdbfe; }
.styleFormSection[data-section="specs"] .sectionHeader { background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%); }
.styleFormSection[data-section="specs"] .sectionIcon { color: #2563eb; }

.styleFormSection[data-section="yarns"] { border-color: #c7d2fe; }
.styleFormSection[data-section="yarns"] .sectionHeader { background: linear-gradient(135deg, #eef2ff 0%, #f8f9ff 100%); }
.styleFormSection[data-section="yarns"] .sectionIcon { color: #4f46e5; }

.styleFormSection[data-section="poms"] { border-color: #e9d5ff; }
.styleFormSection[data-section="poms"] .sectionHeader { background: linear-gradient(135deg, #faf5ff 0%, #fcfaff 100%); }
.styleFormSection[data-section="poms"] .sectionIcon { color: #7c3aed; }

.styleFormSection[data-section="trims"] { border-color: #fecdd3; }
.styleFormSection[data-section="trims"] .sectionHeader { background: linear-gradient(135deg, #fff1f2 0%, #fffafb 100%); }
.styleFormSection[data-section="trims"] .sectionIcon { color: #e11d48; }

.styleFormSection[data-section="samples"] { border-color: #fde68a; }
.styleFormSection[data-section="samples"] .sectionHeader { background: linear-gradient(135deg, #fffbeb 0%, #fffdf5 100%); }
.styleFormSection[data-section="samples"] .sectionIcon { color: #d97706; }

.styleFormSection[data-section="files"] { border-color: #d1d5db; }
.styleFormSection[data-section="files"] .sectionHeader { background: linear-gradient(135deg, #f9fafb 0%, #fefefe 100%); }
.styleFormSection[data-section="files"] .sectionIcon { color: #6b7280; }

.styleFormSection[data-section="gallery"] { border-color: #fbcfe8; }
.styleFormSection[data-section="gallery"] .sectionHeader { background: linear-gradient(135deg, #fdf2f8 0%, #fffafd 100%); }
.styleFormSection[data-section="gallery"] .sectionIcon { color: #db2777; }

/* Sample edit page section colors */
.styleFormSection[data-section="styleInfo"] { border-color: #99f6e4; }
.styleFormSection[data-section="styleInfo"] .sectionHeader { background: linear-gradient(135deg, #f0fdfa 0%, #f8fffe 100%); }
.styleFormSection[data-section="styleInfo"] .sectionIcon { color: #0d9488; }

.styleFormSection[data-section="sampleDetails"] { border-color: #bfdbfe; }
.styleFormSection[data-section="sampleDetails"] .sectionHeader { background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%); }
.styleFormSection[data-section="sampleDetails"] .sectionIcon { color: #2563eb; }

.styleFormSection[data-section="colorways"] { border-color: #c7d2fe; }
.styleFormSection[data-section="colorways"] .sectionHeader { background: linear-gradient(135deg, #eef2ff 0%, #f8f9ff 100%); }
.styleFormSection[data-section="colorways"] .sectionIcon { color: #4f46e5; }

.styleFormSection[data-section="costing"] { border-color: #bbf7d0; }
.styleFormSection[data-section="costing"] .sectionHeader { background: linear-gradient(135deg, #f0fdf4 0%, #f8fff9 100%); }
.styleFormSection[data-section="costing"] .sectionIcon { color: #16a34a; }

.styleFormSection[data-section="schedule"] { border-color: #fde68a; }
.styleFormSection[data-section="schedule"] .sectionHeader { background: linear-gradient(135deg, #fffbeb 0%, #fffdf5 100%); }
.styleFormSection[data-section="schedule"] .sectionIcon { color: #d97706; }

/* Create mode — linear flow, no accordion */
.styleForm--create .styleFormSection .sectionHeader {
  cursor: default;
  pointer-events: none;
}

.styleForm--create .styleFormSection .sectionHeader .chevron {
  display: none;
}

.styleForm--create .styleFormSection.collapsed .sectionBody {
  display: block;
}

/* Style form header */
.styleFormHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.styleFormHeaderLeft {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.headerPhotoThumb {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--bg);
  flex-shrink: 0;
  display: none;
}

/* Completion bar */
.styleCompletionBar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.styleCompletionBar .completionTrack {
  flex: 1;
  height: 5px;
  background: var(--stroke);
  border-radius: 3px;
  overflow: hidden;
  min-width: 120px;
}

.styleCompletionBar .completionFill {
  height: 100%;
  background: var(--andari-teal);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.styleCompletionBar .completionLabel {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

/* POM category headers */
/* POM category groups */
.pomCategoryGroup {
  margin-top: 4px;
  border-top: 1px solid var(--stroke);
  transition: opacity 0.15s;
}
.pomCategoryGroup:first-child { margin-top: 0; border-top: none; }
.pomCategoryGroup.dragging { opacity: 0.4; }
.pomCategoryGroup.drag-over { border-top: 2px solid var(--andari-teal); }

.pomCategoryHeader {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 4px;
}
.pomCatMoveButtons {
  margin-left: auto; display: flex; gap: 2px; opacity: 0.3; transition: opacity 0.15s;
}
.pomCategoryGroup:hover .pomCatMoveButtons { opacity: 1; }
.pomCatMoveBtn {
  background: none; border: 1px solid var(--stroke); border-radius: 3px;
  cursor: pointer; font-size: 10px; color: var(--muted); padding: 1px 4px;
  transition: all 0.15s;
}
.pomCatMoveBtn:hover:not(:disabled) { border-color: var(--andari-teal); color: var(--andari-teal); }
.pomCatMoveBtn:disabled { opacity: 0.2; cursor: default; }
.pomCatName {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pomCatCount {
  font-size: 10px; font-weight: 600; color: var(--muted);
  background: var(--panel2); padding: 1px 6px; border-radius: 8px;
}

.stylePomRow {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.stylePomRow:hover { border-color: var(--stroke); background: var(--panel2); }
.stylePomRow.dragging { opacity: 0.4; }
.stylePomRow.drag-over { border-color: var(--andari-teal); background: rgba(15, 118, 110, 0.04); }
.pomRowDragHandle {
  cursor: grab; color: var(--muted); font-size: 12px; user-select: none;
  opacity: 0.3; transition: opacity 0.15s;
}
.stylePomRow:hover .pomRowDragHandle { opacity: 1; }

/* Inline create POM */
.pomInlineAddBtn {
  display: block; width: 100%; text-align: left;
  padding: 4px 8px 4px 28px; margin: 2px 0 4px;
  font-size: 12px; color: var(--muted); background: none; border: none;
  cursor: pointer; border-radius: 4px; transition: color 0.15s, background 0.15s;
}
.pomInlineAddBtn:hover { color: var(--andari-teal); background: rgba(15, 118, 110, 0.04); }

/* Unified POM add panel */
.pomAddPanel {
  margin: 4px 0 8px 20px; padding: 10px 12px;
  border: 1px solid var(--andari-teal); border-radius: 8px;
  background: var(--panel); box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.pomAddSearch {
  width: 100%; padding: 7px 10px; font-size: 13px;
  margin-bottom: 6px;
}
.pomAddResults {
  max-height: 140px; overflow-y: auto; margin-bottom: 4px;
}
.pomAddResultItem {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 8px; border-radius: 4px; cursor: pointer;
  font-size: 13px; transition: background 0.1s;
}
.pomAddResultItem:hover { background: rgba(15, 118, 110, 0.06); }
.pomAddNoResults { color: var(--muted); font-size: 12px; font-style: italic; padding: 6px 8px; }
.pomAddDivider {
  display: flex; align-items: center; gap: 10px; margin: 8px 0;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.pomAddDivider::before, .pomAddDivider::after {
  content: ''; flex: 1; height: 1px; background: var(--stroke);
}
.pomAddCreateForm {}
.pomInlineFormRow {
  display: flex; gap: 8px; margin-bottom: 6px;
}
.pomInlineFormRow .formInput { padding: 6px 8px; font-size: 13px; }
.pomInlineFormActions {
  display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px;
}

/* Style form summary tables */
.samplesSummaryTable,
.yarnSummaryTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.yarnSummaryTable { margin-bottom: 12px; }

/* Consistent column widths across all summary tables (6 columns) */
.samplesSummaryTable th:nth-child(1),
.samplesSummaryTable td:nth-child(1) { width: 25%; }
.samplesSummaryTable th:nth-child(2),
.samplesSummaryTable td:nth-child(2) { width: 25%; }
.samplesSummaryTable th:nth-child(3),
.samplesSummaryTable td:nth-child(3) { width: 15%; }
.samplesSummaryTable th:nth-child(4),
.samplesSummaryTable td:nth-child(4) { width: 10%; }
.samplesSummaryTable th:nth-child(5),
.samplesSummaryTable td:nth-child(5) { width: 13%; }
.samplesSummaryTable th:nth-child(6),
.samplesSummaryTable td:nth-child(6) { width: 12%; }

.samplesSummaryTable th,
.yarnSummaryTable th {
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--stroke);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.samplesSummaryTable td,
.yarnSummaryTable td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--stroke);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.samplesSummaryTable tr:last-child td,
.yarnSummaryTable tr:last-child td { border-bottom: none; }

.samplesSummaryTable a,
.yarnSummaryTable a {
  color: var(--andari-teal);
  text-decoration: none;
}

.samplesSummaryTable a:hover,
.yarnSummaryTable a:hover { text-decoration: underline; }

/* Photo gallery */
.galleryDropZone {
  border: 2px dashed var(--stroke);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.galleryDropZone:hover,
.galleryDropZone.dragover {
  border-color: var(--andari-teal);
  background: rgba(20, 184, 166, 0.04);
  color: var(--text);
}

.galleryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.galleryCard {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  position: relative;
  transition: box-shadow 0.15s;
}

.galleryCard:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }

.galleryCard img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

.galleryCard .galleryCardBody {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.galleryCard .galleryCaption {
  font-size: 12px;
  color: var(--text);
  border: none;
  background: transparent;
  padding: 2px 4px;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.galleryCard .galleryCaption:hover { background: var(--panel2); }

.galleryCard .galleryCaption:focus {
  outline: none;
  background: var(--panel2);
  border: 1px solid var(--andari-teal);
}

.galleryCard .galleryActions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.galleryCard .galleryActions button {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.galleryCard .galleryActions button:hover { background: var(--panel2); }

.galleryCard .coverBadge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--green, #10b981);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Gallery lightbox */
.galleryLightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}

.galleryLightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}

.galleryLightbox .lbNav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  font-size: 28px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 4px;
}

.galleryLightbox .lbNav:hover { background: rgba(255, 255, 255, 0.35); }
.galleryLightbox .lbPrev { left: 16px; }
.galleryLightbox .lbNext { right: 16px; }

.galleryLightbox .lbClose {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  font-size: 22px;
  padding: 4px 12px;
  cursor: pointer;
  border-radius: 4px;
}

/* Sample files panel */
.sampleFilesPanel {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 16px;
}

.sampleFilesHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel2);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sampleFilesBody { padding: 12px; }
.sampleFilesBody.collapsed { display: none; }
.sampleFileGroup { margin-bottom: 10px; }
.sampleFileGroup summary { font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text); }

.sampleFileGroup a {
  font-size: 12px;
  color: var(--andari-teal);
  text-decoration: none;
  display: block;
  padding: 2px 0 2px 16px;
}

.sampleFileGroup a:hover { text-decoration: underline; }

/* Style form sticky actions override */
.styleFormActions .btn {
  flex: 1;
  min-width: 180px;
}

/* Advanced costing panel */
.advancedCostingPanel {
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fffbeb 0%, #f5f5f5 100%);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 16px;
}

.advancedCostingPanel h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

[data-theme="dark"] .advancedCostingPanel {
  background: rgba(251, 191, 36, 0.06);
  border-color: var(--stroke);
}

/* Responsive */
@media (max-width: 768px) {
  .app {
    padding: 20px 16px;
  }

  .statusCards {
    grid-template-columns: 1fr;
  }

  .dashboardGrid {
    grid-template-columns: 1fr;
  }

  .filterRow {
    grid-template-columns: 1fr;
  }

  .formRow {
    grid-template-columns: 1fr;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

.modalContent {
  background: var(--panel);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp var(--duration-normal) var(--ease-out);
}

.modalContent h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

/* Checkbox Dropdown Multi-Select */
.checkboxDropdown {
  position: relative;
  width: 100%;
}

.checkboxDropdownToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.checkboxDropdownToggle:hover {
  border-color: var(--blue);
}

.checkboxDropdownToggle:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.checkboxDropdown.open .checkboxDropdownToggle {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.checkboxDropdownText {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkboxDropdownIcon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
  color: var(--muted);
}

.checkboxDropdown.open .checkboxDropdownIcon {
  transform: rotate(180deg);
}

.checkboxDropdownMenu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.checkboxDropdown.open .checkboxDropdownMenu {
  display: block;
}

.checkboxDropdownItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s;
  user-select: none;
}

.checkboxDropdownItem:hover {
  background: var(--panel2);
}

.checkboxDropdownItem input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--andari-teal);
}

.checkboxDropdownItem span {
  font-size: 14px;
  color: var(--text);
}

.checkboxDropdownSelectAll {
  font-weight: 500;
  color: var(--andari-teal);
}

.checkboxDropdownSelectAll span {
  color: var(--andari-teal);
}

.checkboxDropdownDivider {
  height: 1px;
  background: var(--stroke);
  margin: 4px 0;
}

.checkboxDropdownOptions {
  max-height: 200px;
  overflow-y: auto;
}

/* ==================== COSTING MODULE STYLES ==================== */

/* Costing Summary Cards */
.costingSummary {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.summaryCard {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 140px;
}

.summaryCard .summaryIcon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.summaryCard.pending .summaryIcon {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.summaryCard.inProgress .summaryIcon {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.summaryCard.completed .summaryIcon {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.summaryCard .summaryText {
  display: flex;
  flex-direction: column;
}

.summaryCount {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.1;
}

.summaryLabel {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.2px;
}

/* Costing Status Badges */
.statusBadge.costingNone {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
}

.statusBadge.costingRequested {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

.statusBadge.costingInProgress {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}

.statusBadge.costingCompleted {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

.statusBadge.costingRejected {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef4444;
}

/* Pricing Modal */
.pricingInfo {
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
}

.pricingInfoRow {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.pricingInfoRow span:first-child {
  color: var(--text-muted);
}

.pricingInfoRow span:last-child {
  font-weight: 500;
}

.priceTierRow {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: flex-end;
}

.domesticTiersHelp {
  margin: 0 0 10px;
  color: #666;
  font-size: 13px;
}

.fullPackageYarnSection {
  margin-bottom: 16px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #fbfefd;
  padding: 12px;
}

.yarnRefWarning {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
}

.yarnRefWarning a {
  color: #0f766e;
  text-decoration: underline;
}

.yarnRefTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--stroke);
}

.yarnRefTable th,
.yarnRefTable td {
  padding: 8px;
  border-bottom: 1px solid #e7eceb;
  text-align: left;
}

.yarnRefTable th {
  background: #f4f8f7;
  font-weight: 600;
}

.yarnRefStatus {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.yarnRefStatus.priced {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

.yarnRefStatus.missing {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef4444;
}

.yarnRefSummary {
  margin-top: 10px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #444;
}

@media (max-width: 760px) {
  .yarnRefTable thead {
    display: none;
  }

  .yarnRefTable,
  .yarnRefTable tbody,
  .yarnRefTable tr,
  .yarnRefTable td {
    display: block;
    width: 100%;
  }

  .yarnRefTable tr {
    border-bottom: 1px solid #e7eceb;
    padding: 8px 0;
  }

  .yarnRefTable td {
    border-bottom: none;
    padding: 4px 8px;
  }

  .yarnRefTable td::before {
    content: attr(data-label);
    display: inline-block;
    width: 120px;
    font-weight: 600;
    color: #4b5563;
  }
}

/* Customer Margins */
.marginCell .marginDisplay {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.marginCell .marginDisplay:hover {
  background: var(--hover-bg, #f0f0f0);
}

.marginInput {
  padding: 2px 4px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  font-size: 13px;
  background: var(--panel);
  color: var(--text);
}

.marginInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* ==================== NOTIFICATION BELL STYLES ==================== */

.notificationBell {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 6px;
  z-index: 1300;
}

.notificationBellBtn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--text);
}

.notificationBellBtn:hover {
  background: var(--panel2);
}

.notificationBadge {
  position: absolute;
  top: 0;
  right: 0;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.notificationDropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  background: #ffffff;
  opacity: 1;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1400;
  overflow: hidden;
}

.notificationHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  background: #f5f5f5;
}

.notificationHeader span {
  font-weight: 600;
  font-size: 14px;
}

.notificationMarkAllRead {
  background: none;
  border: none;
  color: var(--andari-teal);
  font-size: 12px;
  cursor: pointer;
}

.notificationMarkAllRead:hover {
  text-decoration: underline;
}

.notificationList {
  max-height: 340px;
  overflow-y: auto;
  background: #ffffff;
}

.notificationItem {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
  transition: background 0.2s;
  background: #ffffff;
}

.notificationItem:hover {
  background: var(--panel2);
}

.notificationItem.unread {
  background: #eff6ff;
}

.notificationItem.unread:hover {
  background: #dbeafe;
}

.notificationTitle {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.notificationMessage {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.notificationTime {
  font-size: 11px;
  color: #9ca3af;
}

.notificationEmpty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==================== SELECTION ACTION BAR ==================== */

.selectionActionBar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.selectionActionBar span {
  font-size: 14px;
  font-weight: 500;
}

.selectionActionBar .btn {
  padding: 8px 16px;
  font-size: 13px;
}

.selectionActionBar .btn.primary {
  background: var(--andari-teal);
  border-color: var(--andari-teal);
}

.selectionActionBar .btn.primary:hover {
  background: var(--andari-teal-light);
  border-color: var(--andari-teal-light);
}

.selectionActionBar .btn:not(.primary) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.selectionActionBar .btn:not(.primary):hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Sample checkbox styling */
.sampleCheckbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--andari-teal);
}

.sampleCheckbox:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Pagination controls */
.paginationControls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
  margin-top: 8px;
}
.paginationInfo {
  font-size: 13px;
  color: var(--text-muted);
}
.paginationButtons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.paginationBtn {
  padding: 4px 12px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.paginationBtn:disabled {
  opacity: 0.4;
  cursor: default;
}
.paginationBtn:hover:not(:disabled) {
  background: var(--panel2);
}
.paginationPage {
  font-size: 13px;
  color: var(--text);
}
.paginationSize {
  padding: 4px 8px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
  color: var(--text);
}

/* ==================== RECYCLE BIN (USER MENU) + PAGE STYLES ==================== */

.userMenuItem.recycleBin {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  text-decoration: none;
}

.userMenuItem.recycleBin svg {
  flex-shrink: 0;
  color: var(--muted);
}

.userMenuItem.recycleBin:hover svg {
  color: var(--text);
}

.userMenuItem.recycleBin.active {
  color: var(--andari-teal);
}

.userMenuItem.recycleBin.active svg {
  color: var(--andari-teal);
}

.recycleBinBadge {
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: auto;
}

.trashTypeBadge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}

.trashTypeSample {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}

.trashTypeOverseas {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #6366f1;
}

.trashTypeStyle {
  background: #e9d5ff;
  color: #6b21a8;
  border-color: #9333ea;
}

.trashTypeCustomer {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

.trashTypeYarn {
  background: #fef3c7;
  color: #92400e;
  border-color: #fbbf24;
}

.trashTypeYarnMill {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #14b8a6;
}

.trashActions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.trashExpiringSoon {
  color: #d97706;
  font-weight: 500;
}

.trashExpired {
  color: #dc2626;
  font-weight: 500;
}

.btn.danger {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

.btn.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ── FilterBar ────────────────────────────────────────── */
.filterBar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.filterBarViewBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.filterBarViewSelector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filterBarViewSelect {
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  min-width: 160px;
}

.filterBarViewActions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filterBarBtn {
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.filterBarBtn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.filterBarBtnAdd {
  color: #2563eb;
  border-color: #93c5fd;
}

.filterBarBtnAdd:hover {
  background: #eff6ff;
}

.filterBarBtnDelete {
  color: #dc2626;
  border-color: #fca5a5;
}

.filterBarBtnDelete:hover {
  background: #fef2f2;
}

.filterBarFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filterBarFilterItem {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.filterBarFilterLabel {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filterBarInput,
.filterBarSelect,
.filterBarDateInput {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  min-width: 140px;
}

.filterBarInput:focus,
.filterBarSelect:focus,
.filterBarDateInput:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.filterBarDateRange {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filterBarDateRange .filterBarDateInput {
  min-width: 120px;
}

.filterBarDateSeparator {
  color: #94a3b8;
  font-size: 13px;
}

.filterBarFilterRemove {
  position: absolute;
  top: -2px;
  right: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.filterBarFilterItem:hover .filterBarFilterRemove {
  opacity: 1;
}

.filterBarActions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.filterBarCheckboxDropdown {
  min-width: 160px;
  width: auto;
}

.filterBarCheckboxDropdown .checkboxDropdownToggle {
  width: auto;
  min-width: 160px;
  padding: 6px 10px;
  font-size: 13px;
  gap: 8px;
}

.filterBarCheckboxDropdown .checkboxDropdownMenu.open {
  display: block;
}

/* Add Filter Menu */
.filterBarAddMenu {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 4px;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
}

.filterBarAddMenuItem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: #334155;
}

.filterBarAddMenuItem:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.tabBar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 16px;
}

.tabBar .tabBtn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabBar .tabBtn:hover {
  color: var(--text);
}

.tabBar .tabBtn.active {
  color: var(--andari-teal);
  border-bottom-color: var(--andari-teal);
}

.tabPanel {
  display: none;
}

.tabPanel.active {
  display: block;
}

/* Milestone timeline */
.milestoneTable {
  width: 100%;
  border-collapse: collapse;
}
.milestoneTable th,
.milestoneTable td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.milestoneTable th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.milestoneTable input[type="date"] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.milestoneComplete {
  color: #059669;
  font-weight: 500;
}

/* Cutting ticket quantities grid */
.quantitiesGrid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.quantitiesGrid th,
.quantitiesGrid td {
  padding: 6px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.quantitiesGrid th {
  background: var(--bg-muted, #f8f9fa);
  font-weight: 600;
  font-size: 12px;
}
.quantitiesGrid td:first-child,
.quantitiesGrid th:first-child {
  text-align: left;
  font-weight: 500;
}
.quantitiesGrid .totalRow td,
.quantitiesGrid .totalCol {
  font-weight: 700;
  background: var(--bg-muted, #f8f9fa);
}
.quantitiesGrid .grandTotal {
  font-weight: 700;
  background: #e0e7ff;
  color: #3730a3;
}

/* Print view */
.printHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.printActions {
  display: flex;
  gap: 8px;
}
.printDetail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-muted, #f8f9fa);
  border-radius: 8px;
}
.printDetailItem label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.printDetailItem span {
  font-size: 14px;
  font-weight: 500;
}

/* ==================== STICKY FROSTED GLASS HEADER ==================== */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--duration-fast) ease;
}

.header.scrolled {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.85);
}

[data-theme="dark"] .header.scrolled {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

/* Nav active state — rounded pill background */
.navLink.active {
  background: rgba(15, 118, 110, 0.12);
  border-radius: 8px;
}

[data-theme="dark"] .navLink.active {
  background: rgba(20, 184, 166, 0.15);
}

/* ==================== SCROLL-TO-TOP BUTTON ==================== */

.scrollToTop {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--duration-normal) var(--ease-out), visibility var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out), background var(--duration-fast) ease, color var(--duration-fast) ease;
  z-index: 999;
}

.scrollToTop.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scrollToTop:hover {
  background: var(--andari-teal);
  color: white;
  border-color: var(--andari-teal);
}

/* ==================== PAGE BACKGROUND TEXTURE ==================== */

body {
  background: var(--bg);
  background-image: radial-gradient(circle at 20% 20%, rgba(15, 118, 110, 0.02) 0%, transparent 50%),
                     radial-gradient(circle at 80% 80%, rgba(15, 118, 110, 0.015) 0%, transparent 50%);
}

[data-theme="dark"] body {
  background-image: radial-gradient(circle at 20% 20%, rgba(20, 184, 166, 0.03) 0%, transparent 50%),
                     radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.02) 0%, transparent 50%);
}

/* ==================== RICH EMPTY STATES ==================== */

.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  animation: fadeInUp var(--duration-normal) var(--ease-out);
}

.emptyStateIcon {
  width: 64px;
  height: 64px;
  color: var(--muted2);
  margin-bottom: 16px;
  opacity: 0.6;
}

.emptyStateTitle {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.emptyStateDescription {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 360px;
  line-height: 1.5;
}

.emptyStateCta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration-fast) ease;
}

.emptyStateCta:hover {
  background: var(--blue-light);
}

/* ==================== DASHBOARD ==================== */

.dashboardSection {
  margin-top: 1.5rem;
}

.dashboardSectionTitle {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.statusCardsSmall .statusCard {
  padding: 0.75rem 1rem;
}

.statusCardsSmall .statusCardCount {
  font-size: 1.25rem;
}

.dashboardGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.dashboardPanel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 1.25rem;
}

.overdueTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.overdueTable th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--stroke);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overdueTable td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--stroke);
  color: var(--text);
}

.overdueTable a {
  color: var(--andari-teal);
  text-decoration: none;
  font-weight: 500;
}

.overdueTable a:hover {
  text-decoration: underline;
}

.overdueBadge {
  display: inline-block;
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

[data-theme="dark"] .overdueBadge {
  background: #991b1b;
  color: #fca5a5;
}

.workloadRow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.workloadLabel {
  width: 120px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.workloadBarTrack {
  flex: 1;
  height: 24px;
  background: var(--panel2);
  border-radius: 6px;
  overflow: hidden;
}

.workloadBar {
  height: 100%;
  background: var(--andari-teal);
  border-radius: 6px;
  min-width: 4px;
  transition: width 0.6s ease;
}

.workloadCount {
  width: 32px;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.dueTodayBadge,
.dueSoonBadge,
.dueNormalBadge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.dueTodayBadge {
  background: #fee2e2;
  color: #dc2626;
}

.dueSoonBadge {
  background: #fef3c7;
  color: #d97706;
}

.dueNormalBadge {
  background: #dbeafe;
  color: #2563eb;
}

[data-theme="dark"] .dueTodayBadge {
  background: #991b1b;
  color: #fca5a5;
}

[data-theme="dark"] .dueSoonBadge {
  background: #78350f;
  color: #fde68a;
}

[data-theme="dark"] .dueNormalBadge {
  background: #1e3a5f;
  color: #93c5fd;
}

/* ==================== STATUS CARD ENHANCEMENTS ==================== */

.statusCard {
  border-left: 3px solid transparent;
}

.statusCard.notStarted { border-left-color: #9ca3af; }
.statusCard.programming { border-left-color: #3b82f6; }
.statusCard.knitting { border-left-color: #9333ea; }
.statusCard.informationNeeded { border-left-color: #dc2626; }
.statusCard.waitingForFinishing { border-left-color: #fbbf24; }
.statusCard.inProgress { border-left-color: #3b82f6; }
.statusCard.completed { border-left-color: #10b981; }
.statusCard.sentForReview { border-left-color: #3b82f6; }
.statusCard.submitted { border-left-color: #3b82f6; }
.statusCard.overseasInProgress { border-left-color: #fbbf24; }
.statusCard.shipped { border-left-color: #6366f1; }
.statusCard.received { border-left-color: #10b981; }
.statusCard.productionDraft { border-left-color: #9ca3af; }
.statusCard.productionConfirmed { border-left-color: #3b82f6; }
.statusCard.productionInProduction { border-left-color: #f97316; }
.statusCard.productionCompleted { border-left-color: #10b981; }
.statusCard.productionShipped { border-left-color: #6366f1; }
.statusCard.productionDelivered { border-left-color: #10b981; }

/* Staggered card entrance animation */
.statusCards .statusCard:nth-child(1) { animation: fadeInUp var(--duration-normal) var(--ease-out) 0ms both; }
.statusCards .statusCard:nth-child(2) { animation: fadeInUp var(--duration-normal) var(--ease-out) 50ms both; }
.statusCards .statusCard:nth-child(3) { animation: fadeInUp var(--duration-normal) var(--ease-out) 100ms both; }
.statusCards .statusCard:nth-child(4) { animation: fadeInUp var(--duration-normal) var(--ease-out) 150ms both; }
.statusCards .statusCard:nth-child(5) { animation: fadeInUp var(--duration-normal) var(--ease-out) 200ms both; }
.statusCards .statusCard:nth-child(6) { animation: fadeInUp var(--duration-normal) var(--ease-out) 250ms both; }
.statusCards .statusCard:nth-child(7) { animation: fadeInUp var(--duration-normal) var(--ease-out) 300ms both; }
.statusCards .statusCard:nth-child(8) { animation: fadeInUp var(--duration-normal) var(--ease-out) 350ms both; }

/* ==================== TABLE ROW ENHANCEMENTS ==================== */

.historyTable tbody tr.sampleRow,
.historyTable tbody tr.styleRow {
  border-left: 3px solid transparent;
  transition: background-color var(--duration-fast) ease, border-left-color var(--duration-fast) ease;
}

.historyTable tbody tr.sampleRow:hover,
.historyTable tbody tr.styleRow:hover {
  border-left-color: var(--andari-teal);
}

/* Row selection highlight */
.historyTable tbody tr.selected {
  background: rgba(15, 118, 110, 0.06);
}

[data-theme="dark"] .historyTable tbody tr.selected {
  background: rgba(20, 184, 166, 0.08);
}

/* Sticky table header shadow */
.historyTable thead.stuck {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .historyTable thead.stuck {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==================== FORM INLINE VALIDATION ==================== */

.formInput.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  animation: shake 0.4s ease;
}

.formInput.success {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.formError {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

.formSuccess {
  font-size: 12px;
  color: var(--green);
  margin-top: 4px;
}

/* ==================== SKELETON LOADING SYSTEM ==================== */

.skeleton {
  background: linear-gradient(90deg, var(--panel2) 25%, var(--stroke) 50%, var(--panel2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--stroke);
}

.skeleton-row .skeleton-cell {
  height: 16px;
  flex: 1;
}

.skeleton-card {
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  margin-bottom: 12px;
}

.skeleton-card .skeleton-photo {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  flex-shrink: 0;
}

.skeleton-badge {
  width: 80px;
  height: 24px;
  border-radius: 12px;
}

.skeleton-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

.skeleton-statusCard {
  padding: 20px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}

.skeleton-statusCard .skeleton-count {
  height: 36px;
  width: 48px;
  margin-bottom: 8px;
}

.skeleton-statusCard .skeleton-label {
  height: 14px;
  width: 100px;
}

/* Button loading state */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  color: var(--muted);
}

.btn.primary.loading::after {
  color: white;
}

/* ==================== TOAST NOTIFICATIONS ==================== */

.toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  animation: slideInRight var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  min-width: 280px;
}

.toast.removing {
  animation: fadeOut var(--duration-fast) var(--ease-in-out) forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(24px); }
}

.toastIcon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toastBody {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}

.toastClose {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--muted2);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}

.toastClose:hover {
  color: var(--text);
  background: var(--panel2);
}

.toastProgress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 10px 10px;
  animation: toastProgress linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.success { border-left: 4px solid var(--green); }
.toast.success .toastIcon { color: var(--green); }
.toast.success .toastProgress { background: var(--green); }

.toast.error { border-left: 4px solid var(--red); }
.toast.error .toastIcon { color: var(--red); }
.toast.error .toastProgress { background: var(--red); }

.toast.warning { border-left: 4px solid var(--yellow); }
.toast.warning .toastIcon { color: var(--yellow); }
.toast.warning .toastProgress { background: var(--yellow); }

.toast.info { border-left: 4px solid var(--andari-teal); }
.toast.info .toastIcon { color: var(--andari-teal); }
.toast.info .toastProgress { background: var(--andari-teal); }

/* ==================== CUSTOM CONFIRM MODAL ==================== */

.confirmOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

.confirmDialog {
  background: var(--panel);
  border-radius: 12px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: fadeInUp var(--duration-normal) var(--ease-out);
}

.confirmTitle {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.confirmMessage {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.confirmActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirmActions .btn {
  min-width: 80px;
  justify-content: center;
  font-weight: 500;
}

.confirmActions .btn.confirmDanger {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.confirmActions .btn.confirmDanger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ==================== DARK MODE ==================== */

[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #334155;
  --stroke: #475569;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --muted2: #64748b;
  --text-inverse: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
  --andari-teal: #14b8a6;
  --andari-teal-light: #2dd4bf;
  --andari-teal-dark: #0d9488;
  --blue: #14b8a6;
  --blue-light: #2dd4bf;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --green: #34d399;
  --gray: #9ca3af;
  --surface-success: #064e3b;
  --surface-warning: #451a03;
  --surface-error: #450a0a;
  --surface-info: #172554;
  --bg-warm: #1e293b;
  --bg-subtle: #1e293b;
}

/* Dark mode: hardcoded white backgrounds → use variable */
[data-theme="dark"] .navDropdownMenu,
[data-theme="dark"] .navDropdown.active .navDropdownMenu {
  background: var(--panel) !important;
  border-color: var(--stroke);
}

[data-theme="dark"] .navDropdownItem {
  color: var(--text) !important;
  background: var(--panel) !important;
  border-bottom-color: var(--stroke);
}

[data-theme="dark"] .navDropdownItem:hover {
  background: rgba(20, 184, 166, 0.12) !important;
  color: var(--andari-teal) !important;
}

[data-theme="dark"] .navDropdownItem.active {
  background: rgba(20, 184, 166, 0.18) !important;
  color: var(--andari-teal) !important;
}

[data-theme="dark"] .hamburgerBtn {
  border-color: var(--stroke);
}

[data-theme="dark"] .hamburgerBtn:hover {
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.4);
}

[data-theme="dark"] .navBackdrop {
  background: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .navOverflowSection {
  color: var(--muted);
}

@media (max-width: 1024px) {
  [data-theme="dark"] .nav {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

[data-theme="dark"] .userMenu {
  background: var(--panel);
  border-color: var(--stroke);
}

[data-theme="dark"] .userMenuItem {
  color: var(--text);
}

[data-theme="dark"] .userMenuItem:hover {
  background: var(--panel2);
}

[data-theme="dark"] .userInfo {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, var(--panel) 100%);
  border-color: rgba(20, 184, 166, 0.2);
}

[data-theme="dark"] .filtersSection {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.05) 0%, var(--panel) 100%);
  border-color: var(--stroke);
}

[data-theme="dark"] .filterBar {
  background: var(--panel);
  border-color: var(--stroke);
}

[data-theme="dark"] .filterBarViewBar {
  border-bottom-color: var(--stroke);
}

[data-theme="dark"] .filterBarBtn {
  background: var(--panel);
  border-color: var(--stroke);
  color: var(--text);
}

[data-theme="dark"] .filterBarBtn:hover {
  background: var(--panel2);
}

[data-theme="dark"] .filterBarInput,
[data-theme="dark"] .filterBarSelect,
[data-theme="dark"] .filterBarDateInput,
[data-theme="dark"] .filterBarViewSelect {
  background: var(--panel2);
  border-color: var(--stroke);
  color: var(--text);
}

[data-theme="dark"] .filterBarAddMenu {
  background: var(--panel);
  border-color: var(--stroke);
}

[data-theme="dark"] .filterBarAddMenuItem {
  color: var(--text);
}

[data-theme="dark"] .filterBarAddMenuItem:hover {
  background: var(--panel2);
}

[data-theme="dark"] .filterBarActions {
  border-top-color: var(--stroke);
}

/* Dark mode: notification panel */
[data-theme="dark"] .notificationDropdown {
  background: var(--panel);
  border-color: var(--stroke);
}

[data-theme="dark"] .notificationHeader {
  background: var(--panel2);
  border-bottom-color: var(--stroke);
}

[data-theme="dark"] .notificationList {
  background: var(--panel);
}

[data-theme="dark"] .notificationItem {
  background: var(--panel);
  border-bottom-color: var(--stroke);
}

[data-theme="dark"] .notificationItem.unread {
  background: rgba(20, 184, 166, 0.08);
}

[data-theme="dark"] .notificationItem.unread:hover {
  background: rgba(20, 184, 166, 0.14);
}

/* Dark mode: status badges (adjust for contrast) */
[data-theme="dark"] .statusBadge.pending,
[data-theme="dark"] .statusBadge.notStarted {
  background: #374151; color: #d1d5db; border-color: #6b7280;
}
[data-theme="dark"] .statusBadge.programming {
  background: #1e3a5f; color: #93c5fd; border-color: #3b82f6;
}
[data-theme="dark"] .statusBadge.knitting {
  background: #3b1f5e; color: #d8b4fe; border-color: #9333ea;
}
[data-theme="dark"] .statusBadge.informationNeeded {
  background: #5c1a1a; color: #fca5a5; border-color: #dc2626;
}
[data-theme="dark"] .statusBadge.waitingForFinishing {
  background: #4a3000; color: #fde68a; border-color: #fbbf24;
}
[data-theme="dark"] .statusBadge.inProgress {
  background: #1e3a5f; color: #93c5fd; border-color: #3b82f6;
}
[data-theme="dark"] .statusBadge.completed {
  background: #064e3b; color: #6ee7b7; border-color: #10b981;
}
[data-theme="dark"] .statusBadge.cancelled {
  background: #5c1a1a; color: #fca5a5; border-color: #ef4444;
}
[data-theme="dark"] .statusBadge.submitted {
  background: #1e3a5f; color: #93c5fd; border-color: #3b82f6;
}
[data-theme="dark"] .statusBadge.overseasInProgress {
  background: #4a3000; color: #fde68a; border-color: #fbbf24;
}
[data-theme="dark"] .statusBadge.shipped {
  background: #2e1e5e; color: #c4b5fd; border-color: #6366f1;
}
[data-theme="dark"] .statusBadge.received {
  background: #064e3b; color: #6ee7b7; border-color: #10b981;
}
[data-theme="dark"] .statusBadge.internalReview {
  background: #2e1065; color: #c4b5fd; border-color: #8b5cf6;
}
[data-theme="dark"] .statusBadge.sentForReview {
  background: #1e3a5f; color: #93c5fd; border-color: #3b82f6;
}
[data-theme="dark"] .statusBadge.feedbackReceived {
  background: #4a2000; color: #fdba74; border-color: #f97316;
}
[data-theme="dark"] .statusBadge.feedbackReviewed {
  background: #064e3b; color: #6ee7b7; border-color: #6b7280;
}
[data-theme="dark"] .statusBadge.inProduction {
  background: #4a2600; color: #fdba74; border-color: #f97316;
}
[data-theme="dark"] .statusBadge.final {
  background: #064e3b; color: #6ee7b7; border-color: #10b981;
}

/* Dark mode: costing badges */
[data-theme="dark"] .statusBadge.costingNone { background: #374151; color: #d1d5db; border-color: #6b7280; }
[data-theme="dark"] .statusBadge.costingRequested { background: #4a3000; color: #fde68a; border-color: #f59e0b; }
[data-theme="dark"] .statusBadge.costingInProgress { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }
[data-theme="dark"] .statusBadge.costingCompleted { background: #064e3b; color: #6ee7b7; border-color: #10b981; }
[data-theme="dark"] .statusBadge.costingRejected { background: #5c1a1a; color: #fca5a5; border-color: #ef4444; }

/* Dark mode: production status badges */
[data-theme="dark"] .statusBadge.productionDraft { background: #374151; color: #d1d5db; border-color: #6b7280; }
[data-theme="dark"] .statusBadge.productionConfirmed { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }
[data-theme="dark"] .statusBadge.productionInProduction { background: #4a2600; color: #fdba74; border-color: #f97316; }
[data-theme="dark"] .statusBadge.productionCompleted { background: #064e3b; color: #6ee7b7; border-color: #10b981; }
[data-theme="dark"] .statusBadge.productionShipped { background: #2e1e5e; color: #c4b5fd; border-color: #6366f1; }
[data-theme="dark"] .statusBadge.productionDelivered { background: #064e3b; color: #6ee7b7; border-color: #10b981; }
[data-theme="dark"] .statusBadge.productionCancelled { background: #5c1a1a; color: #fca5a5; border-color: #ef4444; }

/* Dark mode: cutting ticket badges */
[data-theme="dark"] .statusBadge.ctDraft { background: #374151; color: #d1d5db; border-color: #6b7280; }
[data-theme="dark"] .statusBadge.ctIssued { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }
[data-theme="dark"] .statusBadge.ctInProgress { background: #4a2600; color: #fdba74; border-color: #f97316; }
[data-theme="dark"] .statusBadge.ctCompleted { background: #064e3b; color: #6ee7b7; border-color: #10b981; }

/* Dark mode: status card icons */
[data-theme="dark"] .statusCardIcon.notStarted { background: #374151; color: #9ca3af; }
[data-theme="dark"] .statusCardIcon.programming { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .statusCardIcon.knitting { background: #3b1f5e; color: #a78bfa; }
[data-theme="dark"] .statusCardIcon.informationNeeded { background: #5c1a1a; color: #f87171; }
[data-theme="dark"] .statusCardIcon.waitingForFinishing { background: #4a3000; color: #fbbf24; }
[data-theme="dark"] .statusCardIcon.inProgress { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .statusCardIcon.completed { background: #064e3b; color: #34d399; }
[data-theme="dark"] .statusCardIcon.internalReview { background: #2e1065; color: #a78bfa; }
[data-theme="dark"] .statusCardIcon.sentForReview { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .statusCardIcon.feedbackReceived { background: #4a2000; color: #fb923c; }
[data-theme="dark"] .statusCardIcon.feedbackReviewed { background: #064e3b; color: #34d399; }

/* Dark mode: expanded rows */
[data-theme="dark"] .historyTable tbody tr.sampleRow.expanded,
[data-theme="dark"] .historyTable tbody tr.styleRow.expanded {
  background: rgba(20, 184, 166, 0.08);
}

[data-theme="dark"] .historyTable tbody tr.historyRow,
[data-theme="dark"] .historyTable tbody tr.samplesRow {
  background: var(--panel2);
}

/* Dark mode: queue group headers */
[data-theme="dark"] .queueGroupHeader { background: var(--panel2); border-color: var(--stroke); }
[data-theme="dark"] .queueGroupHeader:hover { background: var(--hover, #334155); }

/* Dark mode: queue item */
[data-theme="dark"] .queueItem.drag-over {
  border-color: var(--andari-teal);
  background: rgba(20, 184, 166, 0.08);
}

/* Dark mode: form style info panel */
[data-theme="dark"] .styleInfoPanel {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.06) 0%, var(--panel2) 100%);
  border-color: var(--stroke);
}

[data-theme="dark"] .yarnSectionPanel {
  background: rgba(59, 130, 246, 0.06);
  border-color: var(--stroke);
}

[data-theme="dark"] .trimSectionPanel {
  background: rgba(168, 85, 247, 0.06);
  border-color: var(--stroke);
}

[data-theme="dark"] .colorwaySectionPanel {
  background: rgba(20, 184, 166, 0.06);
  border-color: var(--stroke);
}

[data-theme="dark"] .sampleDetailsSectionPanel {
  background: rgba(244, 63, 94, 0.06);
  border-color: var(--stroke);
}

[data-theme="dark"] .costingSectionPanel {
  background: rgba(251, 191, 36, 0.06);
  border-color: var(--stroke);
}

[data-theme="dark"] .datesSectionPanel {
  background: var(--panel2);
  border-color: var(--stroke);
}

/* Dark mode: style form sections */
[data-theme="dark"] .styleFormSection { border-color: var(--stroke); }
[data-theme="dark"] .styleFormSection[data-section="identity"] .sectionHeader { background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .styleFormSection[data-section="specs"] .sectionHeader { background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .styleFormSection[data-section="yarns"] .sectionHeader { background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .styleFormSection[data-section="poms"] .sectionHeader { background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .styleFormSection[data-section="trims"] .sectionHeader { background: linear-gradient(135deg, rgba(225, 29, 72, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .styleFormSection[data-section="samples"] .sectionHeader { background: linear-gradient(135deg, rgba(217, 119, 6, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .styleFormSection[data-section="files"] .sectionHeader { background: var(--panel2); }
[data-theme="dark"] .styleFormSection[data-section="gallery"] .sectionHeader { background: linear-gradient(135deg, rgba(219, 39, 119, 0.08) 0%, var(--panel2) 100%); }
[data-theme="dark"] .galleryDropZone { border-color: var(--stroke); }
[data-theme="dark"] .galleryDropZone:hover,
[data-theme="dark"] .galleryDropZone.dragover { background: rgba(20, 184, 166, 0.06); }

/* Dark mode: costing banner */
[data-theme="dark"] .costingBanner.ready {
  background: #064e3b; color: #6ee7b7; border-color: #10b981;
}
[data-theme="dark"] .costingBanner.notReady {
  background: #5c1a1a; color: #fca5a5; border-color: #ef4444;
}

/* Dark mode: form readonly */
[data-theme="dark"] .formInput[readonly] {
  background-color: var(--panel2);
  color: var(--muted);
}

/* Dark mode: selection action bar */
[data-theme="dark"] .selectionActionBar {
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Dark mode: yarn ref table, quantities grid */
[data-theme="dark"] .yarnRefTable {
  background: var(--panel); border-color: var(--stroke);
}
[data-theme="dark"] .yarnRefTable th { background: var(--panel2); }
[data-theme="dark"] .yarnRefTable td { border-bottom-color: var(--stroke); }
[data-theme="dark"] .yarnRefWarning { background: #451a03; color: #fde68a; border-color: #f59e0b; }
[data-theme="dark"] .fullPackageYarnSection { background: var(--panel2); border-color: var(--stroke); }

/* Dark mode: overdue/dueToday badges */
[data-theme="dark"] .queueItemValue.overdue::after { background: #5c1a1a; color: #fca5a5; border-color: #ef4444; }
[data-theme="dark"] .queueItemValue.dueToday::after { background: #4a2600; color: #fdba74; border-color: #fb923c; }

/* Dark mode: trash type badges */
[data-theme="dark"] .trashTypeSample { background: #1e3a5f; color: #93c5fd; border-color: #3b82f6; }
[data-theme="dark"] .trashTypeOverseas { background: #2e1e5e; color: #c4b5fd; border-color: #6366f1; }
[data-theme="dark"] .trashTypeStyle { background: #3b1f5e; color: #d8b4fe; border-color: #9333ea; }
[data-theme="dark"] .trashTypeCustomer { background: #064e3b; color: #6ee7b7; border-color: #10b981; }
[data-theme="dark"] .trashTypeYarn { background: #4a3000; color: #fde68a; border-color: #fbbf24; }
[data-theme="dark"] .trashTypeYarnMill { background: #134e4a; color: #5eead4; border-color: #14b8a6; }

/* Dark mode: photo tooltip */
[data-theme="dark"] .photoTooltipImage { border-color: var(--stroke); background: var(--panel); }

/* Dark mode: select dropdown arrow for dark bg */
[data-theme="dark"] select.formInput,
[data-theme="dark"] .filterSelect {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Dark mode: formCard filter variant */
[data-theme="dark"] .formCard[aria-label="Filters"] {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.05) 0%, var(--panel) 100%);
  border-color: var(--stroke);
}

/* Dark mode: checkbox dropdown */
[data-theme="dark"] .checkboxDropdownMenu {
  background: var(--panel);
  border-color: var(--stroke);
}

/* Dark mode: tab bar */
[data-theme="dark"] .tabBar { border-bottom-color: var(--stroke); }

/* Dark mode: print detail */
[data-theme="dark"] .printDetail { background: var(--panel2); }

/* Dark mode: quantities grid */
[data-theme="dark"] .quantitiesGrid th,
[data-theme="dark"] .quantitiesGrid .totalRow td,
[data-theme="dark"] .quantitiesGrid .totalCol { background: var(--panel2); }
[data-theme="dark"] .quantitiesGrid .grandTotal { background: #2e1e5e; color: #c4b5fd; }
[data-theme="dark"] .quantitiesGrid th,
[data-theme="dark"] .quantitiesGrid td { border-color: var(--stroke); }

/* Dark mode: toast & confirm */
[data-theme="dark"] .toast {
  background: var(--panel);
  border-color: var(--stroke);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .confirmDialog {
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* Dark mode: skeleton */
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--panel2) 25%, var(--stroke) 50%, var(--panel2) 75%);
  background-size: 200% 100%;
}

/* Dark mode: empty state */
[data-theme="dark"] .emptyStateIcon { color: var(--muted); }

/* Theme toggle button in user menu */
.userMenuItem.themeToggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.themeToggleIcon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Auto dark mode when system prefers dark (if no explicit preference set) */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
  }
}

/* ==================== ACTIVITY TIMELINE ==================== */

.activitySectionPanel {
  margin-top: 24px;
  border-top: 1px solid var(--stroke);
  padding-top: 16px;
}

.activitySectionPanel .panelSectionTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.activityEmpty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.activityList {
  position: relative;
  padding-left: 20px;
}

.activityList::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--stroke);
  border-radius: 1px;
}

.activityEntry {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

.activityDot {
  position: absolute;
  left: -20px;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--panel, #fff);
  z-index: 1;
}

.activityContent {
  flex: 1;
  min-width: 0;
}

.activityDesc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.activityDesc b {
  font-weight: 600;
}

.activityLabel {
  display: inline-block;
  background: var(--panel2, #f3f4f6);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}

.activityMeta {
  font-size: 12px;
  color: var(--muted2, #9ca3af);
  margin-top: 2px;
}

.activityShowMore {
  display: block;
  margin: 12px auto 4px;
  padding: 6px 16px;
  background: none;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.activityShowMore:hover {
  border-color: var(--andari-teal);
  color: var(--andari-teal);
}

/* Dark mode */
[data-theme="dark"] .activityDot {
  border-color: var(--panel, #1f2937);
}

[data-theme="dark"] .activityLabel {
  background: var(--panel2, #374151);
}

/* ==================== REVIEW COMMENTS ==================== */

.specReviewSections {
  margin-top: 32px;
}

.reviewSectionPanel {
  margin-top: 24px;
  border-top: 1px solid var(--stroke);
  padding-top: 16px;
}

.reviewSectionPanel .panelSectionTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.reviewSectionPanel .panelSectionTitle:hover {
  background: var(--panel2);
}
.reviewSectionPanel .collapseIcon {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
}
.reviewSectionPanel .collapseIcon.collapsed {
  transform: rotate(-90deg);
}
.reviewSectionPanel .reviewSectionBody.collapsed {
  display: none;
}

.reviewCommentForm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--panel2);
  border-radius: 8px;
  margin-bottom: 12px;
}

.reviewCommentForm .formRow {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.reviewCommentForm select,
.reviewCommentForm input,
.reviewCommentForm textarea {
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.reviewCommentForm textarea {
  min-height: 60px;
  resize: vertical;
}

.reviewCommentForm .btn {
  align-self: flex-end;
  flex-shrink: 0;
}

.reviewCommentList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.reviewCommentItem {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--stroke);
  font-size: 13px;
}

.reviewCommentItem:last-child {
  border-bottom: none;
}

.reviewCommentBody {
  flex: 1;
  min-width: 0;
}

.reviewCommentText {
  color: var(--text);
  line-height: 1.4;
}

.reviewPomBadge {
  display: inline-block;
  background: var(--andari-teal-bg, #e6f7f5);
  color: var(--andari-teal);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
}

.reviewAdjustment {
  font-weight: 600;
  color: var(--andari-teal);
}

.reviewCommentMeta {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 2px;
}

.reviewCommentDelete {
  background: none;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.reviewCommentItem:hover .reviewCommentDelete {
  opacity: 1;
}

.reviewCommentDelete:hover {
  color: var(--red);
}

.reviewFileZone {
  border: 2px dashed var(--stroke);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 12px;
  transition: border-color var(--duration-fast) ease;
}

.reviewFileZone:hover,
.reviewFileZone.dragover {
  border-color: var(--andari-teal);
}

.reviewFileZone input[type="file"] {
  display: none;
}

.reviewFileList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reviewFileItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--panel2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
}

.reviewFileItem a {
  color: var(--andari-teal);
  text-decoration: none;
}

.reviewFileItem a:hover {
  text-decoration: underline;
}

.reviewFileRemove {
  background: none;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}

.reviewFileRemove:hover {
  color: var(--red);
}

.reviewEmpty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
  font-style: italic;
}

.reviewRefDropdown {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}

.reviewRefDropdown select {
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  margin-left: 8px;
}

.reviewRefReadonly .reviewCommentItem {
  opacity: 0.7;
}

.reviewRefReadonly .reviewCommentDelete {
  display: none;
}

@media print {
  .header, .nav, .printActions, .userInfo, .filterBarContainer, #filterBarContainer {
    display: none !important;
  }
  .main {
    padding: 0 !important;
    margin: 0 !important;
  }
  .app {
    min-height: auto;
  }
  .queueCard, .formCard {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .printDetail {
    background: none;
    border: 1px solid #ccc;
  }
  body {
    font-size: 12px;
  }
  .specReviewSections {
    display: none !important;
  }
}

/* ==================== Workload Page ==================== */

/* Hero metrics strip */
.wl-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.wl-metric-tile {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}

.wl-metric-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.wl-metric-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.wl-metric-active::before { background: var(--andari-teal); }
.wl-metric-completed::before { background: var(--green); }
.wl-metric-overdue::before { background: var(--red); }
.wl-metric-turnaround::before { background: var(--yellow); }
.wl-metric-styles::before { background: var(--andari-teal-light); }
.wl-metric-costing::before { background: var(--orange); }

.wl-metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 8px;
}

.wl-metric-number {
  margin-bottom: 4px;
}

.wl-metric-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  font-family: var(--font-sans);
}

.wl-metric-value.wl-danger { color: var(--red); }
.wl-metric-value.wl-warn { color: var(--orange); }

.wl-metric-sub {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 4px;
}

/* Toolbar */
.wl-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wl-toolbar-left,
.wl-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.wl-period-selector {
  display: flex;
  background: var(--panel2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--stroke);
}

.wl-period-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--duration-fast);
  letter-spacing: 0.3px;
}

.wl-period-btn:hover {
  color: var(--text);
}

.wl-period-btn.active {
  background: var(--andari-teal);
  color: #fff;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.3);
}

.wl-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wl-date-input {
  width: 130px;
  font-size: 12px;
  padding: 6px 8px;
}

.wl-date-sep {
  color: var(--muted2);
  font-size: 14px;
}

/* View toggle */
.wl-view-toggle {
  display: flex;
  background: var(--panel2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--stroke);
}

.wl-view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--duration-fast);
}

.wl-view-btn:hover { color: var(--text); }

.wl-view-btn.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.wl-view-btn svg { opacity: 0.6; }
.wl-view-btn.active svg { opacity: 1; }

.wl-manage-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Table section */
.wl-table-section {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wl-table {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.wl-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.wl-th-num {
  text-align: right;
  width: 80px;
}

.wl-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.wl-sortable:hover { color: var(--andari-teal); }

.wl-sortable::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.3;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.wl-sort-asc::after { opacity: 1; border-top: none; border-bottom: 5px solid var(--andari-teal); }
.wl-sort-desc::after { opacity: 1; border-top: 5px solid var(--andari-teal); }

/* Table rows */
.wl-row {
  cursor: pointer;
  transition: background var(--duration-fast);
}

.wl-row:hover td { background: var(--panel2); }

.wl-row-expanded td {
  background: #f0fdfa;
  border-bottom-color: transparent;
}

[data-theme="dark"] .wl-row-expanded td {
  background: rgba(20, 184, 166, 0.08);
}

.wl-cell-team { min-width: 160px; }
.wl-cell-customers { max-width: 280px; }
.wl-cell-num { text-align: right; font-variant-numeric: tabular-nums; }

.wl-team-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.wl-team-members {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.wl-customers-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wl-customer-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--panel2);
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  white-space: nowrap;
}

.wl-num-big {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.wl-num-mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.wl-num-zero { color: var(--muted2); }
.wl-no-data { color: var(--muted2); font-size: 12px; }

.wl-badge-overdue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(220, 38, 38, 0.1);
  color: var(--red);
  font-weight: 700;
  font-size: 12px;
}

.wl-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.wl-role-associate { background: #dbeafe; color: #2563eb; }
.wl-role-assistant { background: #fef3c7; color: #d97706; }

[data-theme="dark"] .wl-role-associate { background: rgba(37, 99, 235, 0.2); }
[data-theme="dark"] .wl-role-assistant { background: rgba(217, 119, 6, 0.2); }

/* On-time progress bar */
.wl-ontime-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.wl-ontime-bar {
  width: 48px;
  height: 6px;
  background: var(--panel2);
  border-radius: 3px;
  overflow: hidden;
}

.wl-ontime-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease-out;
}

.wl-ontime-label {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* Expanded detail */
.wl-expand-row > td {
  padding: 0 !important;
  background: var(--panel2);
  border-bottom: 2px solid var(--andari-teal);
}

[data-theme="dark"] .wl-expand-row > td {
  background: rgba(20, 184, 166, 0.04);
}

.wl-detail {
  padding: 20px 24px;
}

.wl-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.wl-block {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 14px 16px;
}

.wl-block-head {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wl-block-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel2);
  border-radius: 6px;
  padding: 1px 8px;
}

.wl-block-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}

.wl-block-label { color: var(--muted); }

.wl-block-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.wl-block-val.wl-warn { color: var(--orange); }
.wl-block-val.wl-accent { color: var(--andari-teal); font-weight: 700; }
.wl-block-val.wl-danger { color: var(--red); }

.wl-block-empty {
  color: var(--muted2);
  font-size: 12px;
  font-style: italic;
}

/* Member comparison */
.wl-compare {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.wl-compare-vs {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted2);
}

.wl-member-card {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 16px;
}

.wl-member-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.wl-member-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.wl-member-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  text-align: center;
}

.wl-member-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.wl-member-stat-val.wl-danger { color: var(--red); }

.wl-member-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted2);
  margin-top: 2px;
}

/* Loading state */
.wl-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}

.wl-loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--stroke);
  border-top-color: var(--andari-teal);
  border-radius: 50%;
  animation: wl-spin 0.6s linear infinite;
}

@keyframes wl-spin { to { transform: rotate(360deg); } }

/* Empty state */
.wl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--muted);
}

.wl-empty p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

/* Team management modal */
.wl-team-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wl-team-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel2);
  border-radius: 8px;
  border: 1px solid var(--stroke);
}

.wl-team-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wl-team-item-members {
  font-size: 12px;
  color: var(--muted);
}

.wl-btn-delete {
  color: var(--red);
  border-color: transparent;
}

.wl-btn-delete:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.2);
}

.wl-team-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
}

.wl-team-form-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .wl-hero { grid-template-columns: repeat(2, 1fr); }
  .wl-toolbar { flex-direction: column; align-items: stretch; }
  .wl-toolbar-left, .wl-toolbar-right { justify-content: center; }
  .wl-detail-grid { grid-template-columns: 1fr; }
  .wl-compare { flex-direction: column; }
  .wl-compare-vs { justify-content: center; }
  .wl-member-grid { grid-template-columns: repeat(3, 1fr); }
  .wl-cell-customers { display: none; }
}

@media (max-width: 480px) {
  .wl-hero { grid-template-columns: 1fr; }
  .wl-metric-tile { padding: 14px 16px 10px; }
  .wl-metric-value { font-size: 26px; }
}

/* Print */
@media print {
  .wl-toolbar, .wl-manage-btn { display: none; }
  .wl-hero { gap: 8px; }
  .wl-metric-tile { border: 1px solid #ccc; box-shadow: none; }
  .wl-metric-tile::before { display: none; }
  .wl-table-section { box-shadow: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .wl-metric-tile { transition: none; }
  .wl-loading-spinner { animation: none; }
  .wl-ontime-fill { transition: none; }
}

/* ==================== ITERATION CHAIN ==================== */

.iterationChainSection {
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 12px;
}

.iterationChain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
}

.iterationChainItem {
  font-size: 12px;
  color: var(--andari-teal);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel2);
  white-space: nowrap;
}

.iterationChainItem:hover {
  background: var(--andari-teal-bg, #e6f7f5);
}

.iterationArrow {
  color: var(--muted2);
  font-size: 11px;
}

/* ==================== COSTING WORKSHEET ==================== */

.worksheetBulkSidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--stroke);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

/* Worksheet section headers with accent border */
.worksheetSection {
  border-left: 3px solid var(--andari-teal);
  padding-left: 14px;
}
.worksheetSection h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.worksheetSection.yarn-section { border-left-color: #3b82f6; }
.worksheetSection.labor-section { border-left-color: #f59e0b; }
.worksheetSection.other-section { border-left-color: #8b5cf6; }
.worksheetSection.per-order-section { border-left-color: #ec4899; }
.worksheetSection.margin-section { border-left-color: #10b981; }
.worksheetSection.results-section { border-left-color: var(--andari-teal); }

/* Sample info with photo */
.worksheetSampleInfo {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.worksheetSamplePhoto {
  flex-shrink: 0;
}
.worksheetSamplePhoto img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--stroke);
}
.worksheetSampleFields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
}

/* Input with unit indicator */
.worksheetInputWrap {
  position: relative;
  display: flex;
  align-items: center;
}
.worksheetInputWrap input {
  width: 100%;
  padding-left: 22px !important;
}
.worksheetInputWrap .inputUnit {
  position: absolute;
  left: 8px;
  font-size: 12px;
  color: var(--muted2);
  pointer-events: none;
  z-index: 1;
}
.worksheetInputWrap .inputUnitRight {
  position: absolute;
  right: 8px;
  font-size: 12px;
  color: var(--muted2);
  pointer-events: none;
  z-index: 1;
}
.worksheetInputWrap input.hasUnitRight {
  padding-right: 28px !important;
}
.worksheetInputWrap input.rightOnlyUnit {
  padding-left: 8px !important;
}

.worksheetGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.worksheetGrid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.worksheetGrid input {
  padding: 6px 8px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color var(--duration-fast);
}
.worksheetGrid input:focus {
  border-color: var(--andari-teal);
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}
.worksheetGrid input.autoPopulated {
  background: var(--panel2);
}

/* Worksheet table inputs (yarn, tier results) */
.yarnInput,
.worksheetTableInput {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font-sans);
  transition: border-color var(--duration-fast);
}
.worksheetTableInputWrap {
  min-width: 92px;
}
.worksheetTableInputWrap.dualUnit {
  min-width: 120px;
}
.worksheetTableInputWrap .yarnInput,
.worksheetTableInputWrap .worksheetTableInput {
  width: 100%;
  min-width: 0;
}
.worksheetTableInputWrap .inputUnit,
.worksheetTableInputWrap .inputUnitRight {
  font-size: 11px;
}
.worksheetTableInputWrap .inputUnit {
  left: 6px;
}
.worksheetTableInputWrap .inputUnitRight {
  right: 6px;
}
.worksheetTableInputWrap input {
  padding-left: 20px !important;
}
.worksheetTableInputWrap input.hasUnitRight {
  padding-right: 28px !important;
}
.worksheetTableInputWrap.dualUnit input {
  padding-right: 36px !important;
}
.worksheetTableInputWrap input.rightOnlyUnit {
  padding-left: 8px !important;
}
.yarnInput:focus,
.worksheetTableInput:focus {
  border-color: var(--andari-teal);
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}
.worksheetTableInput.autoFilled {
  color: var(--muted);
  font-style: italic;
}
.worksheetTableInput.autoFilled:focus {
  color: var(--text);
  font-style: normal;
}

/* Results section */
.resultsSummary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.resultItem {
  padding: 12px 16px;
  background: var(--panel2);
  border-radius: 8px;
  border: 1px solid var(--stroke);
}
.resultItem .resultLabel {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.resultItem .resultValue {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--andari-teal);
  font-family: var(--font-mono);
}
.resultItem .resultDelta {
  font-size: 12px;
  margin-top: 2px;
}
.resultItem .resultDelta.up { color: var(--red); }
.resultItem .resultDelta.down { color: var(--green); }
.resultItem .resultDelta.flat { color: var(--muted); }

/* COGS Breakdown Cards */
.cogs-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 16px;
}
.cogs-card {
  flex: 1;
  min-width: 90px;
  padding: 10px 14px;
  background: var(--panel2);
  border-radius: 8px;
  border: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cogs-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  font-weight: 600;
}
.cogs-card-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.cogs-card-pct {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cogs-card.wastage {
  border-style: dashed;
}
.cogs-card.total {
  background: var(--panel);
  border-color: var(--andari-teal);
  border-width: 2px;
  min-width: 120px;
}
.cogs-card.total .cogs-card-value {
  color: var(--andari-teal);
  font-size: 20px;
}
.cogs-op {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--muted2);
  font-weight: 300;
  width: 16px;
  flex-shrink: 0;
}

/* Cost history deltas */
.costHistoryDelta.positive { color: var(--red); }
.costHistoryDelta.negative { color: var(--green); }

/* Sticky worksheet action bar */
.worksheetActions {
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--stroke);
  padding: 12px 20px;
  margin: 0 -20px -20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  z-index: 10;
}

/* Bulk sidebar items */
.bulkItem {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 13px;
  border: 1px solid transparent;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.bulkItem:hover { background: var(--panel2); }
.bulkItem.active { border-color: var(--andari-teal); background: rgba(15, 118, 110, 0.05); }

/* Overseas results */
.overseasResultRow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--stroke);
  font-size: 13px;
  align-items: center;
}
.overseasResultRow:last-child { border-bottom: none; }

/* Tier table alternating rows */
#tierResultsBody tr:nth-child(even) {
  background: var(--panel2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .worksheetBulkSidebar {
    width: 200px;
    min-width: 200px;
  }
  .worksheetGrid {
    grid-template-columns: 1fr 1fr;
  }
  .overseasResultRow {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

/* ── Cost Analysis ────────────────────────────────────────── */

.analysisDashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.summaryCard {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.summaryCard .cardLabel { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.summaryCard .cardValue { font-size: 24px; font-weight: 600; margin-top: 4px; }
.summaryCard .cardLink { font-size: 12px; color: var(--primary); margin-top: 4px; }

.chartsRow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.chartCard {
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.chartCard h4 { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

.columnToggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 12px;
}
.columnToggle label { font-size: 12px; display: flex; align-items: center; gap: 4px; cursor: pointer; }

.staleBadge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--surface-warning);
  color: var(--yellow);
  border: 1px solid color-mix(in srgb, var(--yellow) 35%, var(--stroke));
  border-radius: 4px;
  font-size: 11px;
  cursor: help;
}

/* Analysis table */
.analysisTableWrap { overflow-x: auto; }
.analysisTable { width: 100%; table-layout: auto; }
.analysisTable td, .analysisTable th { padding: 10px 12px; white-space: nowrap; }
.analysisTable td:nth-child(3) { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* Bar chart rows */
.barRow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.barLabel { width: 100px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barTrack { flex: 1; height: 18px; background: var(--panel2); border: 1px solid var(--stroke); border-radius: 4px; overflow: hidden; }
.barFill { height: 100%; background: var(--andari-teal); border-radius: 4px; transition: width 0.3s; }
.barVal { font-size: 12px; color: var(--muted); min-width: 50px; text-align: right; }

/* Donut legend */
.donutLegend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.legendItem { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.legendDot { width: 10px; height: 10px; border-radius: 50%; }

/* Pagination */
.paginationBar { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; font-size: 13px; }
.paginationBar button { padding: 4px 12px; }

/* Export bar */
.exportBar { display: flex; gap: 8px; margin-bottom: 12px; }

/* Cost Analysis responsive */
@media (max-width: 900px) {
  .analysisDashboard { grid-template-columns: repeat(2, 1fr); }
  .chartsRow { grid-template-columns: 1fr; }
}
@media print {
  .exportBar, .columnToggle, .paginationBar, .filterBar, #toggleDashboard { display: none !important; }
  .analysisTable th:first-child, .analysisTable td:first-child,
  .analysisTable th:nth-child(2), .analysisTable td:nth-child(2) { position: static; }
}

/* === Colorway Cards === */
.colorway-card {
  border: 1px solid #b2dfdb;
  border-radius: 8px;
  background: rgba(255,255,255,0.6);
  margin-bottom: 12px;
}
.colorway-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #e0f2f1;
  background: rgba(240,253,250,0.5);
  border-radius: 8px 8px 0 0;
}
.colorway-card-header input.colorway-name-input {
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text);
  flex: 1;
  max-width: 240px;
}
.colorway-card-header input.colorway-name-input:focus {
  border-color: var(--andari-teal);
  background: white;
  outline: none;
}
.colorway-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* === Color Group === */
.color-group-card {
  border: 1px solid #e0e7ff;
  border-radius: 6px;
  background: rgba(239,246,255,0.4);
  padding: 10px 12px;
}
.color-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.color-group-name-input {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  width: 120px;
}
.color-group-name-input:focus {
  border-color: var(--blue);
  background: white;
  outline: none;
  color: var(--text);
}

/* === Role Badges === */
.roleBadge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
}
.roleBadge.plated-face { background: #fef3c7; color: #92400e; }
.roleBadge.plated-back { background: #fef3c7; color: #b45309; }
.roleBadge.single { background: #e0e7ff; color: #3730a3; }
.roleBadge.marled { background: #fce7f3; color: #9d174d; }
.roleBadge.combined { background: #d1fae5; color: #065f46; }

/* === Yarn line inside color group === */
.yarn-entry-line {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 4px;
}

/* === Yarn Reference Section === */
.yarn-reference-section {
  margin-bottom: 14px;
}
.yarn-ref-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #0f766e;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #99f6e4;
}

/* Yarn entry grid inside reference */
.yarn-ref-grid {
  display: grid;
  grid-template-columns: 130px 1fr 1fr 60px 70px 100px 28px;
  gap: 6px 8px;
  align-items: end;
  margin-bottom: 6px;
}
.yarn-ref-grid .formLabel { margin: 0; }
.yarn-ref-grid .formLabel span { font-size: 11px; }
.yarn-ref-grid .formInput { padding: 7px 8px; font-size: 13px; }
.yarn-ref-grid .formInput[readonly] { font-size: 12px; }
.yarn-ref-grid .btn.small.danger { padding: 6px 8px; border-radius: 6px; }

/* === Colorway Cards Section === */
.colorway-cards-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.colorway-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.colorway-cards-grid > .colorway-card {
  flex: 1 1 280px;
  max-width: calc(50% - 5px);
  margin-bottom: 0;
}
@media (max-width: 700px) {
  .colorway-cards-grid > .colorway-card { max-width: 100%; }
}
.colorway-cards-section .yarn-ref-title {
  margin-top: 4px;
}

/* Colorway color block (per color group within a colorway card) */
.colorway-color-block {
  padding: 6px 0 0;
}
.colorway-color-block + .colorway-color-block {
  border-top: 1px solid var(--stroke);
  margin-top: 6px;
}
.colorway-cg-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.colorway-color-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 3px;
}
.colorway-color-row .cw-yarn-label {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.colorway-color-row .formInput { padding: 7px 8px; font-size: 13px; }

/* Sizes row in colorway card */
.colorway-sizes-grid {
  display: grid;
  grid-template-columns: 120px 70px 28px;
  gap: 6px 8px;
  align-items: end;
  margin-bottom: 4px;
}
.colorway-sizes-grid .formLabel { margin: 0; }
.colorway-sizes-grid .formLabel span { font-size: 11px; }
.colorway-sizes-grid .formInput { padding: 7px 8px; font-size: 13px; }
.colorway-sizes-grid .btn.small.danger { padding: 6px 8px; border-radius: 6px; }

/* === Sizes table === */
.colorwaySizesTable {
  border-collapse: collapse;
  font-size: 13px;
}
.colorwaySizesTable th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 8px 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.colorwaySizesTable td {
  padding: 4px 8px;
}

/* === Spec sheet colorway display === */
.specColorwayHeader {
  font-size: 14px;
  font-weight: 600;
  color: var(--andari-teal);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: #f0fdfa;
  border-radius: 6px;
  border-left: 3px solid var(--andari-teal);
}
.specColorwayHeader .sizes-inline {
  font-size: 12px;
  color: var(--muted);
  margin-left: 12px;
  font-weight: 400;
}
.specColorwayTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.specColorwayTable th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-bottom: 2px solid var(--stroke);
  background: var(--panel2);
}
.specColorwayTable td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--stroke);
  vertical-align: top;
}
.specColorwayTotal {
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  padding-top: 4px;
  border-top: 2px solid var(--stroke);
  margin-bottom: 16px;
}

/* Rich text comments */
.richComments { font-size: 13px; line-height: 1.5; }
.richComments p { margin: 0 0 8px 0; }
.richComments p:last-child { margin-bottom: 0; }
.richComments ul, .richComments ol { margin: 4px 0; padding-left: 24px; }
.richComments li { margin: 2px 0; }
.richComments table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.richComments table td, .richComments table th {
  border: 1px solid var(--stroke);
  padding: 4px 8px;
  font-size: 12px;
}
.richComments table th { background: var(--bg-subtle); font-weight: 600; }
.richComments img { max-width: 100%; height: auto; border-radius: 4px; margin: 4px 0; }
.richComments mark { background-color: #fef08a; padding: 0 2px; border-radius: 2px; }

/* === Print spec sheet colorway === */
@media print {
  .specColorwayHeader {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .roleBadge {
    border: 1px solid currentColor;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .richComments table td, .richComments table th {
    border: 1px solid #999;
    padding: 2px 4px;
    font-size: 10px;
  }
  .richComments img {
    max-width: 100%;
    max-height: 300px;
    break-inside: avoid;
  }
  .richComments mark {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

