/* COMPONENTS CSS */
/* Tabs */
.tabs{display:flex;gap:4px;background:var(--bg-input);border-radius:10px;padding:4px;margin-bottom:24px}
.tab-btn{flex:1;padding:8px 16px;border-radius:8px;font-size:13px;font-weight:500;color:var(--text-muted);transition:var(--transition);white-space:nowrap}
.tab-btn.active{background:var(--bg-card);color:var(--text-primary);box-shadow:0 2px 8px rgba(0,0,0,.3)}

/* Info row in detail views */
.info-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px;margin-bottom:20px}
.info-item label{font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;display:block;margin-bottom:4px}
.info-item span{font-size:14px;font-weight:500;color:var(--text-primary)}

/* Timeline */
.timeline{display:flex;flex-direction:column;gap:0}
.timeline-item{display:flex;gap:16px;position:relative;padding-bottom:20px}
.timeline-item:last-child{padding-bottom:0}
.timeline-line{display:flex;flex-direction:column;align-items:center}
.timeline-dot{width:10px;height:10px;border-radius:50%;background:var(--accent);border:2px solid var(--bg-card);flex-shrink:0;margin-top:4px;z-index:1}
.timeline-connector{width:2px;flex:1;background:var(--border);margin-top:4px}
.timeline-item:last-child .timeline-connector{display:none}
.timeline-content{flex:1;padding-bottom:4px}
.timeline-title{font-size:13px;font-weight:600;margin-bottom:2px}
.timeline-meta{font-size:11px;color:var(--text-muted)}
.timeline-body{font-size:13px;color:var(--text-secondary);margin-top:6px}

/* User cards */
.user-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:20px;text-align:center;transition:var(--transition)}
.user-card:hover{border-color:var(--border-light);transform:translateY(-2px);box-shadow:var(--shadow-card)}
.user-card-avatar{width:60px;height:60px;border-radius:14px;background:linear-gradient(135deg,var(--accent),var(--purple));display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:800;margin:0 auto 12px}
.user-card-name{font-size:15px;font-weight:700;margin-bottom:4px}
.user-card-role{font-size:12px;color:var(--accent-light);margin-bottom:8px}
.user-card-dept{font-size:12px;color:var(--text-muted)}
.user-card-actions{display:flex;gap:8px;justify-content:center;margin-top:14px}

/* Switch toggle */
.switch{position:relative;display:inline-block;width:40px;height:22px}
.switch input{opacity:0;width:0;height:0}
.slider{position:absolute;cursor:pointer;inset:0;background:var(--border);border-radius:22px;transition:var(--transition)}
.slider::before{content:'';position:absolute;height:16px;width:16px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:var(--transition)}
input:checked+.slider{background:var(--accent)}
input:checked+.slider::before{transform:translateX(18px)}

/* Settings sections */
.settings-section{margin-bottom:28px}
.settings-section-title{font-size:14px;font-weight:700;color:var(--text-primary);margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border)}
.settings-row{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--border)}
.settings-row:last-child{border-bottom:none}
.settings-row-info{flex:1;margin-right:20px}
.settings-row-title{font-size:13px;font-weight:600;margin-bottom:3px}
.settings-row-desc{font-size:12px;color:var(--text-muted)}

/* Donut chart placeholder */
.donut-chart{width:120px;height:120px;border-radius:50%;background:conic-gradient(var(--green) 0% 35%,var(--blue) 35% 60%,var(--yellow) 60% 75%,var(--red) 75% 100%);position:relative;flex-shrink:0}
.donut-chart::after{content:'';position:absolute;inset:20px;border-radius:50%;background:var(--bg-card)}

/* Chart bar simple */
.bar-chart{display:flex;flex-direction:column;gap:12px}
.bar-item{display:flex;align-items:center;gap:12px}
.bar-label{font-size:12px;color:var(--text-secondary);width:100px;flex-shrink:0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}
.bar-track{flex:1;background:var(--border);border-radius:6px;height:8px;overflow:hidden}
.bar-fill{height:100%;border-radius:6px;transition:width .8s ease}
.bar-val{font-size:12px;font-weight:600;width:40px;text-align:right;flex-shrink:0}

