/* =========================================================
   Akra Inventory – Global Styles
   ========================================================= */

:root {
  --bg-base:       #0b0d14;
  --bg-surface:    #13161f;
  --bg-elevated:   #1a1d2b;
  --bg-hover:      #21253a;
  --border:        #252a3d;
  --border-light:  #2e3450;

  --accent:        #6c63ff;
  --accent-glow:   rgba(108,99,255,0.25);
  --accent-hover:  #7b73ff;

  --teal:          #00c9a7;
  --teal-glow:     rgba(0,201,167,0.2);
  --warn:          #f7a84a;
  --danger:        #ff5e6c;
  --success:       #40d9a4;

  --text-primary:  #e8ecf4;
  --text-secondary:#8a94b0;
  --text-muted:    #525878;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  --sidebar-w:     220px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:          'JetBrains Mono', monospace;
  --shadow:        0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.5);
}

/* ===================== LIGHT THEME ===================== */
[data-theme="light"] {
  --bg-base:       #f0f2f7;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f5f7fc;
  --bg-hover:      #e8ecf7;
  --border:        #dde1f0;
  --border-light:  #ccd2e8;

  --accent:        #5b52e8;
  --accent-glow:   rgba(91,82,232,0.18);
  --accent-hover:  #6b63f0;

  --teal:          #00897b;
  --teal-glow:     rgba(0,137,123,0.15);
  --warn:          #e07b00;
  --danger:        #e53935;
  --success:       #00897b;

  --text-primary:  #1a1d2e;
  --text-secondary:#4a5075;
  --text-muted:    #8a94b0;

  --shadow:        0 4px 24px rgba(0,0,0,0.10);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.16);
}

