/* ============================================
   StockFlow Inventory Tracker
   Design DNA borrowed from Payoneer Support Center
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
  --primary-dark: #252526;
  --header-bg: #333333;
  --accent-orange: #FF4800;
  --accent-blue: #0092F4;
  --accent-purple: #DA54D8;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --bg-white: #FFFFFF;
  --bg-light: #F7F8FA;
  --bg-card: #FFFFFF;
  --border-light: #EFEFEF;
  /* A step stronger than --border-light, for controls that have to look
     clickable rather than merely separated. */
  --border: #D8DBE0;
  --shadow-card: 0px 1px 8px rgba(0, 0, 0, 0.12);
  --shadow-card-hover: 0px 6px 24px rgba(0, 0, 0, 0.18);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-btn: 30px;
  --radius-badge: 20px;
  --gradient-accent: linear-gradient(100deg, #0092F4 0%, #DA54D8 50%, #FF4800 100%);
  --gradient-header: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #252526 100%);
  --gradient-hero: linear-gradient(135deg, #252526 0%, #1a1a2e 40%, #0f3460 100%);
  --font-primary: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --transition-fast: all 0.2s ease;
  --transition: all 0.3s ease;
  --transition-slow: all 0.5s ease;
  --success: #27AE60;
  --success-light: #E8F8EF;
  --warning: #F39C12;
  --warning-light: #FEF5E7;
  --danger: #E74C3C;
  --danger-light: #FDEDEC;
  --info: #0092F4;
  --info-light: #E6F3FD;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--accent-orange);
}

/* ---------- Header ---------- */
.sf-header {
  background: var(--gradient-header);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.sf-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.sf-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sf-logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;   /* now an <img>, not an inline SVG */
}

.sf-logo-text {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.sf-logo-text span {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sf-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* The profile menu sits beside the actions group rather than inside it, so on
   wide screens push both to the right as one cluster. */
.sf-header-inner > .sf-header-actions { margin-left: auto; }
.sf-header-inner > .sf-user-menu-wrapper { margin-left: 16px; }

.sf-header-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.sf-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent-orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(255, 72, 0, 0.3);
}

.sf-btn-add:hover {
  background: #e64100;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 72, 0, 0.4);
}

.sf-btn-add:active {
  transform: translateY(0);
}

.sf-btn-add i {
  font-size: 14px;
}

.sf-btn-quick-sale {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #1f2328 0%, #161b22 100%);
  color: #ffffff;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease-in-out;
  line-height: 1.2;
}

.sf-btn-quick-sale:hover {
  background: linear-gradient(180deg, #2d333b 0%, #22272e 100%);
  border-color: #444c56;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.sf-btn-quick-sale:hover .sf-pos-icon {
  transform: scale(1.08);
}

.sf-btn-quick-sale:active {
  transform: translateY(0);
}

.sf-pos-shortcut-badge {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  color: #e6edf3;
  border-radius: 4px;
  margin-left: 2px;
  letter-spacing: 0.5px;
}

/* Header user greeting */
.sf-header-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-btn);
}

.sf-header-user i {
  font-size: 16px;
  color: var(--accent-blue);
}

.sf-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Logout button */
.sf-btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-btn);
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.sf-btn-logout:hover {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #E74C3C;
}

/* ---------- Hero / Search Section ---------- */
.sf-hero {
  background: var(--gradient-hero);
  padding: 2.5rem 2rem 2rem;
  position: relative;
  overflow: hidden;
}

.sf-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 146, 244, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.sf-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(218, 84, 216, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.sf-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.sf-hero-title {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: 1.25rem;
  letter-spacing: 0.3px;
}

.sf-hero-title strong {
  font-weight: 700;
}

.sf-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sf-search-input-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.sf-search-input-wrap i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  pointer-events: none;
}

.sf-search-input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-btn);
  color: #fff;
  font-family: var(--font-primary);
  font-size: 14px;
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.sf-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.sf-search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(0, 146, 244, 0.15);
}

.sf-filter-group {
  display: flex;
  gap: 8px;
}

.sf-filter-btn {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-btn);
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.sf-filter-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sf-filter-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 146, 244, 0.3);
}

.sf-btn-export {
  padding: 10px 20px;
  background: var(--success);
  border: 1.5px solid var(--success);
  border-radius: var(--radius-btn);
  color: #fff;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sf-btn-export:hover {
  background: #219a52;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

/* ---------- Main Content ---------- */
.sf-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ---------- Dashboard Cards ---------- */
.sf-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.sf-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.sf-stat-card.interactive {
  cursor: pointer;
}

.sf-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  opacity: 0;
  transition: var(--transition);
}

.sf-stat-card.interactive:hover, .sf-stat-card.interactive:active {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: var(--accent-blue);
}

.sf-stat-card:hover::before, .sf-stat-card.interactive:active::before {
  opacity: 1;
}

.sf-stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sf-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sf-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sf-stat-icon.items {
  background: var(--info-light);
  color: var(--info);
}

.sf-stat-icon.cost {
  background: var(--warning-light);
  color: var(--warning);
}

.sf-stat-icon.revenue {
  background: var(--success-light);
  color: var(--success);
}

.sf-stat-icon.profit {
  background: linear-gradient(135deg, rgba(0, 146, 244, 0.1), rgba(218, 84, 216, 0.1));
  color: var(--accent-purple);
}

.sf-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.2;
}

.sf-stat-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ---------- Inventory Table Section ---------- */
.sf-table-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.sf-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.sf-table-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.sf-table-count {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 400;
}

.sf-table-actions {
  display: flex;
  gap: 8px;
}

.sf-sort-select {
  padding: 8px 14px;
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-sort-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

/* Table */
.sf-table-wrap {
  overflow-x: auto;
}

.sf-table {
  width: 100%;
  border-collapse: collapse;
}

.sf-table thead th {
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: left;
  background: var(--bg-light);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.sf-table tbody tr {
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border-light);
}

.sf-table tbody tr:hover {
  background: rgba(0, 146, 244, 0.03);
}

.sf-table tbody tr:last-child {
  border-bottom: none;
}

.sf-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.sf-item-name {
  font-weight: 600;
  color: var(--primary-dark);
}

.sf-item-category {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-light);
  border-radius: var(--radius-badge);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.sf-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sf-price.cost {
  color: var(--text-primary);
}

.sf-price.sell {
  color: var(--success);
}

/* Status Badge */
.sf-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sf-status.in-stock {
  background: var(--success-light);
  color: var(--success);
}

.sf-status.low-stock {
  background: var(--warning-light);
  color: var(--warning);
}

.sf-status.out-of-stock {
  background: var(--danger-light);
  color: var(--danger);
}

.sf-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s ease-in-out infinite;
}

.sf-status.out-of-stock .sf-status-dot {
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Profit / Loss indicator */
.sf-profit {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sf-profit.positive {
  color: var(--success);
}

.sf-profit.negative {
  color: var(--danger);
}

.sf-profit.neutral {
  color: var(--text-light);
}

/* Row action buttons */
.sf-row-actions {
  display: flex;
  gap: 6px;
}

.sf-row-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition-fast);
  background: transparent;
}

.sf-row-btn.edit {
  color: var(--accent-blue);
}

.sf-row-btn.edit:hover {
  background: var(--info-light);
}

.sf-row-btn.receive {
  color: var(--success);
}

.sf-row-btn.receive:hover {
  background: var(--success-light);
}

.sf-row-btn.sell {
  color: var(--warning);
}

.sf-row-btn.sell:hover {
  background: var(--warning-light);
}

.sf-row-btn.delete {
  color: var(--danger);
}

.sf-row-btn.delete:hover {
  background: var(--danger-light);
}

/* Empty State */
.sf-empty {
  text-align: center;
  padding: 4rem 2rem;
}

.sf-empty-icon {
  font-size: 48px;
  color: var(--border-light);
  margin-bottom: 16px;
}

.sf-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.sf-empty-text {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.sf-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.sf-empty-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 146, 244, 0.3);
}

/* ---------- Modal ---------- */
.sf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  /* visibility is transitioned, so a closed overlay stays hit-testable for the
     whole 0.3s fade and silently swallows clicks anywhere on the page. */
  pointer-events: none;
  transition: var(--transition);
}

.sf-modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sf-modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px) scale(0.97);
  transition: var(--transition);
}

.sf-modal-overlay.open .sf-modal {
  transform: translateY(0) scale(1);
}

.sf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.sf-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.sf-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-light);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.sf-modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.sf-modal-body {
  padding: 1.5rem;
}

.sf-form-group {
  margin-bottom: 1.25rem;
}

.sf-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.sf-form-group input,
.sf-form-group select {
  width: 100%;
  padding: 11px 16px;
  background: var(--bg-light);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.sf-form-group input:focus,
.sf-form-group select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 146, 244, 0.1);
  background: var(--bg-white);
}

.sf-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.sf-modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
}

.sf-btn {
  padding: 11px 28px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sf-btn-primary {
  background: var(--accent-orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 72, 0, 0.25);
}

.sf-btn-primary:hover {
  background: #e64100;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 72, 0, 0.35);
}

.sf-btn-secondary {
  background: var(--bg-light);
  color: var(--text-secondary);
}

.sf-btn-secondary:hover {
  background: var(--border-light);
}

.sf-btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.25);
}