/* File upload zone */
.upload-zone{border:2px dashed var(--border);border-radius:var(--radius);padding:32px;text-align:center;cursor:pointer;transition:var(--transition)}
.upload-zone:hover{border-color:var(--accent);background:var(--accent-glow)}
.upload-icon{font-size:36px;margin-bottom:12px}
.upload-text{font-size:14px;font-weight:500;margin-bottom:4px}
.upload-hint{font-size:12px;color:var(--text-muted)}

/* Permission matrix */
.permission-table th,.permission-table td{padding:10px 14px;text-align:center;font-size:12px}
.permission-table th:first-child,.permission-table td:first-child{text-align:left;font-weight:600}
.perm-check{color:var(--green);font-size:16px}
.perm-cross{color:var(--red);font-size:16px}

/* Tags */
.tag{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:6px;font-size:11px;font-weight:500;background:var(--bg-input);border:1px solid var(--border);color:var(--text-secondary)}
.tags{display:flex;flex-wrap:wrap;gap:6px}

/* Divider */
.divider{height:1px;background:var(--border);margin:20px 0}

/* Spreadsheet Grid UI */
.spreadsheet-wrap{border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;background:var(--bg-card);display:flex;flex-direction:column}
.spreadsheet-table{width:100%;border-collapse:collapse;font-size:13px}
.spreadsheet-table th{background:var(--bg-card) !important;padding:10px;text-align:left;font-weight:600;border-bottom:1px solid var(--border);border-right:1px solid var(--border);user-select:none;position:sticky;top:0;z-index:2}
.spreadsheet-table th.sortable{cursor:pointer;transition:background 0.2s}
.spreadsheet-table th.sortable:hover{background:var(--bg-input)}
.spreadsheet-table td{padding:0;border-bottom:1px solid var(--border);border-right:1px solid var(--border);position:relative;vertical-align:top}
.spreadsheet-table td:last-child,.spreadsheet-table th:last-child{border-right:none}
.spreadsheet-table tr:hover{background:rgba(255,255,255,0.02)}
.spreadsheet-table tr.selected{background:rgba(var(--accent-rgb),0.1)}

/* Sticky columns 1 and 2 (common to all sheets) */
.spreadsheet-table th:nth-child(1),
.spreadsheet-table td:nth-child(1):not([colspan]) {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-card) !important;
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
}
.spreadsheet-table th:nth-child(2),
.spreadsheet-table td:nth-child(2):not([colspan]) {
  position: sticky;
  left: 40px;
  z-index: 1;
  background: var(--bg-card) !important;
  width: 55px !important;
  min-width: 55px !important;
  max-width: 55px !important;
}

/* Sticky column 3 for regular sheets (Customer) */
.spreadsheet-table:not(.sheet-existing-customers) th:nth-child(3),
.spreadsheet-table:not(.sheet-existing-customers) td:nth-child(3):not([colspan]) {
  position: sticky;
  left: 95px;
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 150px;
  border-right: 2px solid var(--border-light) !important;
}

