/* =====================================================================
   7STAR POS/ERP — Stylesheet
   Powered by Vexora
   ===================================================================== */

/* ---------- Tokens ---------- */
:root{
  --font-ui: 'Cairo', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --primary: #2F6FED;
  --primary-dim: #2557bd;
  --primary-100: #e8f0ff;
  --accent: #17C3B2;
  --accent-100: #e3faf7;
  --warning: #F5A524;
  --warning-100: #fef3e0;
  --danger: #E5484D;
  --danger-100: #fdeaea;
  --success: #12B76A;
  --success-100: #e5f9ef;
  --violet: #7C5CFC;
  --violet-100: #efeaff;

  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --border: #E3E7EF;
  --text: #131A2A;
  --text-dim: #5B6478;
  --text-faint: #8A93A6;

  --shadow-sm: 0 1px 2px rgba(20,25,40,.06);
  --shadow-md: 0 6px 20px rgba(20,25,40,.08);
  --shadow-lg: 0 14px 40px rgba(20,25,40,.14);

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

  --sidebar-w: 264px;
  --topbar-h: 68px;

  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

html[data-theme="dark"]{
  --bg: #0B1220;
  --surface: #131B2C;
  --surface-2: #0F1727;
  --border: #232E45;
  --text: #E7ECF5;
  --text-dim: #9AA6BE;
  --text-faint: #6B7690;
  --primary-100: #16223f;
  --accent-100: #0f2b29;
  --warning-100: #2e2210;
  --danger-100: #301418;
  --success-100: #0f2a1d;
  --violet-100: #211a3d;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.5);
}

*,*::before,*::after{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
button{ font-family: inherit; }
input,select,textarea{ font-family: inherit; }
ul{ list-style:none; margin:0; padding:0; }
a{ color: inherit; }
::selection{ background: var(--primary); color:#fff; }

.mono{ font-family: var(--font-mono); }
.hidden{ display:none !important; }
.link-btn{
  background:none;border:none;color:var(--primary);cursor:pointer;font-weight:600;font-size:13px;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 8px; }

/* ---------- App shell ---------- */
#app{ display:flex; min-height:100vh; }

.sidebar{
  width: var(--sidebar-w);
  flex-shrink:0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display:flex;
  flex-direction:column;
  position: sticky;
  top:0;
  height:100vh;
  z-index: 60;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:20px 18px;
  border-bottom:1px solid var(--border);
}
.brand-mark{
  width:40px;height:40px;border-radius:10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color:#fff; font-weight:800; font-family:var(--font-mono);
  display:flex;align-items:center;justify-content:center;
  font-size:15px;letter-spacing:-.5px;
  flex-shrink:0;
}
.brand-text{ display:flex; flex-direction:column; line-height:1.25; }
.brand-name{ font-weight:800; font-size:17px; }
.brand-sub{ font-size:10.5px; color:var(--text-faint); font-family: var(--font-mono); letter-spacing:.3px; }
.sidebar-close{ display:none; margin-right:auto; background:none;border:none;color:var(--text-dim);font-size:18px;cursor:pointer; }

.nav{ flex:1; overflow-y:auto; padding:14px 12px; display:flex; flex-direction:column; gap:3px; }
.nav-item{
  display:flex; align-items:center; gap:12px;
  background:none; border:none; text-align:right;
  padding:11px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight:600; font-size:13.5px;
  cursor:pointer; transition: background var(--transition), color var(--transition);
  width:100%;
}
.nav-item:hover{ background: var(--surface-2); color: var(--text); }
.nav-item.active{ background: var(--primary-100); color: var(--primary); }
.nav-ic{ width:20px; text-align:center; font-size:15px; opacity:.85; }

/* Sidebar sections (collapsible groups) */
.nav-group{ display:flex; flex-direction:column; }
.nav-group-head{
  display:flex; align-items:center; gap:10px; width:100%;
  background:none; border:none; text-align:right; cursor:pointer;
  padding:9px 10px; border-radius: var(--radius-sm);
  color: var(--text-faint); font-weight:800; font-size:11.5px;
  letter-spacing:.2px; text-transform:uppercase;
  transition: background var(--transition), color var(--transition);
}
.nav-group-head:hover{ background: var(--surface-2); color: var(--text-dim); }
.nav-group.is-active-group > .nav-group-head{ color: var(--primary); }
.nav-group-ic{ font-size:13px; opacity:.9; }
.nav-group-label{ flex:1; }
.nav-group-caret{ font-size:11px; opacity:.6; transition: transform var(--transition); }
.nav-group.is-collapsed .nav-group-caret{ transform: rotate(-90deg); }
.nav-group-body{
  display:flex; flex-direction:column; gap:2px;
  padding:2px 4px 8px 4px;
  overflow:hidden;
}
.nav-group.is-collapsed .nav-group-body{ display:none; }
.nav-group + .nav-group{ margin-top:2px; border-top:1px solid var(--border); padding-top:4px; }

/* Smart duplicate-detection dialogs */
.dup-existing-box{
  margin-top:10px; padding:10px 12px; border-radius: var(--radius-sm);
  background: var(--warn-100, rgba(234,179,8,.12)); border:1px solid var(--warn, #eab308);
  font-size:13px;
}

/* Customer 360° tabs */
.c360-tabs{ display:flex; gap:6px; flex-wrap:wrap; border-bottom:1px solid var(--border); margin-bottom:14px; padding-bottom:8px; }
.c360-tab{
  background:none; border:none; cursor:pointer; padding:7px 12px; border-radius: var(--radius-sm);
  font-size:12.5px; font-weight:700; color:var(--text-dim);
}
.c360-tab:hover{ background: var(--surface-2); color:var(--text); }
.c360-tab.active{ background: var(--primary-100); color: var(--primary); }
.c360-panel.hidden{ display:none; }

/* Customizable dashboard */
.dash-widget-list{ display:flex; flex-direction:column; gap:4px; max-height:360px; overflow-y:auto; }
.dash-widget-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:7px 10px; border-radius: var(--radius-sm); border:1px solid var(--border); background: var(--surface-2); }
.dash-widget-row label{ display:flex; align-items:center; gap:8px; font-size:12.5px; }
.dw-move{ display:flex; gap:4px; }

.sidebar-footer{
  padding:14px 18px; border-top:1px solid var(--border);
  font-size:11px; color:var(--text-faint); font-family: var(--font-mono);
}

.sidebar-overlay{
  display:none;
  position:fixed; inset:0; background:rgba(10,14,24,.5);
  z-index:55;
}

/* ---------- Main / Topbar ---------- */
.main-wrap{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 22px; gap:16px;
  position: sticky; top:0; z-index:40;
}
.topbar-left{ display:flex; align-items:center; gap:14px; min-width:0; }
.menu-toggle{ display:none; }
.screen-title-wrap{ display:flex; flex-direction:column; min-width:0; }
.screen-title-wrap h1{ font-size:17px; font-weight:800; margin:0; }
.screen-date{ font-size:11.5px; color:var(--text-faint); font-family: var(--font-mono); }

.topbar-center{ flex:1; max-width:420px; }
.global-search{
  position:relative; display:flex; align-items:center;
}
.global-search .search-ic{ position:absolute; right:12px; color:var(--text-faint); font-size:14px; }
.global-search input{
  width:100%; padding:9px 36px 9px 12px; border-radius: 8px;
  border:1px solid var(--border); background: var(--surface-2); color:var(--text);
  font-size:13px; outline:none; transition: border var(--transition);
}
.global-search input:focus{ border-color: var(--primary); }

.topbar-right{ display:flex; align-items:center; gap:10px; }
.live-clock{ font-family: var(--font-mono); font-size:12.5px; color:var(--text-dim); white-space:nowrap; }

/* Vexora Pay Bridge — connection status indicator */
.bridge-status{
  display:flex; align-items:center; gap:6px; font-size:11.5px; white-space:nowrap;
  padding:5px 9px; border-radius:20px; background: var(--surface-2); border:1px solid var(--border);
}
.bridge-status-dot{
  width:8px; height:8px; border-radius:50%; background: var(--danger); flex-shrink:0;
  box-shadow: 0 0 0 2px var(--danger-100);
}
.bridge-status--online .bridge-status-dot{ background: var(--success); box-shadow: 0 0 0 2px var(--success-100); }
.bridge-status--online .bridge-status-label b{ color: var(--success); }
.bridge-status--offline .bridge-status-dot{ background: var(--danger); box-shadow: 0 0 0 2px var(--danger-100); }
.bridge-status--offline .bridge-status-label b{ color: var(--danger); }
.bridge-status-label{ color: var(--text-dim); }
.bridge-status-label b{ font-weight:700; }

/* Live Payments (dashboard) */
.live-payments-list{ display:flex; flex-direction:column; gap:8px; }
.live-payment-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px; border-radius:9px; background: var(--surface-2); border:1px solid var(--border);
}
.live-payment-row.is-new{ animation: livePayFlash 1.4s ease; }
@keyframes livePayFlash{ 0%{ background: var(--success-100); } 100%{ background: var(--surface-2); } }
.live-payment-main{ display:flex; flex-direction:column; gap:2px; }
.live-payment-sender{ font-weight:700; font-size:13px; }
.live-payment-meta{ font-size:11.5px; color:var(--text-dim); font-family: var(--font-mono); }
.live-payment-amount{ font-weight:800; font-size:15px; color: var(--success); font-family: var(--font-mono); white-space:nowrap; }
.live-payment-status{ font-size:10.5px; padding:2px 8px; border-radius:20px; background: var(--warning-100); color: var(--warning); font-weight:700; }
.icon-btn{
  position:relative;
  width:36px;height:36px; border-radius:8px; border:1px solid var(--border);
  background: var(--surface-2); cursor:pointer; font-size:15px;
  display:flex; align-items:center; justify-content:center; color:var(--text-dim);
  transition: background var(--transition);
}
.icon-btn:hover{ background: var(--border); }
.badge-dot{
  position:absolute; top:5px; left:5px; width:7px;height:7px;border-radius:50%;
  background: var(--danger); border:1.5px solid var(--surface);
}
.user-chip{ display:flex; align-items:center; gap:9px; padding-right:6px; border-right:1px solid var(--border); }
.avatar{
  width:34px;height:34px;border-radius:50%; background: var(--accent); color:#fff;
  display:flex;align-items:center;justify-content:center; font-weight:700; font-size:12.5px;
}
.user-info{ display:flex; flex-direction:column; line-height:1.2; }
.user-name{ font-size:12.5px; font-weight:700; }
.user-role{ font-size:10.5px; color:var(--text-faint); }

.notif-panel{
  position:absolute; left:22px; top:calc(var(--topbar-h) + 8px); width:320px; max-height:400px;
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); z-index:70; overflow:hidden; display:flex; flex-direction:column;
}
.notif-panel-head{ display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border-bottom:1px solid var(--border); font-weight:700; font-size:13px; }
.notif-list{ overflow-y:auto; }
.notif-item{ padding:11px 14px; border-bottom:1px solid var(--border); font-size:12.5px; display:flex; flex-direction:column; gap:3px; }
.notif-item:last-child{ border-bottom:none; }
.notif-time{ font-size:10.5px; color:var(--text-faint); font-family:var(--font-mono); }
.notif-empty{ padding:26px 14px; text-align:center; color:var(--text-faint); font-size:12.5px; }

.main-content{ flex:1; padding:22px; max-width:1600px; width:100%; margin:0 auto; }

/* ---------- Section headers ---------- */
.section-head{
  display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:18px; flex-wrap:wrap;
}
.section-head h2{ font-size:16px; font-weight:800; margin:0; }
.section-head p{ margin:2px 0 0; font-size:12.5px; color:var(--text-faint); }
.section-actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:7px; justify-content:center;
  padding:9px 16px; border-radius: 8px; border:1px solid transparent;
  font-weight:700; font-size:13px; cursor:pointer; transition: all var(--transition);
  white-space:nowrap;
}
.btn-primary{ background: var(--primary); color:#fff; }
.btn-primary:hover{ background: var(--primary-dim); }
.btn-accent{ background: var(--accent); color:#fff; }
.btn-outline{ background:transparent; border-color: var(--border); color:var(--text); }
.btn-outline:hover{ background: var(--surface-2); }
.btn-danger{ background: var(--danger); color:#fff; }
.btn-ghost{ background:transparent; border-color:transparent; color:var(--text-dim); }
.btn-ghost:hover{ background: var(--surface-2); }
.btn-sm{ padding:6px 11px; font-size:12px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn-block{ width:100%; }
.icon-only{ width:34px; padding:0; }

/* ---------- Cards / KPI ---------- */
.kpi-grid{
  display:grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap:14px; margin-bottom:22px;
}
.kpi-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-md);
  padding:16px; position:relative; overflow:hidden; box-shadow: var(--shadow-sm);
  border-right: 3px solid var(--primary);
}
.kpi-card.c-accent{ border-right-color: var(--accent); }
.kpi-card.c-warning{ border-right-color: var(--warning); }
.kpi-card.c-danger{ border-right-color: var(--danger); }
.kpi-card.c-success{ border-right-color: var(--success); }
.kpi-label{ font-size:12px; color:var(--text-faint); font-weight:600; }
.kpi-value{ font-size:23px; font-weight:800; font-family:var(--font-mono); margin-top:6px; }
.kpi-sub{ font-size:11px; color: var(--text-faint); margin-top:4px; }

.grid-2{ display:grid; grid-template-columns: 1.4fr 1fr; gap:16px; }
.grid-3{ display:grid; grid-template-columns: repeat(3,1fr); gap:16px; }

.panel{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); overflow:hidden;
}
.panel-head{
  padding:14px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between;
}
.panel-head h3{ margin:0; font-size:13.5px; font-weight:800; }
.panel-body{ padding:14px 16px; }

/* Simple bar chart */
.chart-bars{ display:flex; align-items:flex-end; gap:8px; height:160px; padding-top:10px; }
.chart-bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; justify-content:flex-end; }
.chart-bar{ width:100%; border-radius:5px 5px 0 0; background: linear-gradient(180deg, var(--primary), var(--primary-dim)); min-height:3px; transition: height .5s ease; }
.chart-bar-label{ font-size:10px; color:var(--text-faint); font-family:var(--font-mono); }

