﻿/* â”€â”€ Base resets + supplemental rules â”€â”€ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --high: #16a34a;
  --medium: #d97706;
  --low: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Inline icon helper */
.ic { display: inline-flex; align-items: center; vertical-align: -0.125em; }
.ic svg { display: block; }
body {
  font-family: 'DM Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border .2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; border: none; transition: all .2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; }
#dashPage { display: none; }
#loginPage { display: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }
.card {
  background: var(--card); border-radius: 14px; padding: 28px; margin-bottom: 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07); border: 1px solid var(--border);
}
.card-title {
  font-size: 16px; font-weight: 700; margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: #f8fafc;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: #eff6ff; }
.upload-zone .icon { font-size: 40px; margin-bottom: 10px; }
.upload-zone p { color: var(--muted); font-size: 14px; }
.upload-zone strong { color: var(--primary); }
#fileInput { display: none; }
.upload-controls { display: flex; gap: 14px; margin-top: 18px; align-items: flex-end; flex-wrap: wrap; }
.upload-controls .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
.progress-bar-wrap {
  background: #e2e8f0; border-radius: 10px; height: 8px; margin: 14px 0;
  overflow: hidden; display: none;
}
.progress-bar {
  height: 100%; background: var(--primary); border-radius: 10px; width: 0%;
  transition: width .3s; animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }
.status-text { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: none; }
#resultSection { display: none; }
.result-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 700;
}
.status-AUTO_APPROVE { background: #dcfce7; color: var(--success); }
.status-NEEDS_REVIEW { background: #fef9c3; color: var(--warning); }
.status-REJECT { background: #fee2e2; color: var(--danger); }
.status-draft { background: #ede9fe; color: #7c3aed; }
.status-pending_review { background: #e0f2fe; color: #0284c7; }
.status-approved { background: #dcfce7; color: var(--success); }
.status-pushed_to_odoo { background: #dbeafe; color: #2563eb; }
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.info-item { background: #f8fafc; border-radius: 10px; padding: 14px; border: 1px solid var(--border); }
.info-item .label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.info-item .value { font-size: 15px; font-weight: 700; color: var(--text); word-break: break-all; }
.info-item .value-ar { font-size: 13px; color: var(--muted); direction: rtl; text-align: right; }
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: #f1f5f9; }
th { padding: 11px 14px; text-align: left; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
.conf-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.conf-HIGH { background: #dcfce7; color: var(--high); }
.conf-MEDIUM { background: #fef9c3; color: var(--medium); }
.conf-LOW { background: #fee2e2; color: var(--low); }
.math-error { background: #fff1f2; }
.math-error td { color: var(--danger); }
.validation-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.val-item {
  background: #f8fafc; border-radius: 8px; padding: 10px 16px;
  font-size: 13px; border: 1px solid var(--border); display: flex; gap: 6px; align-items: center;
}
.val-item .num { font-weight: 700; font-size: 16px; }
.val-item.err .num { color: var(--danger); }
.val-item.ok .num { color: var(--success); }
.val-item.warn .num { color: var(--warning); }
.flag-list { list-style: none; margin-top: 10px; }
.flag-list li {
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px;
  padding: 8px 14px; margin-bottom: 7px; font-size: 13px; color: #92400e;
  display: flex; align-items: center; gap: 8px;
}
.totals-box {
  background: #f8fafc; border-radius: 10px; padding: 18px;
  border: 1px solid var(--border); max-width: 320px; margin-left: auto;
}
.totals-box .row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--border);
}
.totals-box .row:last-child { border-bottom: none; font-weight: 700; font-size: 16px; }
.action-bar {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end;
  margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border);
}
.history-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap;
}
.history-row:last-child { border-bottom: none; }
.history-row .fname { font-weight: 600; flex: 1; min-width: 140px; }
.history-row .meta { color: var(--muted); font-size: 12px; }
.history-row .odoo-link { color: var(--primary); text-decoration: none; font-size: 12px; }
/* â”€â”€ Glassmorphism Toast System â”€â”€ */
#toastContainer {
  position: fixed; top: 24px; right: 24px; z-index: 10000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none; max-width: 380px; width: 100%;
}
.glass-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 18px; border-radius: 14px;
  font-size: 13px; line-height: 1.45; color: #fff;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateX(120%); opacity: 0;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
  cursor: pointer; position: relative; overflow: hidden;
}
.glass-toast.show { transform: translateX(0); opacity: 1; }
.glass-toast.removing { transform: translateX(120%); opacity: 0; transition: transform .25s ease-in, opacity .2s ease-in; }
.glass-toast .gt-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.glass-toast .gt-body { flex: 1; min-width: 0; }
.glass-toast .gt-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.glass-toast .gt-msg { opacity: 0.88; font-size: 12.5px; word-break: break-word; }
.glass-toast .gt-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 15px; cursor: pointer; padding: 0; line-height: 1;
}
.glass-toast .gt-close:hover { color: #fff; }
.glass-toast .gt-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  border-radius: 0 0 14px 14px;
  background: rgba(255,255,255,0.25);
  transition: width linear;
}
/* Toast type accents */
.glass-toast.toast-success { border-left: 3px solid #22c55e; }
.glass-toast.toast-success .gt-progress { background: rgba(34,197,94,0.5); }
.glass-toast.toast-error { border-left: 3px solid #ef4444; }
.glass-toast.toast-error .gt-progress { background: rgba(239,68,68,0.5); }
.glass-toast.toast-warning { border-left: 3px solid #f59e0b; }
.glass-toast.toast-warning .gt-progress { background: rgba(245,158,11,0.5); }
.glass-toast.toast-info { border-left: 3px solid #3b82f6; }
.glass-toast.toast-info .gt-progress { background: rgba(59,130,246,0.5); }
/* Light mode */
.theme-light .glass-toast {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.08);
  color: #1e293b;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.5);
}
.theme-light .glass-toast .gt-close { color: rgba(0,0,0,0.35); }
.theme-light .glass-toast .gt-close:hover { color: #1e293b; }
.theme-light .glass-toast .gt-progress { background: rgba(0,0,0,0.12); }
.theme-light .glass-toast.toast-success .gt-progress { background: rgba(34,197,94,0.4); }
.theme-light .glass-toast.toast-error .gt-progress { background: rgba(239,68,68,0.4); }
.theme-light .glass-toast.toast-warning .gt-progress { background: rgba(245,158,11,0.4); }
.theme-light .glass-toast.toast-info .gt-progress { background: rgba(59,130,246,0.4); }

/* â”€â”€ Notification Panel â”€â”€ */
#notifPanel {
  position: fixed; top: 60px; right: 24px; z-index: 9999;
  width: 360px; max-height: 480px; border-radius: 16px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  display: none; flex-direction: column; overflow: hidden;
}
#notifPanel.open { display: flex; }
#notifPanel .np-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
#notifPanel .np-header h4 { font-size: 14px; font-weight: 700; color: #fff; margin: 0; }
#notifPanel .np-clear { background: none; border: none; color: rgba(255,255,255,0.5); font-size: 12px; cursor: pointer; }
#notifPanel .np-clear:hover { color: #fff; }
#notifPanel .np-list { overflow-y: auto; flex: 1; padding: 8px 0; }
#notifPanel .np-empty { text-align: center; padding: 32px 16px; color: rgba(255,255,255,0.4); font-size: 13px; }
.np-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 18px; cursor: pointer;
  transition: background .15s;
}
.np-item:hover { background: rgba(255,255,255,0.05); }
.np-item.unread { background: rgba(59,130,246,0.08); }
.np-item .np-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.np-item .np-content { flex: 1; min-width: 0; }
.np-item .np-text { font-size: 12.5px; color: rgba(255,255,255,0.85); line-height: 1.4; }
.np-item.unread .np-text { font-weight: 600; }
.np-item .np-time { font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 2px; }
.np-item .np-dot { width: 7px; height: 7px; border-radius: 50%; background: #3b82f6; flex-shrink: 0; margin-top: 6px; }
.np-item:not(.unread) .np-dot { opacity: 0; }
/* Light mode */
.theme-light #notifPanel {
  background: rgba(255,255,255,0.72);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 12px 48px rgba(0,0,0,0.12);
}
.theme-light #notifPanel .np-header { border-bottom-color: rgba(0,0,0,0.06); }
.theme-light #notifPanel .np-header h4 { color: #1e293b; }
.theme-light #notifPanel .np-clear { color: rgba(0,0,0,0.4); }
.theme-light #notifPanel .np-clear:hover { color: #1e293b; }
.theme-light #notifPanel .np-empty { color: rgba(0,0,0,0.35); }
.theme-light .np-item:hover { background: rgba(0,0,0,0.03); }
.theme-light .np-item.unread { background: rgba(59,130,246,0.06); }
.theme-light .np-item .np-text { color: #334155; }
.theme-light .np-item .np-time { color: rgba(0,0,0,0.35); }

/* â”€â”€ Glassmorphism Modal (confirm/alert) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#gmodalRoot {
  position: fixed; inset: 0; z-index: 100000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.22s ease;
  padding: 20px;
}
#gmodalRoot.open { display: flex; opacity: 1; }
.gmodal {
  background: rgba(20,22,28,0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
  width: 100%; max-width: 420px;
  padding: 24px 24px 20px 24px;
  color: #f1f5f9;
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.22s ease;
  position: relative; overflow: hidden;
}
#gmodalRoot.open .gmodal { transform: scale(1) translateY(0); opacity: 1; }
.gmodal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  pointer-events: none;
}
.gmodal .gm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.gmodal .gm-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: rgba(99,102,241,0.18); color: #a5b4fc;
}
.gmodal.is-warning .gm-icon { background: rgba(245,158,11,0.18); color: #fbbf24; }
.gmodal.is-danger .gm-icon { background: rgba(239,68,68,0.18); color: #fca5a5; }
.gmodal.is-success .gm-icon { background: rgba(34,197,94,0.18); color: #86efac; }
.gmodal .gm-title { font-size: 16px; font-weight: 700; color: #f8fafc; line-height: 1.3; }
.gmodal .gm-msg {
  font-size: 14px; line-height: 1.55; color: rgba(241,245,249,0.8);
  margin: 4px 0 22px 0; white-space: pre-wrap; word-wrap: break-word;
}
.gmodal .gm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.gmodal .gm-btn {
  padding: 9px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
  min-width: 88px;
}
.gmodal .gm-btn:active { transform: scale(0.96); }
.gmodal .gm-btn-cancel {
  background: rgba(255,255,255,0.06); color: #cbd5e1;
  border-color: rgba(255,255,255,0.12);
}
.gmodal .gm-btn-cancel:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }
.gmodal .gm-btn-ok {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white; box-shadow: 0 4px 14px rgba(99,102,241,0.4);
}
.gmodal .gm-btn-ok:hover { box-shadow: 0 6px 20px rgba(99,102,241,0.55); filter: brightness(1.08); }
.gmodal.is-warning .gm-btn-ok { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); box-shadow: 0 4px 14px rgba(239,68,68,0.4); }
.gmodal.is-danger .gm-btn-ok { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); box-shadow: 0 4px 14px rgba(239,68,68,0.45); }
.gmodal.is-success .gm-btn-ok { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); box-shadow: 0 4px 14px rgba(34,197,94,0.4); }
/* Light theme */
.theme-light #gmodalRoot { background: rgba(15,23,42,0.35); }
.theme-light .gmodal {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.06);
  color: #1e293b;
  box-shadow: 0 24px 64px rgba(15,23,42,0.18), 0 0 0 1px rgba(255,255,255,0.6) inset;
}
.theme-light .gmodal::before { background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08), transparent); }
.theme-light .gmodal .gm-title { color: #0f172a; }
.theme-light .gmodal .gm-msg { color: rgba(30,41,59,0.78); }
.theme-light .gmodal .gm-btn-cancel { background: rgba(0,0,0,0.04); color: #475569; border-color: rgba(0,0,0,0.08); }
.theme-light .gmodal .gm-btn-cancel:hover { background: rgba(0,0,0,0.08); }

/* Price-change popup â€” appears top-right for 5s when extraction includes
   a price-deviation flag or memory_note. Dismissable by click. */
#pricePopup {
  position: fixed; top: 24px; right: 24px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: white; padding: 16px 20px; border-radius: 12px;
  font-size: 14px; box-shadow: 0 10px 30px rgba(239,68,68,.35);
  z-index: 9998; max-width: 380px; min-width: 280px;
  transform: translateX(420px); opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
  cursor: pointer;
}
#pricePopup.show { transform: translateX(0); opacity: 1; }
#pricePopup .pp-title {
  font-weight: 700; font-size: 15px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
#pricePopup .pp-list {
  margin: 6px 0 4px 0; padding-left: 0; list-style: none;
  font-size: 13px; line-height: 1.5;
}
#pricePopup .pp-list li { margin-bottom: 3px; }
#pricePopup .pp-hint {
  font-size: 11px; opacity: .9; margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.25); padding-top: 6px;
}
.spinner {
  width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: white; border-radius: 50%;
  animation: spin .7s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dup-warning {
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #92400e; display: none;
}
td.editable { padding: 0 !important; }
td.editable input {
  width: 100%; padding: 10px 14px; border: none; outline: none;
  font-size: 13px; background: #fffbeb; border-bottom: 2px solid var(--warning);
}
td.editable input:focus { background: #fefce8; }
.edit-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.row-corrected td { background: #fefce8 !important; }
.info-edit-btn {
  margin-left: 6px; padding: 1px 7px; font-size: 11px; border-radius: 5px;
  border: 1px solid var(--border); background: white; cursor: pointer;
  color: var(--primary); vertical-align: middle;
}
.info-edit-btn:hover { background: var(--primary); color: white; }
.vendor-name-edit-wrap input {
  border: 1px solid var(--primary); border-radius: 6px;
  padding: 4px 8px; font-size: 13px; width: 180px; outline: none;
}
.vendor-name-edit-wrap button {
  margin-left: 4px; padding: 3px 10px; border-radius: 5px; font-size: 12px;
  border: none; cursor: pointer;
}
.vendor-name-save { background: var(--success); color: white; }
.vendor-name-cancel { background: var(--border); color: var(--text); }
#invoiceImagePanel { margin-bottom: 16px; }
#invoiceImagePanel .img-toggle-btn {
  font-size: 13px; padding: 5px 14px; border-radius: 7px;
  border: 1px solid var(--border); background: white; cursor: pointer;
  color: var(--text); display: inline-flex; align-items: center; gap: 6px;
}
#invoiceImageBox {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: #f8fafc; display: none;
  max-height: 600px; text-align: center; position: relative;
}
#invoiceImageBox img { max-width: 100%; max-height: 590px; object-fit: contain; display: block; margin: auto; }
#invoiceImageBox iframe { width: 100%; height: 590px; border: none; }
.bulk-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 8px; margin-bottom: 6px; border: 1px solid var(--border);
  background: white; font-size: 13px; flex-wrap: wrap;
}
.bulk-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.bulk-row .fname { flex: 1; min-width: 120px; font-weight: 600; }
.bulk-row.auto { border-left: 3px solid var(--success); }
.bulk-row.needs { border-left: 3px solid var(--warning); }
.bulk-row.reject { border-left: 3px solid var(--danger); }
.bulk-actions { display: flex; gap: 10px; padding: 14px 0; flex-wrap: wrap; align-items: center; }
.bulk-count { font-size: 13px; color: var(--muted); margin-left: auto; }
.alert-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: white; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: 6px;
}
.alert-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 8px; margin-bottom: 8px; background: #fff7ed;
  border: 1px solid #fed7aa; font-size: 13px;
}
.alert-item .ai { flex: 1; }
.alert-item .ai strong { display: block; }
.alert-item .deviation { font-weight: 700; color: var(--danger); font-size: 15px; }
.stages-panel { display: none; margin-bottom: 20px; }
.stages-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 700px) { .stages-grid { grid-template-columns: repeat(2, 1fr); } }
.stage-card {
  background: #f8fafc; border-radius: 10px; padding: 12px 14px;
  border: 1px solid var(--border); text-align: center;
}
.stage-card .stage-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 6px;
}
.stage-card .stage-status {
  font-size: 13px; font-weight: 700; padding: 3px 10px;
  border-radius: 12px; display: inline-block;
}
.stage-pass .stage-status { background: #dcfce7; color: var(--success); }
.stage-fail .stage-status { background: #fee2e2; color: var(--danger); }
.stage-skip .stage-status { background: #f1f5f9; color: var(--muted); }
.entry-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 20px; margin-bottom: 20px;
  background: linear-gradient(135deg, #f0f9ff 0%, #fff 100%);
  border: 1px solid #bae6fd; border-radius: 14px;
}
.entry-card .entry-text h3 { font-size: 15px; margin-bottom: 6px; }
.entry-card .entry-text p { font-size: 13px; color: var(--muted); max-width: 520px; }
.price-change-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 8px; margin-bottom: 8px;
  background: white; border: 1px solid var(--border); font-size: 13px;
}
.price-change-item .pc-info { flex: 1; min-width: 200px; }
.price-change-item .pc-info strong { display: block; margin-bottom: 2px; }
.price-change-item .pc-prices { display: flex; gap: 16px; align-items: center; }
.price-change-item .pc-old { color: var(--muted); text-decoration: line-through; }
.price-change-item .pc-new { color: var(--danger); font-weight: 700; font-size: 15px; }
.price-change-item .pc-arrow { color: var(--muted); font-size: 18px; }
.price-change-item .pc-actions { display: flex; gap: 6px; }
.pc-status-pending { border-left: 3px solid var(--warning); }
.proc-time {
  font-size: 11px; color: var(--muted); background: #f1f5f9;
  padding: 3px 10px; border-radius: 12px; display: inline-flex; align-items: center; gap: 4px;
}
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
@media (max-width: 640px) {
  .container { padding: 16px 12px; }
  .upload-controls { flex-direction: column; }
  .action-bar { justify-content: stretch; }
  .action-bar .btn { flex: 1; }
}
@media (max-width: 960px) {
  .merged-wrap { grid-template-columns: 1fr !important; }
}

/* Permission editor */
.perm-filter-btn.active { background:var(--primary)!important;color:#fff!important;border-color:var(--primary)!important }
.perm-chip { transition:all .15s;position:relative }
.perm-chip:hover { transform:scale(1.05);box-shadow:0 2px 8px rgba(0,0,0,.12) }
.perm-chip[draggable="true"] { cursor:grab }
.perm-chip[draggable="true"]:active { cursor:grabbing }
.perm-row { transition:background .15s }
.perm-row:hover { background:var(--card)!important }

/* Analytics sub-tabs */
.an-sub-tab { padding:6px 16px!important;font-size:12px!important;border-radius:8px!important;border:none!important;background:transparent!important;color:var(--muted)!important;font-weight:600!important;cursor:pointer!important }
.an-sub-tab.active { background:var(--primary)!important;color:#fff!important }
.an-sub-tab:hover:not(.active) { background:var(--card)!important;color:var(--text)!important }
.an-abc-filter.active { background:var(--primary)!important;color:#fff!important;border-color:var(--primary)!important }
.an-vendor-row { background:var(--bg);border-radius:10px;padding:14px 16px;cursor:pointer;transition:background .15s }
.an-vendor-row:hover { background:var(--card) }
.an-vendor-products { max-height:0;overflow:hidden;transition:max-height .3s ease }
.an-vendor-products.open { max-height:2000px }