.sf-btn-success:hover {
  background: #219a52;
  transform: translateY(-1px);
}

/* ---------- Footer ---------- */
.sf-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: 13px;
}

.sf-footer-brand {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* ---------- Toast Notifications ---------- */
.sf-toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;   /* never swallow a tap meant for the page beneath */
}

/* A confirmation is a glance, not a document. This is a small dark pill with a
   status dot rather than a 280px white card with a bordered icon — the old one
   announced "everything is up to date" at the same visual volume as a real
   warning. Dark works against both themes, so it does not need a variant. */
.sf-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: 10px;
  background: #202634;
  color: #EEF1F6;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.003em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.sf-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* The dot carries the status; the words carry the meaning */
.sf-toast-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4DA3FF;
}

.sf-toast-msg { min-width: 0; }

.sf-toast.success .sf-toast-dot { background: #3DD68C; }
.sf-toast.error   .sf-toast-dot { background: #FF7A70; }
.sf-toast.warning .sf-toast-dot { background: #FFC44D; }

/* An error is worth a touch more weight than a confirmation */
.sf-toast.error { background: #2A1D1F; }
.sf-toast.error .sf-toast-msg { color: #FFD9D5; }

@media (prefers-reduced-motion: reduce) {
  .sf-toast { transition: opacity 0.15s ease; transform: none; }
  .sf-toast.show { transform: none; }
}

/* ---------- Confirm Dialog ---------- */
.sf-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.sf-confirm-overlay.open {
  opacity: 1;
  visibility: visible;
}

.sf-confirm {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: var(--transition);
}

.sf-confirm-overlay.open .sf-confirm {
  transform: scale(1);
}

.sf-confirm-icon {
  font-size: 40px;
  color: var(--danger);
  margin-bottom: 12px;
}

.sf-confirm-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.sf-confirm-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.sf-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.sf-btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.25);
}

.sf-btn-danger:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sf-animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

.sf-stat-card:nth-child(1) { animation: fadeInUp 0.4s ease forwards; }
.sf-stat-card:nth-child(2) { animation: fadeInUp 0.5s ease forwards; }
.sf-stat-card:nth-child(3) { animation: fadeInUp 0.6s ease forwards; }
.sf-stat-card:nth-child(4) { animation: fadeInUp 0.7s ease forwards; }

.sf-table-section {
  animation: fadeInUp 0.6s 0.3s ease both;
}

/* ---------- User Dropdown ---------- */
.sf-user-menu-wrapper {
  position: relative;
}

.sf-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition-fast);
  z-index: 100;
}

.sf-user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sf-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-dropdown-item:hover {
  background: var(--bg-light);
  color: var(--accent-blue);
}

.sf-dropdown-item.danger:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.sf-dropdown-item i {
  font-size: 15px;
  width: 16px;
  text-align: center;
  color: var(--text-light);
}

.sf-dropdown-item:hover i {
  color: inherit;
}

.sf-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 6px 0;
}

/* ---------- History Modal (Ledger) ---------- */
.sf-modal-lg {
  max-width: 700px;
}

.sf-history-header {
  background: var(--bg-light);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-light);
}

.sf-history-product {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

.sf-history-stock {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
  background: rgba(0, 146, 244, 0.1);
  padding: 4px 12px;
  border-radius: var(--radius-badge);
}

.sf-history-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.sf-history-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
}

.sf-history-item:last-child {
  border-bottom: none;
}

.sf-history-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sf-history-item.inbound .sf-history-icon {
  background: var(--success-light);
  color: var(--success);
}

.sf-history-item.sale .sf-history-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.sf-history-item.adjust .sf-history-icon {
  background: var(--danger-light);
  color: var(--danger);
}

.sf-history-details {
  flex: 1;
}

.sf-history-type {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 2px;
}

.sf-history-notes {
  font-size: 12px;
  color: var(--text-secondary);
}

.sf-history-meta {
  text-align: right;
}

.sf-history-qty {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.sf-history-item.inbound .sf-history-qty { color: var(--success); }
.sf-history-item.sale .sf-history-qty { color: var(--warning); }
.sf-history-item.adjust .sf-history-qty { color: var(--danger); }

.sf-history-date {
  font-size: 12px;
  color: var(--text-light);
}

.sf-row-btn.adjust { color: #95a5a6; }
.sf-row-btn.adjust:hover { background: #ecf0f1; }
.sf-row-btn.history { color: var(--accent-purple); }
.sf-row-btn.history:hover { background: rgba(218, 84, 216, 0.1); }

.sf-margin {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-badge);
}

.sf-margin.high { background: var(--success-light); color: var(--success); }
.sf-margin.med { background: var(--warning-light); color: var(--warning); }
.sf-margin.low { background: var(--danger-light); color: var(--danger); }
.sf-margin.none { background: var(--bg-light); color: var(--text-light); }

.sf-btn-print {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-left: 8px;
}

.sf-btn-print:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sf-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sf-header {
    padding: 0 1rem;
  }

  .sf-header-time {
    display: none;
  }

  .sf-hero {
    padding: 1.5rem 1rem;
  }

  .sf-hero-title {
    font-size: 1.2rem;
  }

  .sf-search-bar {
    flex-direction: column;
  }

  .sf-search-input-wrap {
    min-width: 100%;
  }

  .sf-filter-group {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sf-filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .sf-main {
    padding: 1rem;
  }

  .sf-dashboard {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .sf-stat-value {
    font-size: 22px;
  }

  .sf-form-row {
    grid-template-columns: 1fr;
  }

  .sf-table td, .sf-table thead th {
    padding: 10px 12px;
    font-size: 13px;
  }

  .sf-table .sf-col-date,
  .sf-table .sf-col-profit {
    display: none;
  }
}

@media (max-width: 480px) {
  .sf-dashboard {
    grid-template-columns: 1fr;
  }

  .sf-logo-text {
    font-size: 18px;
  }

  .sf-btn-add span {
    display: none;
  }

  .sf-stat-card {
    padding: 1rem;
  }

  /* Collapsing to the avatar keeps Settings, Backup and Sign Out reachable.
     Hiding it outright stranded every one of them on a phone. */
  .sf-header-user span:not(.sf-header-avatar) {
    display: none;
  }

  .sf-header-user i.fa-chevron-down {
    display: none;
  }

  .sf-header-user {
    padding: 4px;
    gap: 0;
  }

  .sf-btn-logout span {
    display: none;
  }

  .sf-btn-logout {
    padding: 8px 10px;
  }
}

/* ---------- Print Styles ---------- */
@media print {
  .sf-hide-print,
  .sf-header,
  .sf-hero,
  .sf-table-actions,
  .sf-btn-export,
  .sf-btn-print,
  .sf-row-actions {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .sf-main {
    padding: 0;
    max-width: 100%;
  }

  .sf-dashboard {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 2rem;
  }

  .sf-stat-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .sf-table-section {
    box-shadow: none;
    border: none;
  }

  .sf-table th, .sf-table td {
    border: 1px solid #eee;
    color: #000;
  }

  .sf-status {
    border: 1px solid #ccc;
    background: none !important;
  }
}

/* ---------- Pagination ---------- */
.sf-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

.sf-page-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.sf-page-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sf-page-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.sf-page-btn:hover:not(:disabled):not(.active) {
  background: var(--bg-light);
  border-color: var(--accent-blue);
}

.sf-page-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.sf-page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sf-page-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  color: var(--text-light);
  font-size: 14px;
}

/* ---------- Return Button ---------- */
.sf-row-btn.return {
  color: #DA54D8;
  background: rgba(218, 84, 216, 0.08);
}
.sf-row-btn.return:hover {
  background: rgba(218, 84, 216, 0.18);
}

/* ---------- Supplier Column ---------- */
.sf-item-supplier {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================
   Ledger model additions (schema v3)
   ============================================ */

/* ---------- Archived products ---------- */
.sf-row-archived td {
  opacity: 0.62;
}

.sf-archived-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  color: var(--text-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  vertical-align: middle;
}

.sf-row-btn.restore { color: var(--success); }
.sf-row-btn.restore:hover { background: var(--success-light); }
.sf-row-btn.return { color: var(--accent-purple); }
.sf-row-btn.return:hover { background: rgba(218, 84, 216, 0.1); }

/* Replaces the inline opacity/cursor that used to be written into the markup */
.sf-row-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sf-row-btn:disabled:hover {
  background: none;
}

/* Weighted-average cost marker next to the unit cost column */
.sf-price-note {
  display: inline-block;
  margin-left: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-light);
  cursor: help;
}

/* ---------- Transaction preview panel ---------- */
.sf-trans-preview {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-light);
  border: 1px solid var(--border-light);
}

.sf-trans-preview:empty {
  display: none;
}

.sf-preview-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.sf-preview-row strong {
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sf-preview-row.positive strong { color: var(--success); }
.sf-preview-row.negative strong { color: var(--danger); }

/* ---------- Global ledger controls ---------- */
.sf-ledger-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sf-ledger-date {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-white);
}

.sf-ledger-dash {
  color: var(--text-light);
  font-size: 13px;
}

.sf-ledger-clear {
  padding: 8px 16px;
  font-size: 13px;
}

/* ---------- Ledger summary ---------- */
.sf-ledger-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.sf-ledger-summary:empty {
  display: none;
}

.sf-ledger-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-light);
  border: 1px solid var(--border-light);
}