[data-theme="light"] .modal-overlay { background: rgba(30,30,60,0.45); }
[data-theme="light"] .nav-btn.active { background: linear-gradient(135deg, rgba(91,82,232,0.14), rgba(91,82,232,0.08)); border-color: rgba(91,82,232,0.3); }
[data-theme="light"] .badge-pending { background: rgba(224,123,0,0.1); border-color: rgba(224,123,0,0.3); }
[data-theme="light"] .badge-paid    { background: rgba(0,137,123,0.1); border-color: rgba(0,137,123,0.3); }
[data-theme="light"] .badge-quote   { background: rgba(91,82,232,0.1); border-color: rgba(91,82,232,0.3); }
[data-theme="light"] .badge-retail  { background: rgba(0,137,123,0.1); border-color: rgba(0,137,123,0.3); }
[data-theme="light"] .badge-wholesale { background: rgba(224,123,0,0.08); border-color: rgba(224,123,0,0.25); }
[data-theme="light"] .action-bar { background: linear-gradient(135deg, rgba(91,82,232,0.08), rgba(91,82,232,0.04)); border-color: rgba(91,82,232,0.25); }
[data-theme="light"] .alert-info { background: rgba(91,82,232,0.07); border-color: rgba(91,82,232,0.2); color: #5b52e8; }
[data-theme="light"] .input-prefix span { background: var(--bg-elevated); }
[data-theme="light"] input[readonly] { background: #eef0f8; }
[data-theme="light"] select option { background: #ffffff; color: #1a1d2e; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

/* ===================== LAYOUT ===================== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: visible;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}

.logo-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--accent-glow), rgba(108,99,255,0.12));
  color: #a5a0ff;
  border: 1px solid rgba(108,99,255,0.25);
}

.nav-icon { font-size: 15px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sidebar-footer-text {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.sidebar-footer-version {
  font-size: 10px;
  color: var(--text-muted);
}

/* ===================== THEME TOGGLE ===================== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  cursor: pointer;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.theme-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 24px 28px;
  flex-direction: column;
  gap: 20px;
}

.tab-panel.active {
  display: flex;
}

/* ===================== PAGE HEADER ===================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.page-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-accent {
  background: linear-gradient(135deg, #00c9a7, #0097a7);
  color: #fff;
}
.btn-accent:hover { transform: translateY(-1px); }

.btn-warn {
  background: linear-gradient(135deg, var(--warn), #e58e0c);
  color: #fff;
}
.btn-warn:hover { transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c0392b);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-icon { padding: 6px; font-size: 14px; min-width: 30px; justify-content: center; }

/* ===================== TABLES ===================== */
.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: auto;
  flex-shrink: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table td.mono {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--teal);
}

.data-table tbody tr.selected-row {
  background: rgba(108,99,255,0.08);
  border-left: 2px solid var(--accent);
}

/* Column filters */
.th-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.col-filter {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 10px;
  padding: 3px 6px;
  width: 100%;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.col-filter:focus { border-color: var(--accent); }
.col-filter::placeholder { color: var(--text-muted); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.badge-pending { background: rgba(247,168,74,0.15); color: var(--warn); border: 1px solid rgba(247,168,74,0.3); }
.badge-paid    { background: rgba(64,217,164,0.15); color: var(--success); border: 1px solid rgba(64,217,164,0.3); }
.badge-quote   { background: rgba(108,99,255,0.15); color: #a5a0ff; border: 1px solid rgba(108,99,255,0.3); }
.badge-retail  { background: rgba(0,201,167,0.15); color: var(--teal); border: 1px solid rgba(0,201,167,0.3); }
.badge-wholesale { background: rgba(247,168,74,0.1); color: var(--warn); border: 1px solid rgba(247,168,74,0.25); }

/* ===================== SUMMARY CARDS ===================== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  flex-shrink: 0;
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s;
}
.summary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.summary-card.cost::before { background: linear-gradient(90deg, var(--accent), #8b5cf6); }
.summary-card.retail::before { background: linear-gradient(90deg, var(--teal), #00a085); }
.summary-card.wholesale::before { background: linear-gradient(90deg, var(--warn), #e58e0c); }
.summary-card.consignment::before { background: linear-gradient(90deg, #ec4899, #8b5cf6); }

.summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.summary-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--mono);
  letter-spacing: -0.5px;
}

.summary-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===================== ACTION BAR ===================== */
.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(108,99,255,0.12), rgba(139,92,246,0.08));
  border: 1px solid rgba(108,99,255,0.3);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  animation: slideUp 0.2s ease;
}

/* Inventory selection bar — floats at the bottom of the viewport */
#inventory-action-bar,
#cons-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  border-radius: 50px;
  padding: 10px 22px;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(108,99,255,0.4);
  background: linear-gradient(135deg, rgba(20,18,40,0.96), rgba(30,27,60,0.96));
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.action-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: auto;
}

/* ===================== WAREHOUSE CARDS ===================== */
.warehouse-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.warehouse-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all 0.18s;
}
.warehouse-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.wh-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.wh-actions { display: flex; gap: 6px; }

.wh-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.wh-emails {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.email-chip {
  display: inline-block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 2px 2px 0 0;
}

/* ===================== CONSIGNMENT TAB ===================== */
.wh-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wh-tab-btn {
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.wh-tab-btn:hover, .wh-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-glow), rgba(108,99,255,0.1));
  border-color: rgba(108,99,255,0.4);
  color: #a5a0ff;
}

/* ===================== MODALS ===================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.open { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 580px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease;
}

.modal-sm { width: 420px; }
.modal-xl { width: 1200px; max-width: 96vw; }
.modal-fullscreen { width: 98vw; max-width: 98vw; height: 96vh; max-height: 96vh; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===================== FORMS ===================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[readonly] {
  background: var(--bg-base);
  color: var(--teal);
  font-family: var(--mono);
  cursor: default;
}

select option { background: var(--bg-elevated); }

textarea { resize: vertical; min-height: 60px; }

.input-prefix {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-prefix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-prefix.readonly:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}
.input-prefix span {
  padding: 8px 8px 8px 10px;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg-base);
  border-right: 1px solid var(--border);
}
.input-prefix input {
  border: none;
  background: transparent;
  box-shadow: none;
}
.input-prefix input:focus { box-shadow: none; }

.hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===================== INVOICE FORM ===================== */
.invoice-form { display: flex; flex-direction: column; gap: 20px; }