.mini-list{ display:flex; flex-direction:column; gap:0; }
.mini-list-row{
  display:flex; align-items:center; justify-content:space-between; padding:9px 0; border-bottom:1px solid var(--border);
  font-size:12.5px;
}
.mini-list-row:last-child{ border-bottom:none; }
.mini-list-title{ font-weight:700; }
.mini-list-sub{ color:var(--text-faint); font-size:11px; }
.mini-list-val{ font-family: var(--font-mono); font-weight:700; }

/* ---------- Tables ---------- */
.table-wrap{ overflow-x:auto; border-radius: var(--radius-md); border:1px solid var(--border); background:var(--surface); }
table{ width:100%; border-collapse:collapse; min-width:640px; }
thead th{
  text-align:right; padding:11px 14px; font-size:11.5px; color:var(--text-faint); font-weight:700;
  background: var(--surface-2); border-bottom:1px solid var(--border); white-space:nowrap;
}
tbody td{ padding:11px 14px; border-bottom:1px solid var(--border); font-size:12.5px; vertical-align:middle; white-space:nowrap; }
tbody tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background: var(--surface-2); }
.cell-strong{ font-weight:700; }
.cell-img{ width:38px;height:38px;border-radius:8px; object-fit:cover; background:var(--surface-2); border:1px solid var(--border); }
.table-toolbar{ display:flex; gap:10px; padding:12px 14px; border-bottom:1px solid var(--border); flex-wrap:wrap; align-items:center; }
.table-toolbar input, .table-toolbar select{
  padding:8px 10px; border-radius:7px; border:1px solid var(--border); background:var(--surface-2); color:var(--text); font-size:12.5px; outline:none;
}
.empty-row td{ text-align:center; padding:34px; color:var(--text-faint); }