.sf-ledger-stat span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-light);
}

.sf-ledger-stat strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.sf-ledger-stat.positive strong { color: var(--success); }
.sf-ledger-stat.negative strong { color: var(--danger); }

/* ---------- Ledger rows ---------- */
.sf-history-item.return .sf-history-icon {
  background: rgba(218, 84, 216, 0.12);
  color: var(--accent-purple);
}

.sf-history-item.return .sf-history-qty { color: var(--accent-purple); }

.sf-history-product-ref {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 2px;
}

.sf-history-money {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.sf-history-user {
  font-weight: 600;
  color: var(--text-light);
}

.sf-estimated-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-badge);
  background: var(--warning-light);
  color: var(--warning);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: help;
}

/* ---------- Print ---------- */
@media print {
  .sf-ledger-controls,
  .sf-trans-preview {
    display: none !important;
  }
}

.sf-ledger-truncated {
  padding: 10px 16px;
  background: var(--info-light);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

/* A stock increase is not a loss — don't paint it in the danger colour */
.sf-history-item.adjust.increase .sf-history-icon {
  background: var(--success-light);
  color: var(--success);
}

.sf-history-item.adjust.increase .sf-history-qty {
  color: var(--success);
}

/* .sf-form-row is a fixed 1fr 1fr grid, so a lone child only fills half the
   modal. Rows holding a single full-width field opt out of the second column. */
.sf-form-row.sf-form-row-full {
  grid-template-columns: 1fr;
}

/* The filter row scrolls horizontally with no visual affordance, so on narrow
   screens the trailing buttons (Archived, Export CSV) look absent rather than
   off-screen. Wrap them onto their own line instead. */
@media (max-width: 768px) {
  .sf-filter-group {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* ============================================
   INSIGHTS — analytics panels & charts

   Chart palette is the validated categorical set. Both modes are selected
   (not an automatic flip): each mode's steps were checked for CVD separation
   and contrast against that mode's own surface. In light mode aqua/yellow/
   magenta fall below 3:1 on white, so every chart ships visible direct labels
   and a legend carrying the value — colour is never the only encoding.
   ============================================ */

:root {
  --viz-surface:   #FFFFFF;
  --viz-text:      #333333;
  --viz-text-dim:  #7A8089;
  --viz-grid:      #ECEEF1;
  --viz-track:     #F2F4F7;

  --viz-s1: #2a78d6;   /* trend: revenue */
  --viz-s2: #1baf7a;   /* trend: gross profit */

  --viz-c1: #2a78d6;   /* category slots, fixed order, never cycled */
  --viz-c2: #eb6834;
  --viz-c3: #1baf7a;
  --viz-c4: #eda100;
  --viz-c5: #e87ba4;
  --viz-other: #98A2B3;
}

/* ---------- Layout ---------- */
.sf-insights { margin-bottom: 2rem; }

.sf-insights-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 1rem;
}

.sf-window-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-btn);
  padding: 3px;
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
}

.sf-window-tab {
  border: none;
  background: none;
  padding: 8px 15px;
  border-radius: var(--radius-btn);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.sf-window-tab:hover { color: var(--text-primary); }

.sf-window-tab.active {
  background: var(--accent-blue);
  color: #fff;
}

/* ---------- Panels ---------- */
.sf-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sf-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.sf-panel-attention { grid-row: span 2; }

.sf-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.sf-panel-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.2px;
}

.sf-panel-sub { font-size: 12.5px; color: var(--text-secondary); }

@media (max-width: 1080px) {
  .sf-insight-grid { grid-template-columns: minmax(0, 1fr); }
  .sf-panel-attention { grid-row: auto; }
}

/* ---------- Needs attention ---------- */
.sf-attention-tabs { display: flex; gap: 4px; }

.sf-attention-tab {
  border: none;
  background: none;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition-fast);
}

.sf-attention-tab:hover { background: var(--bg-light); }
.sf-attention-tab.active { background: var(--info-light); color: var(--accent-blue); }

.sf-pill {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  background: var(--bg-light);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.sf-attention-tab.active .sf-pill { background: var(--accent-blue); color: #fff; }

.sf-attention-list { max-height: 430px; overflow-y: auto; margin: 0 -6px; }

.sf-attention-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: var(--transition-fast);
}

.sf-attention-row + .sf-attention-row { margin-top: 2px; }
.sf-attention-row:hover { background: var(--bg-light); }
.sf-attention-row.critical { border-left-color: var(--danger); }
.sf-attention-row.warn     { border-left-color: var(--warning); }
.sf-attention-row.bad      { border-left-color: #8E44AD; }
.sf-attention-row.ok       { border-left-color: var(--success); }

.sf-attention-main { min-width: 0; flex: 1; }

.sf-attention-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-attention-when {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sf-attention-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.sf-attention-qty { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.sf-attention-qty strong { font-size: 15px; color: var(--primary-dark); }
.sf-attention-sub { font-size: 11px; color: var(--text-light); white-space: nowrap; }

.sf-btn-mini {
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: var(--font-primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.sf-btn-mini:hover { background: var(--success-light); border-color: var(--success); }

.sf-abc {
  width: 17px; height: 17px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sf-abc-A { background: var(--success-light); color: var(--success); }
.sf-abc-B { background: var(--info-light); color: var(--accent-blue); }
.sf-abc-C { background: var(--bg-light); color: var(--text-light); }

.sf-attention-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 46px 20px;
  text-align: center;
}

.sf-attention-empty i { font-size: 26px; color: var(--success); margin-bottom: 4px; }
.sf-attention-empty strong { font-size: 14px; color: var(--primary-dark); }
.sf-attention-empty span { font-size: 12.5px; color: var(--text-secondary); }

.sf-attention-more {
  padding: 9px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}

/* ---------- Charts ---------- */
.sf-chart-wrap { position: relative; width: 100%; }

.sf-chart { display: block; width: 100%; overflow: visible; }
.sf-chart-trend { height: 240px; }

.sf-grid { stroke: var(--viz-grid); stroke-width: 1; }

.sf-axis {
  fill: var(--viz-text-dim);
  font-size: 10.5px;
  font-family: var(--font-primary);
}

/* Thin marks: 2px lines, no heavy fills */
.sf-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sf-line.sf-s1 { stroke: var(--viz-s1); }
.sf-line.sf-s2 { stroke: var(--viz-s2); }

.sf-area { stroke: none; opacity: 0.1; }
.sf-area.sf-s1 { fill: var(--viz-s1); }

/* 2px surface ring so overlapping marks stay separable */
.sf-dot { stroke: var(--viz-surface); stroke-width: 2; }
.sf-dot.sf-s1 { fill: var(--viz-s1); }
.sf-dot.sf-s2 { fill: var(--viz-s2); }

.sf-hit { fill: transparent; cursor: crosshair; }
.sf-cross { pointer-events: none; transition: opacity .12s; }
.sf-cross-line { stroke: var(--viz-text-dim); stroke-width: 1; stroke-dasharray: 3 3; }

.sf-bar-track { fill: var(--viz-track); }
.sf-bar { fill: var(--viz-s1); transition: opacity .15s; cursor: pointer; }
.sf-bar:hover { opacity: 0.82; }

.sf-bar-label {
  fill: var(--viz-text);
  font-size: 12px;
  font-family: var(--font-primary);
  font-weight: 500;
}

.sf-bar-value {
  fill: var(--viz-text);
  font-size: 12px;
  font-family: var(--font-primary);
  font-weight: 700;
}

.sf-chart-stack { height: 34px; }
.sf-seg { transition: opacity .15s; cursor: pointer; }
.sf-seg:hover { opacity: 0.82; }

.sf-seg.sf-c1 { fill: var(--viz-c1); }
.sf-seg.sf-c2 { fill: var(--viz-c2); }
.sf-seg.sf-c3 { fill: var(--viz-c3); }
.sf-seg.sf-c4 { fill: var(--viz-c4); }
.sf-seg.sf-c5 { fill: var(--viz-c5); }
.sf-seg.sf-other { fill: var(--viz-other); }

/* ---------- Legend ---------- */
.sf-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.sf-chart-legend.wrap { margin: 12px 0 0; }

.sf-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.sf-key b { color: var(--primary-dark); font-weight: 700; }

.sf-swatch {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}

.sf-swatch.sf-s1 { background: var(--viz-s1); }
.sf-swatch.sf-s2 { background: var(--viz-s2); }
.sf-swatch.sf-c1 { background: var(--viz-c1); }
.sf-swatch.sf-c2 { background: var(--viz-c2); }
.sf-swatch.sf-c3 { background: var(--viz-c3); }
.sf-swatch.sf-c4 { background: var(--viz-c4); }
.sf-swatch.sf-c5 { background: var(--viz-c5); }
.sf-swatch.sf-other { background: var(--viz-other); }

/* ---------- Tooltip ---------- */
.sf-tooltip {
  position: absolute;
  z-index: 40;
  pointer-events: none;
  background: #1A1A2E;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  white-space: nowrap;
  min-width: 130px;
}

.sf-tip-head {
  font-weight: 700;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.sf-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.72);
}

.sf-tip-row b { margin-left: auto; color: #fff; font-weight: 700; }

.sf-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-light);
  font-size: 13px;
}

.sf-chart-empty i { font-size: 24px; opacity: 0.45; }

@media print {
  .sf-window-tabs, .sf-attention-tabs, .sf-tooltip, .sf-btn-mini { display: none !important; }
  .sf-attention-list { max-height: none; overflow: visible; }
}

/* A single stacked bar reads better across the full width than boxed into
   one grid column with dead space beside it. */
.sf-panel-full { grid-column: 1 / -1; }

/* ============================================
   PRICE JOURNEY — the app's core question

   "What did this cost coming in, what did it fetch going out."
   Dumbbell marks use one hue in two ordinal steps (light = cost in,
   dark = price out), both validated for monotone lightness and
   surface contrast in each mode.
   ============================================ */

:root {
  --viz-db-in:  #86b6ef;   /* cost coming in  — light step */
  --viz-db-out: #1c5cab;   /* price going out — dark step  */
  --viz-db-link: #C9D4E2;
}

/* ---------- Journey panel ---------- */
.sf-panel-journey .sf-panel-head { align-items: flex-start; }
.sf-panel-journey .sf-panel-head h2 { font-size: 16px; }
.sf-panel-journey .sf-panel-sub { display: block; margin-top: 3px; }

.sf-chart-db { min-height: 120px; }

.sf-db-label {
  fill: var(--viz-text);
  font-size: 12px;
  font-family: var(--font-primary);
  font-weight: 500;
}

.sf-db-link {
  stroke: var(--viz-db-link);
  stroke-width: 3;
  stroke-linecap: round;
}

.sf-db-link.loss { stroke: var(--danger); }

/* 2px surface ring keeps the two dots separable where they nearly touch */
.sf-db-dot {
  stroke: var(--viz-surface);
  stroke-width: 2;
  cursor: pointer;
  transition: r .12s ease;
}

.sf-db-dot:hover { r: 8; }
.sf-db-dot.sf-db-in  { fill: var(--viz-db-in); }
.sf-db-dot.sf-db-out { fill: var(--viz-db-out); }

.sf-swatch.sf-db-in  { background: var(--viz-db-in); }
.sf-swatch.sf-db-out { background: var(--viz-db-out); }

.sf-key-note { color: var(--text-light); font-style: italic; }

.sf-db-value {
  fill: var(--success);
  font-size: 12.5px;
  font-family: var(--font-primary);
  font-weight: 700;
}

.sf-db-value.loss { fill: var(--danger); }

/* ---------- Journey table ---------- */
.sf-journey-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border-top: 1px solid var(--border-light);
}

.sf-journey-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.sf-journey-table th {
  text-align: left;
  padding: 12px 14px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-light);
  white-space: nowrap;
}

.sf-journey-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: top;
}

.sf-journey-table tbody tr { cursor: pointer; transition: var(--transition-fast); }
.sf-journey-table tbody tr:hover { background: var(--bg-light); }

.sf-journey-table strong { color: var(--primary-dark); font-weight: 700; }

.sf-journey-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary-dark);
}