/* Sticky columns 3 (Customer), 4 (Sale Date), 5 (AMC), 6 (Sale By), 7 (Status) and 8 (Product) for Existing Customers sheet */
.spreadsheet-table.sheet-existing-customers th:nth-child(3),
.spreadsheet-table.sheet-existing-customers td:nth-child(3):not([colspan]) {
  position: sticky !important;
  left: 95px !important;
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 180px !important;
  width: 180px !important;
  max-width: 180px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-existing-customers th:nth-child(4),
.spreadsheet-table.sheet-existing-customers td:nth-child(4):not([colspan]) {
  position: sticky !important;
  left: 275px !important; /* 95px + 180px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 160px !important;
  width: 160px !important;
  max-width: 160px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-existing-customers th:nth-child(5),
.spreadsheet-table.sheet-existing-customers td:nth-child(5):not([colspan]) {
  position: sticky !important;
  left: 435px !important; /* 275px + 160px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 200px !important;
  width: 200px !important;
  max-width: 200px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-existing-customers th:nth-child(6),
.spreadsheet-table.sheet-existing-customers td:nth-child(6):not([colspan]) {
  position: sticky !important;
  left: 635px !important; /* 435px + 200px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 180px !important;
  width: 180px !important;
  max-width: 180px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-existing-customers th:nth-child(7),
.spreadsheet-table.sheet-existing-customers td:nth-child(7):not([colspan]) {
  position: sticky !important;
  left: 815px !important; /* 635px + 180px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 130px !important;
  width: 130px !important;
  max-width: 130px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-existing-customers th:nth-child(8),
.spreadsheet-table.sheet-existing-customers td:nth-child(8):not([colspan]) {
  position: sticky !important;
  left: 945px !important; /* 815px + 130px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 120px !important;
  width: 120px !important;
  max-width: 120px !important;
  border-right: 2px solid var(--border-light) !important;
}

/* Sticky headers overlap z-index on vertical and horizontal scroll */
.spreadsheet-table:not(.sheet-existing-customers):not(.sheet-lead-sheet) th:nth-child(1),
.spreadsheet-table:not(.sheet-existing-customers):not(.sheet-lead-sheet) th:nth-child(2),
.spreadsheet-table:not(.sheet-existing-customers):not(.sheet-lead-sheet) th:nth-child(3) {
  z-index: 10 !important;
  background: var(--bg-card) !important;
}
.spreadsheet-table.sheet-existing-customers th:nth-child(1),
.spreadsheet-table.sheet-existing-customers th:nth-child(2),
.spreadsheet-table.sheet-existing-customers th:nth-child(3),
.spreadsheet-table.sheet-existing-customers th:nth-child(4),
.spreadsheet-table.sheet-existing-customers th:nth-child(5),
.spreadsheet-table.sheet-existing-customers th:nth-child(6),
.spreadsheet-table.sheet-existing-customers th:nth-child(7),
.spreadsheet-table.sheet-existing-customers th:nth-child(8) {
  z-index: 10 !important;
  background: var(--bg-card) !important;
}

/* Hover styles for sticky cells */
.spreadsheet-table:not(.sheet-existing-customers) tr:hover td:nth-child(1):not([colspan]),
.spreadsheet-table:not(.sheet-existing-customers) tr:hover td:nth-child(2):not([colspan]),
.spreadsheet-table:not(.sheet-existing-customers) tr:hover td:nth-child(3):not([colspan]) {
  background: var(--bg-card-hover) !important;
}
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(1):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(2):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(3):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(4):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(5):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(6):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(7):not([colspan]),
.spreadsheet-table.sheet-existing-customers tr:hover td:nth-child(8):not([colspan]) {
  background: var(--bg-card-hover) !important;
}

/* Sticky columns for Lead sheet */
.spreadsheet-table.sheet-lead-sheet th:nth-child(3),
.spreadsheet-table.sheet-lead-sheet td:nth-child(3):not([colspan]) {
  position: sticky !important;
  left: 95px !important;
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 180px !important;
  width: 180px !important;
  max-width: 180px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(4),
.spreadsheet-table.sheet-lead-sheet td:nth-child(4):not([colspan]) {
  position: sticky !important;
  left: 275px !important; /* 95px + 180px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 160px !important;
  width: 160px !important;
  max-width: 160px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(5),
.spreadsheet-table.sheet-lead-sheet td:nth-child(5):not([colspan]) {
  position: sticky !important;
  left: 435px !important; /* 275px + 160px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 140px !important;
  width: 140px !important;
  max-width: 140px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(6),
.spreadsheet-table.sheet-lead-sheet td:nth-child(6):not([colspan]) {
  position: sticky !important;
  left: 575px !important; /* 435px + 140px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 180px !important;
  width: 180px !important;
  max-width: 180px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(7),
.spreadsheet-table.sheet-lead-sheet td:nth-child(7):not([colspan]) {
  position: sticky !important;
  left: 755px !important; /* 575px + 180px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 130px !important;
  width: 130px !important;
  max-width: 130px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(8),
.spreadsheet-table.sheet-lead-sheet td:nth-child(8):not([colspan]) {
  position: sticky !important;
  left: 885px !important; /* 755px + 130px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 150px !important;
  width: 150px !important;
  max-width: 150px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(9),
.spreadsheet-table.sheet-lead-sheet td:nth-child(9):not([colspan]) {
  position: sticky !important;
  left: 1035px !important; /* 885px + 150px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 120px !important;
  width: 120px !important;
  max-width: 120px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(10),
.spreadsheet-table.sheet-lead-sheet td:nth-child(10):not([colspan]) {
  position: sticky !important;
  left: 1155px !important; /* 1035px + 120px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 120px !important;
  width: 120px !important;
  max-width: 120px !important;
  border-right: none !important;
}
.spreadsheet-table.sheet-lead-sheet th:nth-child(11),
.spreadsheet-table.sheet-lead-sheet td:nth-child(11):not([colspan]) {
  position: sticky !important;
  left: 1275px !important; /* 1155px + 120px */
  z-index: 1;
  background: var(--bg-card) !important;
  min-width: 175px !important;
  width: 175px !important;
  max-width: 175px !important;
  border-right: 2px solid var(--border-light) !important;
}

/* Sticky headers overlap z-index on vertical and horizontal scroll */
.spreadsheet-table.sheet-lead-sheet th:nth-child(1),
.spreadsheet-table.sheet-lead-sheet th:nth-child(2),
.spreadsheet-table.sheet-lead-sheet th:nth-child(3),
.spreadsheet-table.sheet-lead-sheet th:nth-child(4),
.spreadsheet-table.sheet-lead-sheet th:nth-child(5),
.spreadsheet-table.sheet-lead-sheet th:nth-child(6),
.spreadsheet-table.sheet-lead-sheet th:nth-child(7),
.spreadsheet-table.sheet-lead-sheet th:nth-child(8),
.spreadsheet-table.sheet-lead-sheet th:nth-child(9),
.spreadsheet-table.sheet-lead-sheet th:nth-child(10),
.spreadsheet-table.sheet-lead-sheet th:nth-child(11) {
  z-index: 10 !important;
  background: var(--bg-card) !important;
}

/* Hover styles for sticky cells in Lead sheet */
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(1):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(2):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(3):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(4):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(5):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(6):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(7):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(8):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(9):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(10):not([colspan]),
.spreadsheet-table.sheet-lead-sheet tr:hover td:nth-child(11):not([colspan]) {
  background: var(--bg-card-hover) !important;
}

/* Follow-up Badges */
.followup-badge.active {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}
.followup-badge.active-today {
  background: rgba(245, 158, 11, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.followup-badge.expired {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Drag & Drop Column Headers */
.spreadsheet-table th.draggable-th{cursor:grab;transition:background 0.2s, opacity 0.2s}
.spreadsheet-table th.draggable-th:active{cursor:grabbing}
.spreadsheet-table th.dragging{opacity:0.4;background:var(--bg-card)}
.spreadsheet-table th.drag-over-left{border-left:2px solid var(--accent) !important}
.spreadsheet-table th.drag-over-right{border-right:2px solid var(--accent) !important}

/* Column Resize Handle */
.col-resize-handle{
  position:absolute;right:-3px;top:0;height:100%;width:7px;
  cursor:col-resize;z-index:5;background:transparent;border-radius:2px;
}
.col-resize-handle:hover{background:rgba(var(--accent-rgb),0.35);}


/* Editable Cells */
.cell-view{padding:8px 10px;display:block;width:100%;cursor:cell;min-height:34px;max-height:90px;white-space:pre-wrap;word-break:break-word;overflow:hidden;box-sizing:border-box;line-height:1.5}
.td-editable:hover .cell-view{box-shadow:inset 0 0 0 1px var(--border-light)}
.td-editable.editing .cell-view{display:none}
.cell-input{display:none;width:100%;height:100%;border:none;background:var(--bg-input);color:var(--text-primary);padding:8px 10px;font-size:13px;outline:2px solid var(--accent);box-shadow:0 0 8px rgba(var(--accent-rgb),0.3);position:absolute;inset:0;z-index:5}
.td-editable.editing .cell-input{display:block}
.td-readonly .cell-view{cursor:default;color:var(--text-secondary)}

/* ── Cell Saved: Green border flash ── */
@keyframes cellSavedPulse {
  0%   { box-shadow: inset 0 0 0 2px #22c55e, 0 0 0 3px rgba(34,197,94,0.0); background: rgba(34,197,94,0.0); }
  15%  { box-shadow: inset 0 0 0 2px #22c55e, 0 0 10px rgba(34,197,94,0.45); background: rgba(34,197,94,0.07); }
  60%  { box-shadow: inset 0 0 0 2px #22c55e, 0 0 6px rgba(34,197,94,0.25); background: rgba(34,197,94,0.04); }
  100% { box-shadow: inset 0 0 0 0px transparent, 0 0 0px transparent;      background: transparent; }
}
.td-cell-saved {
  animation: cellSavedPulse 1.4s cubic-bezier(0.22,1,0.36,1) forwards;
  border-radius: 4px;
  position: relative;
  z-index: 1;
}

/* Sheet Tabs */
.sheet-tabs-bar-wrapper{display:flex;align-items:stretch;background:var(--bg-header);border-top:1px solid var(--border);}
.sheet-tabs-bar{display:flex;padding:4px 0 0;gap:4px;overflow-x:auto;flex:1;scrollbar-width:none;}
.sheet-tabs-bar::-webkit-scrollbar{display:none;}
.sheet-tab{padding:8px 16px;background:var(--bg-input);border:1px solid var(--border);border-bottom:none;border-radius:6px 6px 0 0;font-size:12px;font-weight:600;color:var(--text-muted);cursor:pointer;transition:var(--transition);display:flex;align-items:center;gap:6px;white-space:nowrap;flex-shrink:0;}
.sheet-tab:hover{background:var(--bg-card);color:var(--text-primary)}
.sheet-tab.active{background:var(--green-bg, rgba(34,197,94,0.12))!important;color:var(--green)!important;border:1px solid var(--green)!important;border-top:3px solid var(--green)!important;border-bottom:1px solid var(--bg-card)!important;margin-bottom:-1px;z-index:2;font-weight:700;box-shadow:0 -2px 10px rgba(34,197,94,0.25)!important;}
.sheet-tab.pinned{color:var(--purple);border-color:rgba(168,85,247,0.4);background:rgba(168,85,247,0.06);}
.sheet-tab.pinned.active{color:var(--green)!important;border-color:var(--green)!important;border-top:3px solid var(--green)!important;background:var(--green-bg, rgba(34,197,94,0.12))!important;box-shadow:0 -2px 10px rgba(34,197,94,0.25)!important;}
.add-sheet-btn{background:transparent;border:none;color:var(--text-muted);font-size:16px;cursor:pointer;padding:0 8px;font-weight:700;flex-shrink:0;}
.add-sheet-btn:hover{color:var(--text-primary)}
.sheet-nav-btn{background:var(--bg-input);border:none;border-top:1px solid var(--border);color:var(--text-secondary);font-size:20px;font-weight:700;cursor:pointer;padding:0 10px;line-height:1;transition:var(--transition);flex-shrink:0;}
.sheet-nav-btn:hover{background:var(--bg-card);color:var(--accent);}
#sheet-nav-left{border-right:1px solid var(--border);}
#sheet-nav-right{border-left:1px solid var(--border);}

/* AMC Styles */
.amc-col-header {
  transition: all 0.2s ease;
}
/* Sale Date column — fixed 160px, never bleeds into AMC */
.td-saledate {
  vertical-align: middle !important;
  min-width: 160px !important;
  width: 160px !important;
  max-width: 160px !important;
  overflow: hidden !important;
  white-space: nowrap;
}
.td-amc {
  vertical-align: middle !important;
  min-width: 200px !important;
  width: 200px !important;
  max-width: 200px !important;
  overflow: hidden !important;
}

.amc-badge {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.3;
  width: 100%;
  box-sizing: border-box;
}
.amc-badge.active {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green);
}
.amc-badge.expired {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}
.amc-badge-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.amc-sep {
  opacity: 0.4;
  margin: 0 2px;
}
.amc-set-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
}
.amc-set-btn:hover {
  background: var(--bg-card);
  border-color: var(--purple);
  color: var(--purple);
}
.amc-modal-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}
.amc-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.amc-expire-preview {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

/* Sale By Styles */
.saleby-col-header {
  transition: all 0.2s ease;
}
.td-saleby {
  vertical-align: middle !important;
  min-width: 180px !important;
  width: 180px !important;
  max-width: 180px !important;
  overflow: hidden !important;
}
.saleby-badge {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.3;
  width: 100%;
  box-sizing: border-box;
}
.saleby-badge.active {
  background: rgba(168, 85, 247, 0.08); /* Purple tint for sales */
  border: 1px solid rgba(168, 85, 247, 0.25);
  color: var(--purple);
}
.saleby-badge-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.saleby-set-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
}
.saleby-set-btn:hover {
  background: var(--bg-card);
  border-color: var(--yellow);
  color: var(--yellow);
}


/* Goal Progress Bar */
.goal-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:20px}
.goal-header{display:flex;justify-content:space-between;margin-bottom:12px;align-items:flex-end}
.goal-title{font-size:14px;font-weight:600}
.goal-amounts{text-align:right}
.goal-achieved{font-size:20px;font-weight:800;color:var(--accent)}
.goal-target{font-size:12px;color:var(--text-muted)}
.goal-bar-bg{height:12px;background:var(--bg-input);border-radius:10px;overflow:hidden;position:relative}
.goal-bar-fill{height:100%;background:linear-gradient(90deg,var(--accent),var(--purple));border-radius:10px;transition:width 1s cubic-bezier(0.4,0,0.2,1)}

/* Spreadsheet scroll container — max-height enables sticky thead */
.spreadsheet-scroll {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
}

/* Custom Spreadsheet Scrollbar (Slider) styling */
.spreadsheet-scroll::-webkit-scrollbar,
.top-scroll-container::-webkit-scrollbar {
  height: 12px !important;
}
.spreadsheet-scroll::-webkit-scrollbar-thumb,
.top-scroll-container::-webkit-scrollbar-thumb {
  background: var(--accent) !important;
  border-radius: 6px !important;
  border: 2px solid var(--bg-card) !important;
}
.spreadsheet-scroll::-webkit-scrollbar-thumb:hover,
.top-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-light) !important;
}
.spreadsheet-scroll::-webkit-scrollbar-track,
.top-scroll-container::-webkit-scrollbar-track {
  background: var(--bg-input) !important;
}
.spreadsheet-scroll::-webkit-scrollbar {
  width: 8px;
}

/* Long-text editor popup overlay */
.cell-text-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.cell-text-popup {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 24px;
  width: min(560px, 94vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.18s ease;
}
.cell-text-popup-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cell-text-popup textarea {
  width: 100%;
  min-height: 140px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.cell-text-popup textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.15);
}
.cell-text-popup-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