/* ---------- Badges ---------- */
.badge{ display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:700; }
.badge-success{ background: var(--success-100); color: var(--success); }
.badge-warning{ background: var(--warning-100); color: var(--warning); }
.badge-danger{ background: var(--danger-100); color: var(--danger); }
.badge-primary{ background: var(--primary-100); color: var(--primary); }
.badge-neutral{ background: var(--surface-2); color: var(--text-dim); border:1px solid var(--border); }
.badge-muted{ background: var(--surface-2); color: var(--text-faint); border:1px solid var(--border); }

/* ---------- Forms ---------- */
.form-grid{ display:grid; grid-template-columns: repeat(2,1fr); gap:14px; }
.form-field{ display:flex; flex-direction:column; gap:6px; }
.form-field.full{ grid-column: 1 / -1; }
.form-field label{ font-size:12px; font-weight:700; color: var(--text-dim); }
.form-field input, .form-field select, .form-field textarea{
  padding:10px 12px; border-radius:8px; border:1px solid var(--border); background: var(--surface-2); color:var(--text);
  font-size:13px; outline:none; transition: border var(--transition); width:100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus{ border-color: var(--primary); }
.form-field textarea{ resize:vertical; min-height:70px; }
.form-hint{ font-size:11px; color: var(--text-faint); }
.form-error{ font-size:11px; color: var(--danger); }
.checkbox-row{ display:flex; align-items:center; gap:8px; }
.checkbox-row input{ width:auto; }
.type-toggle{ display:flex; gap:8px; flex-wrap:wrap; }
.type-toggle button{
  padding:8px 14px; border-radius:8px; border:1px solid var(--border); background: var(--surface-2); color:var(--text-dim);
  font-size:12.5px; font-weight:700; cursor:pointer;
}
.type-toggle button.active{ background: var(--primary); color:#fff; border-color: var(--primary); }

/* ---------- Modal ---------- */
.modal-root{ position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(10,14,24,.55); }
.modal-box{
  position:relative; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width:min(620px, 92vw); max-height:88vh; overflow-y:auto; padding:0; animation: modalIn .18s ease;
}
.modal-box.modal-lg{ width:min(920px,94vw); }
.modal-box.modal-sm{ width:min(420px,92vw); }
@keyframes modalIn{ from{ opacity:0; transform: translateY(8px) scale(.98);} to{ opacity:1; transform:translateY(0) scale(1);} }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border); position:sticky; top:0; background:var(--surface); z-index:2; }
.modal-head h3{ margin:0; font-size:15px; font-weight:800; }
.modal-close{ background:none;border:none;font-size:17px;color:var(--text-dim);cursor:pointer; }
.modal-body{ padding:18px 20px; }
.modal-foot{ display:flex; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid var(--border); position:sticky; bottom:0; background:var(--surface); }