.sf-journey-range {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-light);
}

.sf-journey-none { color: var(--text-light); font-style: italic; }

/* Colour marks the direction of the gap; the +/- sign carries it too */
.sf-journey-gap,
.sf-journey-earned {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Profit and loss share one vocabulary across the app now — positive /
   negative / neutral — rather than gain/loss here and positive/negative in the
   reports table. The old class names are kept as aliases so nothing that still
   emits them loses its colour. */
.sf-journey-gap.gain, .sf-journey-earned.gain,
.sf-journey-gap.positive, .sf-journey-earned.positive { color: var(--success); }

.sf-journey-gap.loss, .sf-journey-earned.loss,
.sf-journey-gap.negative, .sf-journey-earned.negative { color: var(--danger); }

.sf-journey-gap.neutral, .sf-journey-earned.neutral,
.sf-report-gap.neutral, .sf-report-earned.neutral { color: var(--text-light); }

/* Subtle direction cue on the two money columns */
.sf-journey-in strong  { color: var(--viz-db-out); }
.sf-journey-out strong { color: var(--primary-dark); }

.sf-journey-empty {
  padding: 34px 18px !important;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .sf-panel-journey .sf-panel-head { flex-direction: column; }
  .sf-panel-journey .sf-panel-head h2 { font-size: 15px; }
}

@media print {
  .sf-journey-table-wrap { overflow: visible; }
  #journey-sort { display: none !important; }
}

/* ============================================
   TYPOGRAPHY

   IBM Plex rather than a geometric template sans. Three roles:

     Serif  — headings and the wordmark. Gives the product an editorial,
              ledger-book voice instead of the interchangeable SaaS look.
     Sans   — everything structural. Open apertures, slightly industrial
              detailing, built for dense technical UI.
     Mono   — every figure. Not decoration: Plex Mono has true tabular
              numerals, so money in a column lines up digit-for-digit and
              you can compare magnitudes by eye.
   ============================================ */

:root {
  --font-display: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Headings carry the serif ---------- */
.sf-hero-title,
.sf-table-title,
.sf-modal-title,
.sf-confirm-title,
.sf-panel-head h2,
.sf-empty-title {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.sf-hero-title {
  font-weight: 400;
  letter-spacing: -0.015em;
}

.sf-hero-title strong { font-weight: 600; }

.sf-panel-head h2 {
  font-weight: 600;
  letter-spacing: -0.005em;
}

.sf-table-title { font-weight: 600; }
.sf-modal-title { font-weight: 600; }

/* Wordmark: serif reads as a name, not a UI label */
.sf-logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* A flat accent instead of a three-stop gradient — the gradient was the most
   template-looking thing on the page. */
.sf-logo-text span {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: initial;
  color: var(--accent-blue);
}

/* ---------- Figures: mono + tabular ---------- */
.sf-price,
.sf-margin,
.sf-journey-gap,
.sf-journey-earned,
.sf-journey-range,
.sf-journey-table td strong,
.sf-attention-qty,
.sf-attention-qty strong,
.sf-attention-sub,
.sf-preview-row strong,
.sf-ledger-stat strong,
.sf-history-qty,
.sf-history-money,
.sf-page-info,
.sf-pill,
.sf-abc {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Slightly tighter, since mono runs wide */
.sf-price { font-size: 12.5px; letter-spacing: -0.02em; }
.sf-margin { font-size: 12px; letter-spacing: -0.02em; }
.sf-journey-gap, .sf-journey-earned { font-size: 13px; letter-spacing: -0.03em; }
.sf-journey-range { font-size: 11px; letter-spacing: -0.01em; }
.sf-journey-table td strong { font-size: 13px; letter-spacing: -0.02em; }
.sf-attention-qty strong { font-size: 14px; }
.sf-ledger-stat strong { font-size: 15.5px; letter-spacing: -0.03em; }
.sf-history-qty { font-size: 14px; }

/* SKU codes read as codes */
/* Stock level number in the catalogue row */
.sf-table td span[style*="font-weight:700"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Chart text ---------- */
.sf-axis,
.sf-bar-value,
.sf-db-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.sf-bar-label,
.sf-db-label {
  font-family: var(--font-primary);
}

.sf-tooltip { font-family: var(--font-primary); }
.sf-tooltip b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Structural labels: quieter, less shouty ---------- */
.sf-table thead th,
.sf-journey-table th,
.sf-stat-label {
  font-family: var(--font-primary);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.sf-window-tab,
.sf-attention-tab,
.sf-filter-btn {
  font-family: var(--font-primary);
  font-weight: 500;
}

/* Plex Sans has a taller x-height than Outfit, so nudge the base down a touch */
body { font-size: 14.5px; letter-spacing: -0.003em; }

.sf-journey-name,
.sf-attention-name,
.sf-item-name {
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ---------- Fixes from the switch to a mono figure face ---------- */

/* Mono runs wider than the previous sans, which pushed "KES 30.00" onto two
   lines in the narrow Cost/Sell columns. */
.sf-price,
.sf-margin,
.sf-journey-gap,
.sf-journey-earned,
.sf-attention-qty {
  white-space: nowrap;
}

.sf-table td .sf-price { display: inline-block; }
.sf-table th:nth-child(5), .sf-table th:nth-child(6) { min-width: 92px; }

/* The attention panel spans two grid rows to sit beside the two charts, but a
   short list left it stretched into a mostly-empty box. Let it take only the
   height it needs. */
.sf-panel-attention { align-self: start; }
.sf-attention-list { max-height: 380px; }

/* Codes and status pills should never break mid-token */
.sf-status,
.sf-table th:first-child { min-width: 84px; }

/* ---------- Category / supplier picker ---------- */
/* Select plus an explicit "New" button. Relying on the last option in the list
   meant nobody found it. */
.sf-combo-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.sf-combo-row select { flex: 1 1 auto; min-width: 0; }

.sf-combo-add {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px dashed var(--accent-blue);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent-blue);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.sf-combo-add:hover {
  background: rgba(0, 146, 244, 0.08);
  border-style: solid;
}

.sf-combo-add:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* A hint that behaves like a link but is a real button for keyboard users */
.sf-link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent-blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.sf-combo-new {
  margin-top: 8px;
  animation: sfComboIn 0.18s ease;
}

.sf-combo-new[hidden] { display: none; }

@keyframes sfComboIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   WORKSPACE SHELL
   A fixed rail and top bar, with one scrolling column between them. The old
   layout was a document you scrolled from a headline down to the work; this is
   a room you stand in. That single structural change is most of what makes it
   read as a shop tool rather than a web page.
   ========================================================================== */

.sf-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;          /* mobile browser chrome shrinks the real viewport */
  overflow: hidden;
}

.sf-sidebar {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  background: var(--gradient-header);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
}

.sf-side-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  text-decoration: none;
  flex: 0 0 auto;
}

.sf-side-logo img { width: 30px; height: 30px; object-fit: contain; }

.sf-side-logo span {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sf-side-logo i { font-style: normal; color: var(--accent-blue); }

.sf-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px 16px;
}

/* Chunky, always-labelled, one always lit — the POS pattern. An icon on its
   own would save room and cost recognition. */
.sf-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: rgba(255, 255, 255, 0.66);
  font-family: var(--font-primary);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-nav-item i {
  width: 17px;
  font-size: 15px;
  text-align: center;
  flex: 0 0 auto;
}

.sf-nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.sf-nav-item.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 146, 244, 0.35);
}

.sf-nav-item:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

.sf-workspace {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-light);
}

.sf-topbar {
  flex: 0 0 auto;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sf-topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
}

/* Only a phone needs this; the rail shows the brand on a wide screen */
.sf-topbar-mark { display: none; }

/* The rail owns the branding, so the bar is all controls, pushed right */
.sf-topbar-inner > .sf-header-actions { margin-left: auto; }
.sf-topbar-inner > .sf-user-menu-wrapper { margin-left: 12px; }

.sf-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
}

.sf-view[hidden] { display: none; }

.sf-view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.sf-view-grid > .sf-panel-full,
.sf-view-grid > .sf-panel-journey { grid-column: 1 / -1; }

/* ---------- Density pass ----------
   Tighter than the old page: a shop screen should show more and breathe less.
   Panels lose the soft card look and gain a definite edge. */
.sf-content .sf-panel {
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

.sf-content .sf-panel-head { margin-bottom: 11px; }
.sf-content .sf-panel-head h2 { font-size: 14.5px; }

.sf-content .sf-table-section {
  margin-top: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

/* Stays a wrapping row inside the workspace. An older mobile rule turns
   .sf-search-bar into a column, which made the search wrapper a flex-grow item
   in the vertical axis — it stretched to fill the bar and its absolutely
   centred magnifier ended up floating in the middle of the screen. */
.sf-content .sf-search-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.sf-content .sf-search-input-wrap { flex: 1 1 240px; min-width: 0; }

/* The search field and filter pills were built for the dark hero — white text
   on translucent white. On the light work surface that left them invisible, so
   they are restated here for a pale background. */
.sf-content .sf-search-input {
  padding: 10px 16px 10px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  backdrop-filter: none;
}

.sf-content .sf-search-input::placeholder { color: var(--text-light); }

.sf-content .sf-search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 146, 244, 0.14);
  background: var(--bg-card);
}

.sf-content .sf-search-input-wrap i {
  left: 14px;
  color: var(--text-light);
}

.sf-content .sf-filter-btn {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
}

.sf-content .sf-filter-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--bg-card);
}