.invoice-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.customer-toggle {
  display: flex;
  gap: 0;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
  width: fit-content;
}

.toggle-btn {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.invoice-items-table { margin-top: 0; }

.invoice-totals {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.totals-row {
  display: flex;
  gap: 40px;
  font-size: 12px;
  color: var(--text-secondary);
}

.totals-row span:last-child {
  font-family: var(--mono);
  min-width: 100px;
  text-align: right;
}

.total-row {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

/* ===================== QTY INPUT IN TABLE ===================== */
.qty-input {
  width: 70px;
  text-align: center;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--mono);
  padding: 4px 6px;
}
.qty-input:focus { border-color: var(--accent); outline: none; }

/* ===================== FILTER ROW ===================== */
.filter-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.filter-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 12px;
  outline: none;
}
.filter-input:focus { border-color: var(--accent); }

.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font);
  padding: 8px 12px;
  outline: none;
  min-width: 160px;
}

/* ===================== ALERTS ===================== */
.alert-info {
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #a5a0ff;
  margin-top: 12px;
}

.confirm-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* ===================== TRANSFER SUMMARY ===================== */
.transfer-summary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.transfer-summary strong { color: var(--text-primary); }

/* ===================== EMPTY STATE ===================== */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px;
}

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  transform: translateY(60px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: linear-gradient(135deg, #11998e, #38ef7d); box-shadow: 0 4px 20px rgba(64,217,164,0.4); }
.toast.error   { background: linear-gradient(135deg, var(--danger), #c0392b); box-shadow: 0 4px 20px rgba(255,94,108,0.4); }
.toast.info    { background: linear-gradient(135deg, var(--accent), #8b5cf6); box-shadow: 0 4px 20px var(--accent-glow); }

/* ===================== CHECKBOX ===================== */
.row-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===================== CONSIGNMENT CONTENT ===================== */
.consignment-content {
  margin-top: 16px;
}

/* ===================== INVOICE VIEW ===================== */
.inv-view-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.inv-view-detail {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border);
}

.inv-view-detail h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.inv-view-detail p {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 3px;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================== QTY IN TABLE ===================== */
.qty-positive { color: var(--success); font-family: var(--mono); font-weight: 600; }
.qty-zero     { color: var(--text-muted); font-family: var(--mono); }
.qty-low      { color: var(--warn); font-family: var(--mono); font-weight: 600; }

/* ===================== PENDING MARK ===================== */
.pending-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  background: rgba(247,168,74,0.15);
  color: var(--warn);
  border: 1px solid rgba(247,168,74,0.3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===================== V2 ADDITIONS ===================== */

/* Sidebar nav scrollable for more items */
.sidebar-nav {
  overflow-y: auto;
}

/* modal-lg size */
.modal-lg { width: 680px; max-height: 94vh; }

/* surface-2 for inline date pickers */
:root { --surface-2: var(--bg-elevated); }

/* inv-view-header */
.inv-view-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.inv-view-detail {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.inv-view-detail h4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.inv-view-detail p {
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 3px;
}

/* filter-row date input fix */
input[type="date"].filter-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  padding: 7px 10px;
  font-family: var(--font);
  outline: none;
}

input[type="date"].filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Report budget progress bar container */
.budget-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* qty-input in invoice table */
.qty-input {
  width: 64px;
  padding: 4px 6px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 12px;
}

/* confirm-text in mark-sold modal */
.confirm-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* transfer-summary */
.transfer-summary {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

/* empty-state */
.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
}

/* alert-info */
.alert-info {
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #a5a0ff;
  margin-top: 10px;
}

/* toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s ease;
  pointer-events: none;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

/* Invoice items table */
.invoice-items-table { background: transparent; }

/* Invoice totals */
.invoice-totals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
  max-width: 380px;
  margin-left: auto;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border);
}

.totals-row.total-row {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: none;
  padding-top: 8px;
  border-top: 2px solid var(--teal);
  margin-top: 4px;
}

/* filter-input and filter-select */
.filter-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  padding: 7px 10px;
  font-family: var(--font);
  outline: none;
  min-width: 200px;
  transition: border-color 0.15s;
}
.filter-input:focus { border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-muted); }

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  padding: 7px 10px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--accent); }

.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

/* =========================================================
   SEARCHABLE SELECT COMPONENT
   ========================================================= */
.ss-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}
.ss-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-primary, var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
  transition: border-color 0.15s;
  min-height: 40px;
}
.ss-display:hover { border-color: var(--accent); }
.ss-display.open  { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ss-display .ss-arrow { font-size: 11px; color: var(--text-muted); transition: transform 0.15s; }
.ss-display.open .ss-arrow { transform: rotate(180deg); }
.ss-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-top: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 260px;
  display: none;
  flex-direction: column;
}
.ss-dropdown.open { display: flex; }
.ss-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ss-search input {
  width: 100%;
  background: var(--bg-primary, var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
}
.ss-search input:focus { border-color: var(--accent); }
.ss-options {
  overflow-y: auto;
  flex: 1;
}
.ss-option {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s;
}
.ss-option:hover, .ss-option.highlighted { background: var(--bg-hover); color: var(--text-primary); }
.ss-option.selected { color: var(--accent); font-weight: 600; }
.ss-empty { padding: 12px 14px; font-size: 12px; color: var(--text-muted); font-style: italic; }

/* =========================================================
   CUSTOMER NAME BUTTON & ACTION POPOVER
   ========================================================= */
.customer-name-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  font-family: inherit;
}
.customer-name-btn:hover strong {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cust-pop-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.cust-pop-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.cust-pop-btn.accent { color: var(--accent); }
.cust-pop-btn.accent:hover { background: rgba(var(--accent-rgb,99,102,241),0.12); }

/* ===================== MOVEMENTS TABLE — CONTENT-DRIVEN WIDTHS ===================== */
/* Let every column be exactly as wide as its widest cell; scroll horizontally if needed */
#tab-movements .data-table {
  width: auto;
  min-width: 100%;
  table-layout: auto;
}