/* ---------- Toasts ---------- */
.toast-container{ position:fixed; bottom:20px; left:20px; z-index:300; display:flex; flex-direction:column; gap:10px; }
.toast{
  min-width:260px; max-width:340px; background: var(--surface); border:1px solid var(--border); border-right:3px solid var(--primary);
  border-radius:9px; padding:12px 14px; box-shadow: var(--shadow-lg); font-size:12.5px; font-weight:600;
  display:flex; align-items:center; gap:9px; animation: toastIn .22s ease;
}
.toast.success{ border-right-color: var(--success); }
.toast.error{ border-right-color: var(--danger); }
.toast.warning{ border-right-color: var(--warning); }
@keyframes toastIn{ from{ opacity:0; transform: translateY(10px);} to{ opacity:1; transform:translateY(0);} }
.toast-ic{ font-size:15px; }

/* ---------- POS screen ---------- */
.pos-layout{ display:grid; grid-template-columns: 1fr 380px; gap:16px; align-items:start; }
.pos-left{ display:flex; flex-direction:column; gap:14px; }
.pos-cats{ display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; }
.pos-cats button{
  flex-shrink:0; padding:8px 15px; border-radius:20px; border:1px solid var(--border); background: var(--surface);
  color:var(--text-dim); font-weight:700; font-size:12.5px; cursor:pointer;
}
.pos-cats button.active{ background: var(--primary); border-color: var(--primary); color:#fff; }
.pos-search{ display:flex; gap:10px; }
.pos-search input{
  flex:1; padding:11px 14px; border-radius:9px; border:1px solid var(--border); background: var(--surface); font-size:13px; outline:none;
}
.pos-search input:focus{ border-color: var(--primary); }
.product-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap:12px; }
.product-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-md); padding:10px;
  cursor:pointer; transition: transform var(--transition), box-shadow var(--transition); display:flex; flex-direction:column; gap:7px;
}
.product-card:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.product-card.out-of-stock{ opacity:.5; cursor:not-allowed; }
.product-card.out-of-stock:hover{ transform:none; box-shadow:none; border-color:var(--border); }
.product-thumb{ width:100%; aspect-ratio:1; border-radius:8px; background: var(--surface-2); overflow:hidden; display:flex; align-items:center; justify-content:center; border:1px solid var(--border); }
.product-thumb img{ width:100%; height:100%; object-fit:cover; }
.product-name{ font-size:12.5px; font-weight:700; line-height:1.3; height:32px; overflow:hidden; }
.product-brand{ font-size:10.5px; color:var(--text-faint); }
.product-price{ font-family: var(--font-mono); font-weight:800; color: var(--primary); font-size:13.5px; }
.product-meta-row{ display:flex; justify-content:space-between; align-items:center; }
.product-stock-tag{ font-size:9.5px; font-family: var(--font-mono); }