.sf-content .sf-filter-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}

.sf-content .sf-insights-bar { margin-bottom: 14px; }

/* ---------- Weight pass ----------
   The one measurable thing the Java POS actually carries as style: of 125
   components with a font set, 124 are bold. Exactly one plain label in the
   whole app. That flat, utilitarian weight is what makes a till screen read
   like equipment rather than a document.

   Taken as far as it is useful and no further — running the body copy bold too
   would just make everything shout and nothing lead. Labels, headers and
   figures carry it; sentences do not.

   Their 33-36px control heights are deliberately NOT copied: this runs on
   phones, where 40px is the floor for a thumb. */
.sf-content .sf-table th {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}

.sf-content .sf-form-group label,
.sf-modal .sf-form-group label {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sf-content .sf-panel-head h2 { font-weight: 700; }

/* Quantities and money are what a shopkeeper scans for */
.sf-content .sf-table td .sf-price,
.sf-content .sf-item-name,
.sf-content .sf-stock-level,
.sf-content .sf-journey-name { font-weight: 700; }

.sf-content .sf-window-tab,
.sf-content .sf-sort-select,
.sf-content .sf-table-title { font-weight: 700; }

.sf-content .sf-ledger-stat strong { font-weight: 700; }

/* ---------- Reports: a record table, not a chart ----------
   Dense rows of what actually happened, in the shape a shopkeeper reads a
   sales book: date, what went, what it cost, what it fetched. */
.sf-report-table td { vertical-align: middle; }

.sf-report-date {
  font-family: var(--font-mono, var(--font-primary));
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sf-report-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sf-report-table th:nth-child(n+3) { text-align: right; }

.sf-report-gap,
.sf-report-earned { font-weight: 700; }

.sf-report-gap.positive,
.sf-report-earned.positive { color: var(--success); }

.sf-report-gap.negative,
.sf-report-earned.negative { color: var(--danger); }

/* ---------- Setup ---------- */
.sf-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.sf-setup-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font-primary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-setup-card:hover { border-color: var(--accent-blue); transform: translateY(-1px); }
.sf-setup-card:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.sf-setup-card i { font-size: 17px; color: var(--accent-blue); margin-bottom: 3px; }
.sf-setup-card strong { font-size: 14px; color: var(--text-primary); }
.sf-setup-card span { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }

/* ---------- Idle sign-out warning ----------
   Above every other overlay: it must be visible even if a modal is open when
   the clock runs down. */
.sf-idle-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 18, 26, 0.55);
  backdrop-filter: blur(2px);
}

.sf-idle-overlay[hidden] { display: none; }

.sf-idle-box {
  width: 100%;
  max-width: 380px;
  padding: 26px 24px 22px;
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.sf-idle-box h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--primary-dark);
}