#tab-movements .data-table th,
#tab-movements .data-table td {
  white-space: nowrap;
  padding: 8px 10px;
}

/* Description (col 3) and SKU list (col 2) can be a little wider but cap with ellipsis */
#tab-movements .data-table th:nth-child(2),
#tab-movements .data-table td:nth-child(2) {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tab-movements .data-table th:nth-child(3),
#tab-movements .data-table td:nth-child(3) {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================== INVOICE TAB — BUTTONS 10% SMALLER ===================== */
#tab-invoices .btn {
  padding: 7px 14px;
  font-size: 10.8px;
}

#tab-invoices .btn-sm {
  padding: 4px 9px;
  font-size: 10px;
}

/* Icon-only action buttons in the Actions column — fixed square, no wasted space */
#tab-invoices td .btn-sm {
  padding: 4px 7px;
  font-size: 13px;
  min-width: 28px;
  justify-content: center;
}

/* ===================== TOOLTIP SYSTEM ===================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: rgba(15, 13, 30, 0.95);
  color: #e2e0f0;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font, 'Inter', sans-serif);
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(108,99,255,0.3);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 9999;
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(15, 13, 30, 0.95);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9999;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

[data-tooltip]:hover {
  z-index: 200;
}

/* Inside table cells: show tooltip BELOW to avoid the sticky thead clipping it */
td [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 7px);
  transform: translateX(-50%) scale(0.92);
}

td [data-tooltip]::before {
  bottom: auto;
  top: calc(100% + 1px);
  border-top-color: transparent;
  border-bottom-color: rgba(15, 13, 30, 0.95);
}

td [data-tooltip]:hover::after {
  transform: translateX(-50%) scale(1);
}