.pos-cart{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-md); display:flex; flex-direction:column;
  position:sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 28px);
}
.cart-head{ padding:14px 16px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.cart-head h3{ margin:0; font-size:13.5px; font-weight:800; }
.cart-items{ flex:1; overflow-y:auto; padding:8px 12px; min-height:120px; max-height:320px; }
.cart-empty{ text-align:center; padding:30px 10px; color:var(--text-faint); font-size:12.5px; }
.cart-row{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px solid var(--border); }
.cart-row:last-child{ border-bottom:none; }
.cart-row-info{ flex:1; min-width:0; }
.cart-row-name{ font-size:12px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cart-row-price{ font-size:11px; color:var(--text-faint); font-family:var(--font-mono); }
.cart-row-imei{ font-size:9.5px; color:var(--primary); font-family:var(--font-mono); }
.qty-ctl{ display:flex; align-items:center; gap:6px; }
.qty-ctl button{ width:22px;height:22px; border-radius:6px; border:1px solid var(--border); background: var(--surface-2); cursor:pointer; font-size:12px; color:var(--text); }
.qty-ctl span{ font-family: var(--font-mono); font-size:12px; min-width:16px; text-align:center; }
.cart-row-del{ background:none; border:none; color:var(--danger); cursor:pointer; font-size:13px; }
.cart-summary{ padding:14px 16px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:8px; }
.summary-line{ display:flex; justify-content:space-between; font-size:12.5px; color:var(--text-dim); }
.summary-line.total{ font-size:15px; font-weight:800; color:var(--text); padding-top:8px; border-top:1px dashed var(--border); }
.summary-line .val{ font-family: var(--font-mono); }
.discount-tax-row{ display:flex; gap:8px; }
.discount-tax-row .form-field{ flex:1; }
.cart-actions{ padding:0 16px 16px; display:flex; flex-direction:column; gap:8px; }

/* Payment modal */
.pay-methods{ display:grid; grid-template-columns: repeat(3,1fr); gap:8px; margin-bottom:14px; }
.pay-method-btn{
  padding:12px 8px; border-radius:9px; border:1px solid var(--border); background: var(--surface-2);
  cursor:pointer; font-weight:700; font-size:12px; color:var(--text-dim); display:flex; flex-direction:column; align-items:center; gap:5px;
}
.pay-method-btn.active{ border-color: var(--primary); background: var(--primary-100); color: var(--primary); }
.pay-total-box{ background: var(--primary-100); border-radius:10px; padding:14px; text-align:center; margin-bottom:14px; }
.pay-total-box .label{ font-size:11px; color: var(--text-dim); font-weight:700; }
.pay-total-box .amount{ font-size:26px; font-weight:900; color: var(--primary); font-family: var(--font-mono); }
.change-box{ display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border-radius:9px; background: var(--success-100); margin-top:10px; font-weight:700; }
.change-box.insufficient{ background: var(--danger-100); color: var(--danger); }
.change-box .val{ font-family: var(--font-mono); font-size:16px; }

/* Invoice */
.invoice-paper{ background:#fff; color:#111; border-radius:10px; padding:22px; font-size:12.5px; }
.invoice-paper *{ color:#111; }
.invoice-head{ text-align:center; margin-bottom:14px; border-bottom:2px dashed #ccc; padding-bottom:12px; }
.invoice-head .store{ font-size:19px; font-weight:900; }
.invoice-head .powered{ font-size:10px; color:#777; font-family: var(--font-mono); }
.invoice-meta{ display:flex; justify-content:space-between; font-size:11px; margin-bottom:10px; color:#555; }
.invoice-table{ width:100%; border-collapse:collapse; margin-bottom:10px; }
.invoice-table th, .invoice-table td{ padding:6px 4px; border-bottom:1px solid #eee; text-align:right; font-size:11.5px; }
.invoice-totals{ margin-top:8px; display:flex; flex-direction:column; gap:3px; align-items:flex-end; font-size:12px; }
.invoice-totals .grand{ font-weight:900; font-size:15px; border-top:1px dashed #ccc; padding-top:6px; margin-top:4px; }
.invoice-foot{ text-align:center; margin-top:14px; padding-top:10px; border-top:2px dashed #ccc; font-size:10.5px; color:#777; }
.imei-tag{ font-family: var(--font-mono); font-size:10px; background:#f2f2f2; padding:1px 5px; border-radius:4px; display:inline-block; margin-top:2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px){
  .pos-layout{ grid-template-columns: 1fr; }
  .pos-cart{ position:static; max-height:none; }
  .grid-2{ grid-template-columns: 1fr; }
  .grid-3{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px){
  .sidebar{ position:fixed; right:0; top:0; transform: translateX(100%); transition: transform var(--transition); box-shadow: var(--shadow-lg); }
  .sidebar.open{ transform: translateX(0); }
  .sidebar-close{ display:block; }
  .sidebar-overlay.show{ display:block; }
  .menu-toggle{ display:flex; }
  .topbar-center{ display:none; }
  .form-grid{ grid-template-columns: 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
  .pay-methods{ grid-template-columns: repeat(2,1fr); }
  .main-content{ padding:14px; }
  .user-info{ display:none; }
  .live-clock{ display:none; }
  .bridge-status-label{ display:none; }
  .bridge-status{ padding:6px; }
}
@media (max-width: 480px){
  .kpi-grid{ grid-template-columns: 1fr 1fr; }
  .product-grid{ grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); }
}


/* =====================================================================
   REPAIR CENTER — الصيانة والورشة
   ===================================================================== */

/* Status pills */
.rstatus{ display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; white-space:nowrap; }
.rstatus::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; flex-shrink:0; }
.rs-inspecting{ background: var(--primary-100); color: var(--primary); }
.rs-approval{ background: var(--warning-100); color: var(--warning); }
.rs-repairing{ background: var(--violet-100); color: var(--violet); }
.rs-part{ background: var(--danger-100); color: var(--danger); }
.rs-ready{ background: var(--success-100); color: var(--success); }
.rs-delivered{ background: var(--accent-100); color: var(--accent); }
.rs-cancelled{ background: var(--surface-2); color: var(--text-faint); border:1px solid var(--border); }

/* List helpers */
.repair-chips{ margin-bottom:14px; }
.cell-sub{ font-size:10.5px; color: var(--text-faint); font-weight:500; }
.cell-clip{ max-width:110px; overflow:hidden; text-overflow:ellipsis; }
.repair-table{ min-width:0; }
.repair-table thead th, .repair-table tbody td{ padding-inline:8px; }
#repairsSearchInput{ flex:1; min-width:220px; }
.cell-actions{ white-space:nowrap; }
.cell-actions .btn{ padding-inline:5px; }

/* Form sections */
.form-section-title{
  font-size:12px; font-weight:800; color: var(--primary);
  margin:18px 0 10px; padding-bottom:6px; border-bottom:1px solid var(--border);
}
.form-section-title:first-child{ margin-top:0; }
.form-field .checkbox-row{ font-size:12.5px; font-weight:600; color: var(--text); min-height:38px; }

/* Details modal */
.repair-details{ display:flex; flex-direction:column; gap:18px; }
.repair-status-bar{
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
  padding:12px 14px; background: var(--surface-2); border:1px solid var(--border); border-radius: var(--radius-md);
}
.info-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; }
.info-item{
  display:flex; flex-direction:column; gap:3px; min-width:0;
  padding:10px 12px; border:1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.info-item span{ font-size:10.5px; color: var(--text-faint); font-weight:700; }
.info-item strong{ font-size:12.5px; font-weight:700; overflow-wrap:anywhere; }
.info-item.full{ grid-column: 1 / -1; }
.info-item.info-note{ background: var(--primary-100); border-color: transparent; }
.info-item.info-note strong{ color: var(--primary); }

.rd-block{ display:flex; flex-direction:column; gap:10px; }
.rd-block-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.rd-block-head h4{ margin:0; font-size:13.5px; font-weight:800; }
.rd-actions{ display:flex; gap:8px; flex-wrap:wrap; }

.repair-cost-box{
  display:flex; flex-direction:column; gap:8px; padding:14px 16px;
  background: var(--surface-2); border:1px solid var(--border); border-radius: var(--radius-md);
}
.summary-line.remaining{ font-weight:800; padding:8px 10px; border-radius:8px; margin-top:2px; }
.summary-line.remaining.due{ background: var(--danger-100); color: var(--danger); }
.summary-line.remaining.clear{ background: var(--success-100); color: var(--success); }

.pay-log{ display:flex; flex-direction:column; border:1px solid var(--border); border-radius: var(--radius-sm); }
.pay-log-row{
  display:grid; grid-template-columns: 1fr auto auto; gap:14px; align-items:center;
  padding:8px 12px; font-size:12px; border-bottom:1px solid var(--border);
}
.pay-log-row:last-child{ border-bottom:none; }

/* Status timeline */
.rtimeline{ position:relative; display:flex; flex-direction:column; gap:14px; padding:2px 0 0; margin:0; }
.rtimeline::before{ content:''; position:absolute; top:8px; bottom:8px; right:5px; width:2px; background: var(--border); }
.rtimeline li{ position:relative; display:flex; gap:14px; align-items:flex-start; padding-right:0; }
.rt-dot{ position:relative; z-index:1; width:12px; height:12px; border-radius:50%; margin-top:4px; flex-shrink:0; border:2px solid var(--surface); }
.rt-dot.rs-inspecting{ background: var(--primary); }
.rt-dot.rs-approval{ background: var(--warning); }
.rt-dot.rs-repairing{ background: var(--violet); }
.rt-dot.rs-part{ background: var(--danger); }
.rt-dot.rs-ready{ background: var(--success); }
.rt-dot.rs-delivered{ background: var(--accent); }
.rt-dot.rs-cancelled{ background: var(--text-faint); }
.rt-body{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.rt-title{ font-size:12.5px; font-weight:700; }
.rt-note{ font-size:12px; color: var(--text-dim); }
.rt-meta{ font-size:10.5px; color: var(--text-faint); }

.modal-foot{ flex-wrap:wrap; }
.modal-box textarea{ font-family: inherit; }

@media (max-width: 860px){
  .info-grid{ grid-template-columns: 1fr 1fr; }
  .cell-clip{ max-width:140px; }
}
@media (max-width: 480px){
  .info-grid{ grid-template-columns: 1fr; }
  .pay-log-row{ grid-template-columns: 1fr auto; }
  .pay-log-row .cell-sub{ grid-column: 1 / -1; order:3; }
  .repair-details{ gap:14px; }
  .modal-foot .btn{ flex:1 1 auto; justify-content:center; }
  .repair-chips button{ white-space:nowrap; }
}

/* =====================================================================
   ACCOUNTS — CREDIT SALES & LEDGER
   ===================================================================== */
.v-alloc{
  padding:6px 8px; border-radius:8px; border:1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: var(--font-mono); font-size:12.5px; outline:none;
}
.v-alloc:focus{ border-color: var(--primary); }
.change-box{ flex-wrap:wrap; gap:8px; }
#accountsSearchInput{ flex:1; min-width:220px; }
.repair-table td .cell-sub{ white-space:normal; }
.modal-body .kpi-grid{ margin-bottom:14px; }
.badge.badge-neutral{ white-space:nowrap; }

@media (max-width: 480px){
  .v-alloc{ width:88px !important; }
  #creditSummary .repair-cost-box{ padding:12px; }
}
/* =====================================================================
   AUTH — LOGIN SCREEN
   ===================================================================== */
.login-screen{
  position:fixed; inset:0; z-index:500; display:flex; align-items:center; justify-content:center;
  background: radial-gradient(circle at 30% 20%, var(--primary-100), transparent 60%), var(--bg);
  padding:20px;
}
.login-screen.hidden{ display:none !important; }
.login-box{
  width:min(380px,100%); background:var(--surface); border:1px solid var(--border); border-radius: var(--radius-lg,14px);
  box-shadow: var(--shadow-md); padding:28px 26px; display:flex; flex-direction:column; gap:14px;
}
.login-brand{ display:flex; align-items:center; gap:10px; margin-bottom:4px; }
.login-title{ font-size:18px; font-weight:800; margin:4px 0 0; }
.login-sub{ font-size:12.5px; color:var(--text-faint); margin:0 0 6px; }
.login-error{
  background: var(--danger-100); color: var(--danger); border-radius:8px; padding:8px 12px; font-size:12.5px; font-weight:700;
}
.login-error.hidden{ display:none; }
.logout-btn{ margin-inline-start:2px; }

/* =====================================================================
   USERS & PERMISSIONS
   ===================================================================== */
.role-badge{ display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:800; }
.role-badge.role-developer{ background: var(--danger-100); color: var(--danger); }
.role-badge.role-manager{ background: var(--primary-100); color: var(--primary); }
.role-badge.role-employee{ background: var(--surface-2); color: var(--text-dim); border:1px solid var(--border); }

.perm-toolbar{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.perm-groups{ display:flex; flex-direction:column; gap:10px; max-height:360px; overflow-y:auto; border:1px solid var(--border); border-radius:10px; padding:10px 12px; background:var(--surface-2); }
.perm-group{ border-bottom:1px solid var(--border); padding-bottom:8px; }
.perm-group:last-child{ border-bottom:none; padding-bottom:0; }
.perm-group-head{ font-size:12.5px; font-weight:800; margin-bottom:6px; color:var(--text-dim); }
.perm-grid{ display:grid; grid-template-columns: repeat(2,1fr); gap:5px 10px; }
.perm-item{ display:flex; align-items:center; gap:7px; font-size:12px; }
.perm-item input{ width:auto; }
.dev-lock-note{ font-size:11.5px; color:var(--text-faint); background:var(--surface-2); border-radius:8px; padding:8px 12px; }

.audit-action{ font-family: var(--font-mono); font-size:11px; font-weight:700; padding:2px 7px; border-radius:6px; background:var(--surface-2); border:1px solid var(--border); }

@media (max-width: 480px){
  .perm-grid{ grid-template-columns: 1fr; }
  .login-box{ padding:22px 18px; }
}

/* =====================================================================
   DATA MANAGEMENT (Developer only)
   ===================================================================== */
.dm-table{ min-width:560px; }
.dm-table .dm-check-cell{ width:46px; text-align:center; }
.dm-check{ width:16px; height:16px; cursor:pointer; accent-color: var(--primary); }
.dm-table tbody tr.dm-selected{ background: var(--primary-100); }
.dm-count{ font-weight:700; }
.dm-danger-zone{ border-color: var(--danger); }
.dm-danger-zone .panel-head{ color: var(--danger); border-bottom-color: var(--danger-100); }
.dm-danger-row{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding:12px 0; }
.dm-danger-row + .dm-danger-row{ border-top:1px solid var(--border); }
.dm-danger-row > div{ flex:1 1 320px; min-width:0; }
.dm-adjust-list{ margin:0; padding-inline-start:18px; font-size:12px; color:var(--text-dim); display:flex; flex-direction:column; gap:4px; list-style:disc; }
.dm-impact-total{ display:flex; justify-content:space-between; margin-top:14px; padding-top:10px; border-top:1px solid var(--border); font-weight:800; }
/* ---- Bulk selection (Data Management + Products / Customers / Suppliers) ---- */
.bulk-bar{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; padding:10px 14px; border-bottom:1px solid var(--border); background:var(--primary-100); }
.bulk-count{ font-weight:700; font-size:13px; padding:4px 10px; border-radius:999px; background:var(--surface, #fff); border:1px solid var(--border); }
.bulk-count.has-selection{ border-color:var(--primary); color:var(--primary); }
.bulk-sep{ flex:1 1 auto; }
.bulk-deleteall{ border-color:var(--danger); color:var(--danger); }
.dm-rec-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.dm-rec-search{ margin-bottom:10px; }
.dm-rec-search input{ width:100%; max-width:420px; }
.dm-rec-table{ max-height:420px; overflow:auto; border:1px solid var(--border); border-radius:8px; }
.dm-rec-table thead th{ position:sticky; top:0; background:var(--surface, #fff); z-index:1; }
.dm-name-list{ max-height:150px; overflow-y:auto; }
.dm-warn-line{ margin:0 0 12px; padding:8px 10px; border-radius:8px; background:var(--danger-100); color:var(--danger); font-size:12.5px; font-weight:600; }
.table-wrap > table .dm-check-cell{ width:46px; text-align:center; }
/* =====================================================================
   PRODUCT STICKER PRINTING (Products screen + print settings)
   ===================================================================== */
.sticker-check-cell{ width:40px; text-align:center; }
.sticker-check{ width:16px; height:16px; cursor:pointer; accent-color: var(--accent); }
.sticker-preview-box{
  background:#fff; border:1px solid var(--border); border-radius:10px;
  padding:14px; display:flex; justify-content:center; align-items:center; min-height:110px;
}
.sticker-imei-list{
  max-height:200px; overflow-y:auto; border:1px solid var(--border); border-radius:8px;
  padding:8px 12px; display:flex; flex-direction:column; gap:8px; margin-top:10px; background:var(--surface-2);
}
.sticker-imei-row{ display:flex; align-items:center; gap:8px; font-size:12.5px; }
.sticker-imei-row input{ width:auto; }
#stickerSelCount{ font-weight:700; }
/* =====================================================================
   BARCODE LABEL DESIGNER — layout grid, field/order/position rows
   ===================================================================== */
.label-designer-grid{ display:grid; grid-template-columns: 1.3fr 1fr; gap:22px; align-items:start; }
@media (max-width: 900px){ .label-designer-grid{ grid-template-columns: 1fr; } }
.ld-preview{ position:sticky; top:10px; }
.field-order-list{ display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.field-order-row{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:8px 10px; border:1px solid var(--border); border-radius:8px; background:var(--surface-2);
}
.field-order-row .checkbox-row{ flex:1 1 160px; min-width:140px; }
.field-order-row .ld-field-pos{ width:auto; min-width:90px; padding:6px 8px; font-size:12px; }
.field-order-arrows{ display:flex; gap:4px; }
.lbl-preview-stage{ display:flex; justify-content:center; padding:10px; background:var(--surface-2); border-radius:10px; }
.lbl-preview-meta{ margin-top:8px; font-size:11.5px; color:var(--text-dim); text-align:center; }
.lbl-note{ margin-top:6px; padding:6px 10px; border-radius:8px; font-size:11.5px; }
.lbl-note.warn{ background:var(--warning-100, #fff4e0); color:var(--warning, #b45309); }
.lbl-note.err{ background:var(--danger-100); color:var(--danger); }
.lbl-note.ok{ background:var(--success-100, #e6f6ec); color:var(--success); }
.lbl-pagemap{ margin-top:12px; display:flex; flex-direction:column; align-items:center; }

/* =====================================================================
   MINIMUM SELLING PRICE — product form + POS cart price edit
   ===================================================================== */
.min-price-hint{ font-size:11px; color:var(--text-dim); margin-top:2px; }
.cart-row-price-wrap{ display:flex; align-items:center; gap:6px; }
.cart-price-edit-btn{
  border:none; background:transparent; cursor:pointer; font-size:12px; color:var(--primary);
  padding:2px 4px; border-radius:6px;
}
.cart-price-edit-btn:hover{ background:var(--primary-100); }

/* =====================================================================
   PRODUCT TRACKING TYPE toggle (Add/Edit Product)
   ===================================================================== */
.tracking-type-hint{ font-size:11.5px; color:var(--text-dim); margin-top:4px; }

/* =====================================================================
   SETTINGS — Auto Backup / Daily Report panels
   ===================================================================== */
.backup-status-row{ display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-top:1px solid var(--border); }
.backup-status-row:first-child{ border-top:none; }