.sf-idle-box p {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.sf-idle-box strong {
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.sf-idle-box button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--accent-orange);
  color: #fff;
  font-family: var(--font-primary);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-idle-box button:hover { filter: brightness(1.06); }
.sf-idle-box button:focus-visible { outline: 3px solid var(--accent-blue); outline-offset: 2px; }

/* ---------- How this works ---------- */
.sf-modal-guide { max-width: 580px; }

.sf-guide-lead {
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.sf-guide-steps {
  list-style: none;
  counter-reset: sfstep;
  margin: 0 0 22px;
  padding: 0;
}

.sf-guide-steps li {
  counter-increment: sfstep;
  position: relative;
  padding: 0 0 20px 46px;
}

/* The rail makes it read as a sequence rather than four separate tips */
.sf-guide-steps li::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 2px;
  width: 2px;
  background: var(--border-light);
}

.sf-guide-steps li:last-child { padding-bottom: 0; }
.sf-guide-steps li:last-child::after { display: none; }

.sf-guide-steps li::before {
  content: counter(sfstep);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sf-guide-steps h3 {
  margin: 5px 0 5px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--primary-dark);
}

.sf-guide-steps p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.sf-guide-steps strong { color: var(--text-primary); }

.sf-guide-note {
  padding: 13px 15px;
  margin-top: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.sf-guide-note strong { color: var(--text-primary); }

/* ---------- Category manager ---------- */
.sf-modal-narrow { max-width: 520px; }

.sf-cat-intro {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.sf-cat-add {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.sf-cat-add input { flex: 1 1 auto; min-width: 0; }
.sf-cat-add .sf-btn { flex: 0 0 auto; }

.sf-cat-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.sf-cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
}

.sf-cat-row:last-child { border-bottom: 0; }
.sf-cat-row:hover { background: var(--bg-light); }

.sf-cat-name {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-cat-count {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.sf-cat-actions { flex: 0 0 auto; display: flex; gap: 4px; }

.sf-cat-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition-fast);
}

.sf-cat-btn:hover {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--accent-blue);
}

.sf-cat-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.sf-cat-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

.sf-cat-empty {
  padding: 26px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* The "＋ Add new…" row should read as an action, not another value */
.sf-form-group select option[value="__sf_new__"] {
  font-weight: 700;
  color: var(--accent-blue);
}

/* ---------- Header icon button (theme toggle) ---------- */
.sf-icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.sf-icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.sf-icon-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ---------- Row actions menu ---------- */
.sf-row-menu-btn {
  height: 34px;   /* matches the row buttons it replaced */
  padding: 0 11px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.sf-row-menu-btn i { font-size: 12px; opacity: 0.75; }

.sf-row-menu-btn:hover,
.sf-row-menu-btn[aria-expanded="true"] {
  background: var(--bg-light);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.sf-row-menu-btn:hover i,
.sf-row-menu-btn[aria-expanded="true"] i { opacity: 1; }

.sf-row-menu-btn[aria-expanded="true"] i.fa-caret-down { transform: rotate(180deg); }

.sf-row-menu-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* The word stays at every width. Hiding it left a 25px caret that was both
   hard to hit and back to being unrecognisable — the table scrolls sideways
   on a phone anyway, so there is room for it. */

/* Fixed so it escapes the table's overflow container */
.sf-row-menu {
  position: fixed;
  z-index: 3000;
  min-width: 208px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
  animation: sfMenuIn 0.13s ease;
}

.sf-row-menu[hidden] { display: none; }

@keyframes sfMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sf-row-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-row-menu-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  flex-shrink: 0;
}

.sf-row-menu-item:hover:not(:disabled) { background: var(--bg-light); }
.sf-row-menu-item:hover:not(:disabled) i { color: var(--accent-blue); }

.sf-row-menu-item:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: -2px;
}

.sf-row-menu-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.sf-row-menu-item.danger { color: var(--danger); }
.sf-row-menu-item.danger i { color: var(--danger); }
.sf-row-menu-item.danger:hover:not(:disabled) { background: var(--danger-light); }

.sf-row-menu-divider {
  height: 1px;
  margin: 5px 8px;
  background: var(--border-light);
}

@media print {
  .sf-row-menu, .sf-row-menu-btn, .sf-icon-btn { display: none !important; }
}

/* ---------- Small screens ----------

   The header was the whole problem. It is a single non-wrapping flex row, so
   below about 470px it could not shrink — it just pushed the document wider
   than the screen. Everything downstream inherited that: the page scrolled
   sideways, the profile menu and Add Product sat off the right edge entirely,
   and .sf-modal's width:90% resolved against the over-wide page rather than
   the phone, so every modal overflowed too.

   Letting the actions wrap is what fixes it. One rule, and the rest follows. */
@media (max-width: 720px) {
  /* The rail becomes a bottom bar — thumbs reach the bottom of a phone, not
     the side of it, and it is where every phone app puts its sections. */
  .sf-shell { flex-direction: column; }

  .sf-sidebar {
    order: 2;
    flex: 0 0 auto;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow: visible;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sf-side-logo { display: none; }

  .sf-nav {
    flex-direction: row;
    width: 100%;
    padding: 6px 4px;
    gap: 2px;
  }

  .sf-nav-item {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 0 2px;
    font-size: 10.5px;
    text-align: center;
  }

  .sf-nav-item i { width: auto; font-size: 16px; }
  .sf-nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .sf-nav-item.active { box-shadow: none; }

  .sf-workspace { order: 1; flex: 1 1 auto; min-height: 0; }
  .sf-content { padding: 12px; }
  .sf-view-grid { grid-template-columns: 1fr; gap: 12px; }

  /* One row, the way every phone app does it: identity on the left, actions on
     the right. The two-row version left the avatar hanging on a line of its own
     above an otherwise empty bar, which is what made the top look unaligned. */
  .sf-topbar-inner {
    flex-wrap: nowrap;
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }

  .sf-topbar-mark { display: block; flex: 0 0 auto; }

  .sf-topbar-inner > .sf-header-actions {
    flex: 1 1 auto;
    margin-left: 0;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }

  .sf-topbar-inner > .sf-user-menu-wrapper { margin-left: 0; flex: 0 0 auto; }

  /* The shop name is the title of the screen, so it sits next to the mark and
     takes the slack rather than being squeezed by the icons. */
  .sf-shop-wrap { flex: 1 1 auto; min-width: 0; margin-right: auto; }
  .sf-shop-btn {
    width: 100%;
    justify-content: flex-start;
    background: none;
    border-color: transparent;
    padding: 0 4px;
    font-size: 15px;
  }
  #shop-name { max-width: none; font-weight: 700; }

  /* Add Product becomes a floating action, clear of the content and reachable
     with a thumb — the same place a phone app puts its primary action. */
  .sf-btn-add {
    position: fixed;
    right: 14px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 900;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(255, 72, 0, 0.42);
  }
  .sf-btn-add span { display: none; }
  .sf-btn-add i { font-size: 20px; }

  /* The phone already shows the time in its own status bar */
  .sf-header-time { display: none; }

  /* Icons carry these well enough once space is tight */
  .sf-btn-add span { display: none; }
  .sf-btn-add { padding: 0 14px; }
  .sf-sync-pill span { display: none; }
  .sf-sync-pill { padding: 0 11px; }
  #header-username { display: none; }

  /* The shop switcher takes whatever room is left, and ellipsises */
  .sf-shop-wrap { flex: 1 1 auto; min-width: 0; }
  .sf-shop-btn { width: 100%; min-width: 0; }
  #shop-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .sf-user-dropdown,
  .sf-shop-menu,
  .sf-alert-panel {
    position: fixed;
    top: 64px;
    right: 10px;
    left: 10px;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .sf-row-menu { min-width: 200px; }

  /* Full-width tap targets read better than a cramped menu */
  .sf-dropdown-item { padding: 13px 14px; font-size: 14px; }
}

/* At 320px the six controls came to ~310px against 296px of room, so the
   avatar wrapped onto a row of its own. Trimming the gaps and capping the shop
   name brings it back to one line without shrinking anything below 36px. */
@media (max-width: 400px) {
  .sf-header-actions { gap: 6px; }
  .sf-shop-btn { padding: 0 9px; gap: 5px; }
  #shop-name { max-width: 62px; }
  .sf-btn-add { padding: 0 11px; }
  .sf-sync-pill { padding: 0 9px; }
}

/* Thumbs, not cursors: nothing interactive under 40px tall on a touch screen. */
@media (max-width: 720px) {
  .sf-modal { width: calc(100% - 24px); margin: 0 12px; }
  .sf-modal-body { padding: 16px; }
  .sf-modal-footer { padding: 14px 16px; }

  .sf-modal-close { width: 40px; height: 40px; }
  .sf-cat-btn { width: 40px; height: 40px; font-size: 14px; }
  .sf-cat-actions { gap: 6px; }

  /* A one-line link inside a hint is still something a thumb has to hit */
  .sf-link-btn { display: inline-block; padding: 9px 0; }

  .sf-form-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
  }
  .sf-form-group label > input[type="checkbox"] + span { padding: 10px 0; display: inline-block; }

  /* Stack the paired form fields rather than squeezing two into 300px */
  .sf-form-row { grid-template-columns: 1fr; }
  .sf-combo-add { padding: 0 14px; }

  /* Bottom of the screen is where a thumb is, and where a phone puts its own
     notifications — top-right on a 320px screen covers the header controls.
     Lifted clear of the section bar, which now occupies the bottom edge. */
  .sf-toast-container {
    top: auto;
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    align-items: center;
  }
  .sf-toast { width: 100%; max-width: 100%; }

  .sf-guide-steps li { padding-left: 42px; }
  .sf-guide-steps li::before { width: 30px; height: 30px; font-size: 13px; }
  .sf-guide-steps li::after { left: 14px; }

  /* A panel header is a title and an action. space-between on a wrapped flex
     row put the button alone on its own line, shoved to the right edge with a
     gap above it. Stack them properly and let the action span the width. */
  .sf-content .sf-panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .sf-content .sf-panel-head .sf-btn-export {
    width: 100%;
    justify-content: center;
  }

  /* Filters as a small grid rather than a ragged wrap: the picker takes the
     width, the two dates sit side by side because they are a pair, and Clear
     goes underneath. */
  .sf-content .sf-ledger-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 10px;
  }

  .sf-content .sf-ledger-controls > select,
  .sf-content .sf-ledger-controls > button { grid-column: 1 / -1; }

  .sf-content .sf-ledger-controls label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
  }

  .sf-content .sf-ledger-controls input[type="date"] {
    width: 100%;
    min-width: 0;
    min-height: 42px;
  }

  /* Six full-width cards is a lot of scrolling for six numbers */
  .sf-content .sf-ledger-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sf-content .sf-ledger-stat { padding: 10px 12px; }

  /* The dumbbell chart is drawn on a 720-unit canvas. Squeezed into a 262px
     phone it scales to 0.36, which renders its labels at 3.8px — measured, not
     estimated. That is not a small chart, it is an unreadable one, and it was
     also letterboxing a lot of empty space under itself.

     The table directly beneath carries the same four numbers per product at
     full size, so the honest thing on a phone is to show that and drop the
     picture rather than ship a decorative smear. */
  .sf-content #chart-journey { display: none; }

  /* The catalogue heading and its sort control were sharing a row, so the
     title wrapped around the dropdown. They are two separate things. */
  .sf-content .sf-table-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .sf-content .sf-table-actions { width: 100%; }
  .sf-content .sf-sort-select { width: 100%; min-height: 42px; }
}

/* ============================================
   ALERTS — bell, badge and feed
   ============================================ */
.sf-bell-wrap { position: relative; flex-shrink: 0; }

.sf-bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--accent-orange);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  border: 2px solid var(--header-bg);
  pointer-events: none;
}

.sf-bell-badge[hidden] { display: none; }

.sf-alert-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 372px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  z-index: 2500;
  overflow: hidden;
  animation: sfMenuIn 0.14s ease;
}

.sf-alert-panel[hidden] { display: none; }

.sf-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
}

