/* ===================================================================
   POS System — visual layer
   Design notes:
   - Numbers are the content of this product, so every figure is set in
     tabular figures and aligned. That alignment is the signature, not decoration.
   - Ink sidebar / paper canvas: the panel reads like a ledger, the POS like a till.
   =================================================================== */

:root {
  --ink:        #12212E;
  --ink-2:      #1B3040;
  --ink-3:      #24435A;
  --paper:      #F4F2ED;
  --surface:    #FFFFFF;
  --line:       #E2DED5;
  --text:       #1C2B36;
  --muted:      #6B7A87;
  --accent:     #0E9F6E;
  --accent-dk:  #0A7D56;
  --amber:      #C77D0A;
  --danger:     #BE3A2B;
  --info:       #2A6F97;
  --radius:     6px;
  --sidebar-w:  248px;
}

* { box-sizing: border-box; }

body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* Every figure in the system aligns on the decimal point. */
.num, td.num, th.num, .money, .table td.num, input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: end;
  letter-spacing: 0;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: #C9D6E0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 3px; }

.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--ink-2);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .mark {
  width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.sidebar-brand strong { color: #fff; font-size: 15px; line-height: 1.2; }
.sidebar-brand span { display: block; font-size: 11px; color: #7E93A3; font-weight: 400; }

.nav-section {
  padding: 14px 18px 6px;
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #5C7285;
}
.sidebar .nav-link {
  color: #C9D6E0;
  padding: 8px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  border-inline-start: 3px solid transparent;
  border-radius: 0;
}
.sidebar .nav-link i { width: 18px; text-align: center; font-size: 13px; opacity: .75; }
.sidebar .nav-link:hover { background: var(--ink-2); color: #fff; }
.sidebar .nav-link.active {
  background: var(--ink-2);
  color: #fff;
  border-inline-start-color: var(--accent);
}
.sidebar .nav-link.active i { opacity: 1; color: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 16px; font-weight: 600; margin: 0; }
.content { padding: 20px; flex: 1; }

/* ---------- cards & tables ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-body { padding: 16px; }

.table { margin: 0; }
.table > thead > tr > th {
  background: #FAF9F6;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 9px 12px;
  white-space: nowrap;
}
.table > tbody > tr > td { padding: 10px 12px; border-bottom: 1px solid #F0EDE6; vertical-align: middle; }
.table > tbody > tr:hover { background: #FBFAF7; }

/* Stat tiles: number first, label after. The number is the message. */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  height: 100%;
  border-top: 2px solid var(--ink-3);
}
.stat .value {
  font-size: 26px; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.accent { border-top-color: var(--accent); }
.stat.amber  { border-top-color: var(--amber); }
.stat.danger { border-top-color: var(--danger); }

/* ---------- forms & buttons ---------- */
.form-label { font-size: 12.5px; font-weight: 600; color: #40525F; margin-bottom: 4px; }
.form-control, .form-select {
  border: 1px solid #D3CFC6;
  border-radius: var(--radius);
  font-size: 13.5px;
  padding: 7px 10px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,159,110,.13);
}
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { display: block; font-size: 12px; color: var(--danger); }
.form-text { font-size: 11.5px; color: var(--muted); }

.btn { border-radius: var(--radius); font-size: 13.5px; padding: 7px 14px; font-weight: 500; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-dark { background: var(--ink); border-color: var(--ink); }
.btn-outline-secondary { border-color: #CFCAC0; color: #4A5A66; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }

.badge { font-weight: 500; font-size: 11.5px; padding: 4px 8px; border-radius: 4px; }

.alert { border: 1px solid transparent; border-radius: var(--radius); font-size: 13.5px; padding: 10px 14px; }
.alert-success { background: #E8F6F0; border-color: #BEE5D6; color: #0A6647; }
.alert-danger  { background: #FBEBE9; border-color: #F0C9C3; color: #8E2C20; }
.alert-warning { background: #FDF4E3; border-color: #F2DFB8; color: #8A5A08; }
.alert-info    { background: #EAF2F8; border-color: #C6DCEB; color: #1F5878; }

.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state i { font-size: 30px; opacity: .3; display: block; margin-bottom: 10px; }

/* Permission grid keeps modules visually separate so nothing is granted by accident. */
.perm-module { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.perm-module > header {
  background: #FAF9F6; padding: 8px 12px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 13px;
}
.perm-module .perm-list { padding: 10px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.perm-list .form-check-label { font-size: 13px; }

.table-responsive { border-radius: var(--radius); }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--ink); padding: 20px; }
.login-card {
  background: var(--surface); width: 100%; max-width: 380px;
  border-radius: 8px; padding: 30px 28px; border: 1px solid rgba(255,255,255,.06);
}
.login-card .mark {
  width: 44px; height: 44px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 19px; margin-bottom: 16px;
}

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed; inset-inline-start: 0; top: 0; z-index: 1045;
    transform: translateX(var(--off, -100%));
    transition: transform .18s ease;
  }
  html[dir="rtl"] .sidebar { --off: 100%; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1040; }
  .content { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}