.sf-alert-head strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--primary-dark);
}

.sf-alert-head-actions { display: flex; gap: 4px; }

.sf-alert-head-actions button,
.sf-alert-foot button {
  border: none;
  background: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.sf-alert-head-actions button:hover,
.sf-alert-foot button:hover { background: var(--bg-light); color: var(--accent-blue); }

/* Opt-in strip for browser notifications */
.sf-alert-optin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--info-light);
  border-bottom: 1px solid var(--border-light);
}

.sf-alert-optin[hidden] { display: none; }
.sf-alert-optin strong { display: block; font-size: 12.5px; color: var(--primary-dark); }
.sf-alert-optin span { font-size: 11.5px; color: var(--text-secondary); line-height: 1.4; }

.sf-alert-optin button {
  flex-shrink: 0;
  border: none;
  background: var(--accent-blue);
  color: #fff;
  padding: 7px 13px;
  border-radius: var(--radius-btn);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sf-alert-optin button:hover { background: #007AD9; }

.sf-alert-list { overflow-y: auto; flex: 1; }

.sf-alert-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-primary);
  transition: var(--transition-fast);
}

.sf-alert-item:hover { background: var(--bg-light); }
.sf-alert-item.unread { background: rgba(0, 146, 244, 0.045); }
.sf-alert-item.critical { border-left-color: var(--danger); }
.sf-alert-item.warning { border-left-color: var(--warning); }
.sf-alert-item.success { border-left-color: var(--success); }
.sf-alert-item.info { border-left-color: var(--accent-blue); }

.sf-alert-item > i { font-size: 14px; margin-top: 2px; flex-shrink: 0; }
.sf-alert-item.critical > i { color: var(--danger); }
.sf-alert-item.warning > i { color: var(--warning); }
.sf-alert-item.success > i { color: var(--success); }
.sf-alert-item.info > i { color: var(--accent-blue); }

.sf-alert-text { flex: 1; min-width: 0; }
.sf-alert-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.35;
}
.sf-alert-text span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.sf-alert-time {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-light);
  white-space: nowrap;
  margin-top: 2px;
}

.sf-alert-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 44px 20px;
  text-align: center;
}
.sf-alert-empty i { font-size: 26px; color: var(--success); margin-bottom: 4px; }
.sf-alert-empty strong { font-size: 14px; color: var(--primary-dark); }
.sf-alert-empty span { font-size: 12.5px; color: var(--text-secondary); }

.sf-alert-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-light);
}

.sf-alert-foot span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--success);
}

@media (max-width: 560px) {
  .sf-alert-panel {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 72vh;
  }
}

@media print {
  .sf-bell-wrap, .sf-alert-panel { display: none !important; }
}

/* ============================================
   CLOUD — shop switcher & sync status
   ============================================ */
.sf-shop-wrap { position: relative; flex-shrink: 0; }

.sf-shop-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
  padding: 7px 13px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-btn);
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-shop-btn:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); }
.sf-shop-btn > i:first-child { color: var(--accent-blue); font-size: 13px; }
.sf-shop-btn #shop-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-shop-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 230px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.18);
  z-index: 2600;
  animation: sfMenuIn 0.13s ease;
}

.sf-shop-menu[hidden] { display: none; }

.sf-shop-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-shop-item:hover { background: var(--bg-light); }
.sf-shop-item i { width: 15px; text-align: center; font-size: 12px; color: var(--text-light); }
.sf-shop-item.current { font-weight: 700; color: var(--accent-blue); }
.sf-shop-item.current i { color: var(--accent-blue); }

.sf-shop-divider { height: 1px; margin: 5px 8px; background: var(--border-light); }
.sf-shop-empty { padding: 14px; font-size: 12.5px; color: var(--text-light); text-align: center; }

/* ---------- Sync pill ---------- */
.sf-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-btn);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.sf-sync-pill:hover { background: rgba(255, 255, 255, 0.13); color: #fff; }
.sf-sync-pill i { font-size: 11px; }

/* State is carried by an icon and a word, never colour alone */
.sf-sync-pill.syncing { color: #7EC8FF; border-color: rgba(126, 200, 255, 0.35); }
.sf-sync-pill.pending { color: #FFD08A; border-color: rgba(255, 208, 138, 0.35); }
.sf-sync-pill.offline { color: #FFB3B3; border-color: rgba(255, 179, 179, 0.3); }
.sf-sync-pill.error   { color: #FF8F8F; border-color: rgba(255, 143, 143, 0.45); background: rgba(231, 76, 60, 0.14); }

@keyframes fa-spin-kf { to { transform: rotate(360deg); } }
.fa-spin::before { animation: fa-spin-kf 1.1s linear infinite; }

/* On a phone the header is tight: keep the pill as an icon and shorten the shop name */
@media (max-width: 720px) {
  .sf-sync-pill span { display: none; }
  .sf-sync-pill { padding: 7px 9px; }
  .sf-shop-btn { max-width: 116px; padding: 7px 10px; }
  .sf-shop-btn i.fa-chevron-down { display: none; }
}

@media (max-width: 560px) {
  .sf-shop-menu {
    position: fixed;
    top: 60px;
    left: 10px;
    right: 10px;
    min-width: 0;
  }
}

@media print {
  .sf-shop-wrap, .sf-sync-pill { display: none !important; }
}

/* ---------- Mobile responsiveness fixes ---------- */

/* Charts: horizontal scroll with minimum readable width instead of squashing */
@media (max-width: 720px) {
  .sf-chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sf-chart { min-width: 480px; }
  .sf-chart-trend { height: auto; }

  /* Tooltip: cap width so it doesn't overflow the viewport */
  .sf-tooltip { max-width: 90vw; white-space: normal; }

  /* Touch targets: minimum 44px for comfortable tapping */
  .sf-row-btn { min-width: 44px; min-height: 44px; }
  .sf-icon-btn { width: 44px; height: 44px; }
  .sf-page-btn { min-width: 44px; min-height: 44px; }
}

/* ============================================
   FAST COUNTER TILL / QUICK BASKET STYLES
   ============================================ */

.sf-modal-pos {
  max-width: 1060px;
  width: 96%;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-pos-header {
  background: #ffffff;
  border-bottom: 1.5px solid #e1e4e8;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sf-pos-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sf-pos-header-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sf-pos-header-icon-wrap .sf-pos-icon-lg {
  width: 24px;
  height: 24px;
  margin: 0;
}

.sf-pos-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sf-pos-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sf-pos-title-row .sf-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  letter-spacing: -0.2px;
}

.sf-pos-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #047857;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid #a7f3d0;
  letter-spacing: 0.4px;
}

.sf-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.sf-pos-subtitle {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.sf-pos-kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: #334155;
  font-weight: 700;
}

.sf-pos-container {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  flex: 1 1 auto;
  min-height: 520px;
  max-height: calc(94vh - 72px);
  overflow: hidden;
}

/* --- Catalog / Left Column --- */
.sf-pos-catalog {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  border-right: 1.5px solid #e1e4e8;
  overflow-y: auto;
  background: #f8fafc;
  gap: 12px;
}

.sf-pos-search-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sf-pos-search-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.sf-pos-search-wrap .sf-pos-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  width: 15px;
  height: 15px;
  pointer-events: none;
  color: #64748b !important;
  opacity: 0.85;
  z-index: 2;
}

.sf-pos-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px !important;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1 !important;
  font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #0f172a !important; /* High-contrast dark text */
  background: #ffffff !important;
  caret-color: #0969da !important;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  -webkit-appearance: none;
  appearance: none;
}

.sf-pos-search-input::placeholder {
  color: #94a3b8 !important;
  font-weight: 400;
  opacity: 1;
}

.sf-pos-search-input:focus {
  border-color: #0969da !important;
  color: #0f172a !important;
  background: #ffffff !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.18) !important;
}

.sf-pos-search-input::-webkit-search-cancel-button {
  cursor: pointer;
  opacity: 0.6;
}

.sf-pos-search-input::-webkit-search-cancel-button:hover {
  opacity: 1;
}

.sf-pos-cat-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.sf-pos-cat-chip {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #d0d7de;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.sf-pos-cat-chip:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #94a3b8;
}

.sf-pos-cat-chip.active {
  background: #0969da;
  color: #ffffff;
  border-color: #0969da;
  box-shadow: 0 2px 6px rgba(9, 105, 218, 0.25);
}

.sf-pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 10px;
  overflow-y: auto;
  flex: 1 1 auto;
  padding-right: 2px;
  align-content: start;
}

.sf-pos-product-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  min-height: 96px;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  position: relative;
}

.sf-pos-product-card:hover {
  border-color: #0969da;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(9, 105, 218, 0.12);
}

.sf-pos-product-card:active {
  transform: scale(0.98);
  background: #f0f7ff;
}

.sf-pos-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}

.sf-pos-card-cat {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-pos-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
}

.sf-pos-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-top: auto;
}

.sf-pos-card-price {
  font-size: 14.5px;
  font-weight: 800;
  color: #0969da;
  font-family: var(--font-mono);
  letter-spacing: -0.2px;
}

.sf-pos-card-stock {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #047857;
}

.sf-pos-product-card.out-of-stock {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
  border-style: dashed;
}

.sf-pos-product-card.out-of-stock:hover {
  transform: none;
  border-color: #cbd5e1;
  box-shadow: none;
}

.sf-pos-product-card.out-of-stock .sf-pos-card-stock {
  background: #fee2e2;
  color: #b91c1c;
}

/* --- Basket / Right Column --- */
.sf-pos-cart {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-left: 1.5px solid #e1e4e8;
  overflow: hidden;
}

.sf-pos-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.sf-pos-cart-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.sf-pos-cart-count-badge {
  padding: 1px 7px;
  border-radius: 12px;
  background: #0969da;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.sf-pos-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.sf-pos-clear-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.sf-pos-cart-items {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sf-pos-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  color: #94a3b8;
  gap: 8px;
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.sf-pos-cart-empty i {
  font-size: 32px;
  opacity: 0.35;
  margin-bottom: 2px;
}

.sf-pos-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  gap: 8px;
  transition: all 0.15s ease;
}

.sf-pos-item-row:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.sf-pos-item-main {
  flex: 1 1 auto;
  min-width: 0;
}

.sf-pos-item-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-pos-item-meta {
  font-size: 11.5px;
  color: #64748b;
  font-family: var(--font-mono);
  margin-top: 1px;
}

.sf-pos-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sf-pos-stepper {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.sf-pos-step-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: #ffffff;
  color: #1e293b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.sf-pos-step-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0969da;
}

.sf-pos-step-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.sf-pos-step-val {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #0f172a;
}

.sf-pos-item-subtotal {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  font-family: var(--font-mono);
  min-width: 68px;
  text-align: right;
}

.sf-pos-item-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s ease;
}

.sf-pos-item-remove:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* --- Checkout Controls --- */
.sf-pos-checkout-section {
  padding: 14px 18px;
  background: #ffffff;
  border-top: 1.5px solid #e1e4e8;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.03);
}

.sf-pos-summary-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.sf-pos-summary-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

.sf-pos-total-val {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  font-family: var(--font-mono);
  letter-spacing: -0.4px;
}

.sf-pos-pay-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 5px;
}

.sf-pos-pay-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.sf-pay-icon-badge {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.sf-pay-icon-badge-sm {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 5px;
}

.sf-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  border-radius: 7px;
  border: 1.5px solid #d0d7de;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sf-pay-btn:hover {
  background: #ffffff;
  border-color: #94a3b8;
  color: #1e293b;
}

.sf-pay-btn.active[data-method="cash"] {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.sf-pay-btn.active[data-method="mpesa"] {
  background: #f0fdf4;
  border-color: #008744;
  color: #006030;
  box-shadow: 0 2px 6px rgba(0, 135, 68, 0.2);
}

.sf-pay-btn.active[data-method="other"] {
  background: #eff6ff;
  border-color: #0969da;
  color: #1e40af;
  box-shadow: 0 2px 6px rgba(9, 105, 218, 0.2);
}

.sf-pos-cash-panel,
.sf-pos-mpesa-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sf-pos-input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

.sf-pos-currency-input-wrap {
  position: relative;
  width: 100%;
}

.sf-pos-input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  font-family: var(--font-mono);
  pointer-events: none;
}

.sf-pos-currency-input-wrap input,
.sf-pos-mpesa-panel input {
  width: 100%;
  padding: 8px 12px 8px 44px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: #ffffff;
  transition: all 0.15s ease;
}

.sf-pos-mpesa-panel input {
  padding-left: 12px;
  font-family: var(--font-primary);
  font-weight: 600;
}

.sf-pos-currency-input-wrap input:focus,
.sf-pos-mpesa-panel input:focus {
  border-color: #0969da;
  outline: none;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.12);
}

.sf-cash-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.sf-cash-chip {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sf-cash-chip:hover {
  background: #0969da;
  color: #ffffff;
  border-color: #0969da;
}

.sf-pos-change-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ecfdf5;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
  font-size: 13px;
  color: #047857;
}

.sf-pos-change-val {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.sf-pos-complete-btn {
  width: 100%;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, #2da44e 0%, #2c974b 100%);
  color: #ffffff;
  border: 1px solid #2a8f47;
  box-shadow: 0 2px 8px rgba(45, 164, 78, 0.35);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sf-pos-complete-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #2c974b 0%, #24823d 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(45, 164, 78, 0.45);
}

.sf-pos-complete-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================
   RECEIPT & WHATSAPP SHARING STYLES
   ============================================ */

.sf-modal-receipt {
  max-width: 440px;
  width: 92%;
  border-radius: 12px;
}

.sf-receipt-header {
  background: #ffffff;
  border-bottom: 1.5px solid #e1e4e8;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sf-receipt-ticket {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px 20px;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.sf-receipt-shop {
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  color: #0f172a;
  font-family: var(--font-primary);
  letter-spacing: -0.2px;
}

.sf-receipt-meta {
  font-size: 11.5px;
  color: #64748b;
  text-align: center;
}

.sf-receipt-divider {
  border: none;
  border-top: 1px dashed #cbd5e1;
  margin: 6px 0;
}

.sf-receipt-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.sf-receipt-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  line-height: 1.3;
}

.sf-receipt-item-desc {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
  color: #1e293b;
}

.sf-receipt-item-price {
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
  color: #0f172a;
}

.sf-receipt-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 900;
  color: #0f172a;
  padding-top: 2px;
}

.sf-receipt-change-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

.sf-receipt-footer {
  text-align: center;
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 6px;
  font-style: italic;
}

.sf-receipt-share-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sf-receipt-share-box label {
  font-size: 12.5px;
  font-weight: 700;
  color: #166534;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sf-whatsapp-row {
  display: flex;
  gap: 6px;
}

.sf-whatsapp-row input {
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 1.5px solid #86efac;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
}

.sf-whatsapp-row input:focus {
  border-color: #25D366;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

.sf-btn-whatsapp {
  background: #25D366;
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
}

.sf-btn-whatsapp:hover {
  background: #1eb956;
}

/* ============================================
   PAYMENT BADGES & SUMMARY
   ============================================ */

.sf-badge-pay {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sf-badge-pay.cash {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.sf-badge-pay.mpesa {
  background: #e8f8f0;
  color: #008744;
  border: 1px solid #a3e9c4;
}

.sf-badge-pay.other {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

/* Mobile adjustments for POS counter modal */
@media (max-width: 768px) {
  .sf-pos-container {
    grid-template-columns: 1fr;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
  }
  .sf-pos-catalog {
    border-right: none;
    border-bottom: 1.5px solid #e1e4e8;
    max-height: 280px;
    padding: 12px;
  }
  .sf-pos-cart {
    border-left: none;
  }
  .sf-btn-quick-sale {
    display: inline-flex !important;
    padding: 6px 10px !important;
    gap: 4px !important;
  }
  .sf-btn-quick-sale span:not(.sf-pos-shortcut-badge) {
    display: none !important;
  }
}

/* ============================================
   BULK PRODUCT & PRICE IMPORT STYLES
   ============================================ */

.sf-modal-import {
  max-width: 880px;
  width: 95%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.sf-import-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(92vh - 130px);
  overflow-y: auto;
  padding: 18px 20px;
}

.sf-import-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1.5px solid var(--border-light);
  padding-bottom: 8px;
}

.sf-import-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.sf-import-tab:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.sf-import-tab.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* Dropzone */
.sf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.sf-dropzone:hover,
.sf-dropzone.dragover {
  border-color: var(--accent-blue);
  background: #eff6ff;
}

.sf-dropzone-icon {
  font-size: 36px;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.sf-dropzone strong {
  font-size: 14px;
  color: var(--text-primary);
}

.sf-dropzone span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Paste Textarea */
.sf-import-textarea {
  width: 100%;
  height: 140px;
  padding: 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  background: var(--bg-light);
  resize: vertical;
}

.sf-import-textarea:focus {
  border-color: var(--accent-blue);
  background: #fff;
  outline: none;
}

.sf-import-help-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 8px;
}

/* Preview Section */
.sf-import-preview-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.sf-import-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sf-import-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: var(--bg-light);
  color: var(--text-secondary);
}

.sf-import-chip.total strong { color: var(--primary-dark); }

.sf-import-chip.valid {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.sf-import-chip.update {
  background: #fefce8;
  border-color: #fef08a;
  color: #854d0e;
}

.sf-import-chip.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.sf-import-table-wrap {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.sf-import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.sf-import-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1.5px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 700;
}

.sf-import-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.sf-import-row-error {
  background: #fff5f5;
}

.sf-import-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.sf-import-badge.new {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.sf-import-badge.update {
  background: #fff8e1;
  color: #f57f17;
  border: 1px solid #ffe082;
}

.sf-import-badge.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.sf-import-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.sf-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-primary);
}

/* ============================================
   THERMAL RECEIPT PRINTING MEDIA QUERY
   ============================================ */
@media print {
  body.sf-printing-receipt * {
    visibility: hidden !important;
  }
  body.sf-printing-receipt #receipt-ticket,
  body.sf-printing-receipt #receipt-ticket * {
    visibility: visible !important;
  }
  body.sf-printing-receipt #receipt-ticket {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 80mm !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 4mm !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11px !important;
  }
}
