/* =========================================================
   app.css — PET GLOW POS/ERP  ·  Complete Stylesheet v1.0
   =========================================================
   ⚡ EASY UPDATE (Colors/Theme):
   Change the values in :root {} below.
   Everything else auto-updates from these variables.
   ========================================================= */

/* ── CSS Variables (Theme Tokens) ───────────────────────── */
:root {
  /* Primary brand blue */
  --primary:       #1565c0;
  --primary-d:     #0d47a1;
  --primary-l:     #1976d2;
  --primary-pale:  #e3eeff;

  /* Accent teal */
  --accent:        #0097a7;
  --accent-pale:   #e0f7fa;

  /* Status */
  --success:       #2e7d32;
  --success-pale:  #e8f5e9;
  --warn:          #f57c00;
  --warn-pale:     #fff3e0;
  --danger:        #c62828;
  --danger-pale:   #ffebee;
  --info:          #1565c0;

  /* Backgrounds */
  --bg:            #f0f4f8;
  --surface:       #ffffff;
  --surface2:      #f7f9fc;
  --sidebar-bg:    #0d2744;
  --sidebar-hover: #1a3a5c;
  --sidebar-active:#1565c0;

  /* Text */
  --tx:            #1a202c;
  --tx2:           #5a6a7a;
  --tx3:           #99aab5;
  --sidebar-tx:    #c8d8e8;
  --sidebar-tx-act:#ffffff;

  /* Borders */
  --bd:            #dde4ed;
  --bd2:           #c4ccd6;

  /* Misc */
  --r:             8px;
  --r-sm:          5px;
  --shadow:        0 1px 4px rgba(0,0,0,.08), 0 2px 12px rgba(0,0,0,.05);
  --shadow-md:     0 4px 16px rgba(0,0,0,.12);

  /* Kcard colors */
  --kc-blue:   #1565c0;
  --kc-green:  #2e7d32;
  --kc-orange: #f57c00;
  --kc-red:    #c62828;
  --kc-teal:   #0097a7;
  --kc-purple: #6a1b9a;

  /* Sidebar width */
  --sb-w: 220px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; font-size: 14px; }
body { margin: 0; height: 100%; background: var(--bg); color: var(--tx);
       font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
       -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; }
img { max-width: 100%; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 4px; }

/* ── Utility ─────────────────────────────────────────────── */
.hn { display: none !important; }
.r  { text-align: right !important; }
.c  { text-align: center !important; }
.tg { color: var(--success); }
.mono { font-family: 'Courier New', monospace; }
.stk-zero { color: var(--danger); font-weight: 700; }
.stk-low  { color: var(--warn);   font-weight: 600; }
.stk-ok   { color: var(--success);}
.stk-svc  { color: var(--accent); font-style: italic; font-size: 11px; }
.empty { text-align: center; color: var(--tx2); padding: 32px; font-size: 13px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr;     gap: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr);gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr);gap: 14px; }
.g12{ grid-template-columns: 1fr 1fr; }

/* ── Layout ──────────────────────────────────────────────── */
#app    { display: flex; height: 100vh; overflow: hidden; }
#sb     { width: var(--sb-w); min-width: var(--sb-w); background: var(--sidebar-bg);
          display: flex; flex-direction: column; overflow-y: auto; transition: width .2s; z-index: 100; }
#ws     { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#topbar { background: var(--surface); border-bottom: 1px solid var(--bd); padding: 0 20px;
          height: 54px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; z-index: 50; }
#content{ flex: 1; overflow-y: auto; padding: 20px; }
#conn-banner { display: none; padding: 8px 20px; font-size: 12.5px; font-weight: 600; text-align: center; }
#conn-banner.offline { display: block; background: var(--danger); color: #fff; }
#conn-banner.back    { display: block; background: var(--success); color: #fff; }

/* Login screen */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #0d2744 0%, #1565c0 100%);
  padding: 20px;
}
.login-box {
  background: var(--surface); border-radius: 14px; padding: 40px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-md);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo-emoji { font-size: 42px; display: block; }
.login-logo-name  { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.login-logo-tag   { font-size: 11.5px; color: var(--tx2); margin-top: 2px; }
.login-box h2     { font-size: 16px; font-weight: 700; text-align: center; margin: 0 0 20px; color: var(--tx); }
.login-link { text-align: center; margin-top: 14px; font-size: 12px; color: var(--tx2); }
.login-link a { color: var(--primary); }

/* ── Sidebar ─────────────────────────────────────────────── */
.sb-brand { padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.sb-brand-nm { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.sb-brand-tg { font-size: 10px; color: var(--sidebar-tx); opacity: .6; margin-top: 2px; }
.sb-brand-v  { font-size: 9.5px; color: var(--sidebar-tx); opacity: .4; margin-top: 2px; }
.sb-section  { padding: 14px 10px 4px; font-size: 9.5px; font-weight: 700;
               color: var(--sidebar-tx); opacity: .45; letter-spacing: .8px; text-transform: uppercase; }
.nv { list-style: none; margin: 0; padding: 0 8px; }
.nv li { margin-bottom: 1px; }
.nv li a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  color: var(--sidebar-tx); border-radius: var(--r-sm); text-decoration: none;
  font-size: 13px; transition: background .15s, color .15s;
}
.nv li a .nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nv li a:hover     { background: var(--sidebar-hover); color: #fff; }
.nv li a.on        { background: var(--primary); color: #fff; font-weight: 600; }
.sb-footer {
  margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px; color: var(--sidebar-tx); opacity: .5;
}
.sb-user { padding: 12px; display: flex; align-items: center; gap: 8px;
           border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
             color: #fff; display: flex; align-items: center; justify-content: center;
             font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sb-uname  { font-size: 12px; color: #fff; font-weight: 600; line-height: 1.3; }
.sb-urole  { font-size: 10px; color: var(--sidebar-tx); opacity: .6; }
.sb-signout{ background: none; border: none; color: var(--sidebar-tx); font-size: 10px;
             margin-left: auto; padding: 3px 6px; border-radius: 3px; opacity: .6;
             cursor: pointer; }
.sb-signout:hover { opacity: 1; background: rgba(255,255,255,.08); }

/* ── Topbar ──────────────────────────────────────────────── */
.tb-title  { font-size: 16px; font-weight: 700; color: var(--tx); }
.tb-right  { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tb-clock  { font-size: 13px; color: var(--tx2); font-variant-numeric: tabular-nums; }
.tb-date   { font-size: 11px; color: var(--tx3); }
.tb-badge  { background: var(--primary-pale); color: var(--primary); border-radius: 4px;
             padding: 3px 8px; font-size: 11px; font-weight: 700; }

/* ── Module container ────────────────────────────────────── */
.mod { display: none; animation: fadeIn .2s ease; }
.mod.on { display: block; }
.mod.np { display: none; padding: 0; }
.mod.np.on { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.mod-hd { display: flex; align-items: center; justify-content: space-between;
           margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.mod-title { font-size: 18px; font-weight: 700; color: var(--tx); }
.mod-acts  { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border: none; border-radius: var(--r-sm);
  font-weight: 600; cursor: pointer; transition: opacity .15s, box-shadow .15s;
  font-size: 13px; text-decoration: none; white-space: nowrap;
}
.btn:hover   { opacity: .88; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.btn:active  { opacity: .76; }
.btn:disabled{ opacity: .45; cursor: not-allowed; }
.btn-p  { background: var(--primary);  color: #fff; }
.btn-a  { background: var(--accent);   color: #fff; }
.btn-s  { background: var(--success);  color: #fff; }
.btn-d  { background: var(--danger);   color: #fff; }
.btn-g  { background: var(--surface);  color: var(--tx); border: 1px solid var(--bd); }
.btn-g:hover { background: var(--surface2); }
.btn-w  { background: #25d366;          color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xl { padding: 11px 24px; font-size: 15px; font-weight: 800; }
.btn-full { width: 100%; justify-content: center; }
.btn-loading::after {
  content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 6px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Icon button */
.ib {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 1px solid var(--bd);
  background: var(--surface); border-radius: var(--r-sm); cursor: pointer;
  color: var(--tx2); transition: background .15s; padding: 0;
}
.ib:hover { background: var(--surface2); color: var(--tx); }
.ie:hover { border-color: var(--primary); color: var(--primary); }
.id:hover { border-color: var(--danger); color: var(--danger); }

/* Badge / chip */
.xbtn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px;
        font-size: 11.5px; border-radius: 20px; border: 1px solid var(--bd);
        background: var(--surface); cursor: pointer; color: var(--tx); }
.xbtn:hover { background: var(--primary-pale); border-color: var(--primary); color: var(--primary); }
.xbtn-hold { background: #fffbe6; border-color: #f57c00; color: #f57c00; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow);
}
.card-title { font-size: 12px; font-weight: 700; color: var(--tx2); text-transform: uppercase;
              letter-spacing: .5px; margin-bottom: 12px; }

/* KPI card */
.kcard {
  background: var(--surface); border: 1px solid var(--bd); border-radius: var(--r);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}
.kcard.kc-blue   { border-left-color: var(--kc-blue);   }
.kcard.kc-green  { border-left-color: var(--kc-green);  }
.kcard.kc-orange { border-left-color: var(--kc-orange); }
.kcard.kc-red    { border-left-color: var(--kc-red);    }
.kcard.kc-teal   { border-left-color: var(--kc-teal);   }
.kcard.kc-purple { border-left-color: var(--kc-purple); }
.k-icon  { font-size: 18px; }
.k-label { font-size: 11px; font-weight: 600; color: var(--tx2); text-transform: uppercase;
           letter-spacing: .4px; }
.k-val   { font-size: 18px; font-weight: 800; color: var(--tx); line-height: 1; }

/* ── Forms ───────────────────────────────────────────────── */
.fg {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px;
}
.fg label { font-size: 12px; font-weight: 600; color: var(--tx2); }
.fg label span.req { color: var(--danger); margin-left: 2px; }
.fg input, .fg select, .fg textarea { width: 100%; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  padding: 8px 10px; border: 1px solid var(--bd); border-radius: var(--r-sm);
  background: var(--surface); color: var(--tx); font-size: 13px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-pale);
}
input:read-only { background: var(--surface2); color: var(--tx2); cursor: default; }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 60px; }
.inp-search { padding: 7px 10px; border: 1px solid var(--bd); border-radius: var(--r-sm);
              background: var(--surface); color: var(--tx); font-size: 13px; outline: none; }
.inp-search:focus { border-color: var(--primary); }

/* ── Tables ──────────────────────────────────────────────── */
.tw { overflow-x: auto; border: 1px solid var(--bd); border-radius: var(--r); }
.tw table { min-width: 500px; }
th {
  background: var(--surface2); color: var(--tx2); font-size: 11.5px; font-weight: 700;
  padding: 9px 10px; text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 2px solid var(--bd); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--bd); font-size: 13px;
     vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--primary-pale); transition: background .1s; }
tfoot td { background: var(--surface2); }
.trow-click { cursor: pointer; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px;
  font-weight: 700; white-space: nowrap;
}
.b-blue   { background: var(--primary-pale); color: var(--primary); }
.b-green  { background: var(--success-pale); color: var(--success); }
.b-red    { background: var(--danger-pale);  color: var(--danger);  }
.b-orange { background: var(--warn-pale);    color: var(--warn);    }
.b-gray   { background: var(--surface2);     color: var(--tx2);     }
.b-teal   { background: #e0f7fa;             color: #006064;        }
.b-purple { background: #f3e5f5;             color: #6a1b9a;        }

/* ── Autocomplete dropdowns ──────────────────────────────── */
.acw { position: relative; }
.acd, .sg-acd {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px);
  background: var(--surface); border: 1px solid var(--bd); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md); z-index: 500; max-height: 240px; overflow-y: auto;
}
.aci, .sg-aci {
  padding: 9px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--bd); font-size: 13px;
}
.aci:last-child, .sg-aci:last-child { border-bottom: none; }
.aci:hover, .sg-aci:hover, .aci:focus, .sg-aci:focus {
  background: var(--primary-pale); outline: none;
}
.aci-main   { flex: 1; min-width: 0; }
.aci-name   { font-weight: 600; color: var(--tx); }
.aci-meta   { display: flex; gap: 8px; font-size: 11px; color: var(--tx2); margin-top: 2px; }
.sg-aci-nm  { font-weight: 600; color: var(--tx); }
.sg-aci-ar  { font-size: 10.5px; color: var(--tx2); text-align: right; direction: rtl; }
.sg-aci-meta{ display: flex; gap: 8px; font-size: 10.5px; color: var(--tx2); margin-top: 2px; }
.sg-aci-price { font-weight: 700; color: var(--primary); font-size: 13px; white-space: nowrap; }
.sg-aci-stk { font-size: 10.5px; padding: 1px 5px; border-radius: 8px; }
.sg-aci-stk.ok   { background: var(--success-pale); color: var(--success); }
.sg-aci-stk.low  { background: var(--warn-pale);    color: var(--warn);    }
.sg-aci-stk.zero { background: var(--danger-pale);  color: var(--danger);  }

/* ── Item grid (product catalog) ─────────────────────────── */
.pgrid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.pcard {
  background: var(--surface); border: 1px solid var(--bd); border-radius: var(--r);
  padding: 14px; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.pcard:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(21,101,192,.15); }
.pc-type { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.pc-stk  { font-size: 10.5px; font-weight: 600; }
.pc-name { font-size: 13.5px; font-weight: 700; color: var(--tx); line-height: 1.3; margin-top: 2px; }
.pc-ar   { font-size: 11px; color: var(--tx2); text-align: right; direction: rtl; }
.pc-metas{ display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.pc-m    { display: flex; justify-content: space-between; font-size: 10.5px; }
.pc-m .l { color: var(--tx2); }
.pc-m .v { font-weight: 600; color: var(--tx); text-align: right; max-width: 130px;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-m .tg{ color: var(--success); }
.pc-prices{ display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px;
            border-top: 1px solid var(--bd); }
.pc-cost  { font-size: 12px; color: var(--tx2); }
.pc-srate { font-size: 16px; font-weight: 800; color: var(--primary); }
.pca      { display: flex; gap: 5px; margin-top: 8px; }
.add-pcard{
  background: var(--surface2); border: 2px dashed var(--bd); border-radius: var(--r);
  padding: 28px 14px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--tx2);
  font-size: 13px; transition: border-color .15s, color .15s;
}
.add-pcard:hover { border-color: var(--primary); color: var(--primary); }

/* ── Sales form (split layout) ───────────────────────────── */
.s2-wrap { display: flex; height: calc(100vh - 54px - 48px); overflow: hidden; }
.s2-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 14px 16px; min-width: 0; }
.s2-aside{ width: 300px; min-width: 280px; border-left: 1px solid var(--bd);
           background: var(--surface); display: flex; flex-direction: column; overflow-y: auto; }
.s2-aside-s { padding: 14px; border-bottom: 1px solid var(--bd); }
.s2-ibt { font-size: 11px; font-weight: 700; color: var(--tx2); text-transform: uppercase;
          letter-spacing: .5px; margin-bottom: 10px; }
.s2-ir  { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0;
          border-bottom: 1px solid var(--bd); }
.s2-ir:last-child { border: none; }
.s2-ir .k{ color: var(--tx2); }
.s2-ir .v{ font-weight: 600; }
.s2-ir .vg{ font-weight: 600; color: var(--success); }
.s2-ir .vr{ font-weight: 600; color: var(--danger); }

/* Platform pills */
.s2-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.s2-pill {
  padding: 5px 11px; border: 1px solid var(--bd); border-radius: 20px;
  font-size: 12px; cursor: pointer; background: var(--surface); color: var(--tx2);
  transition: all .15s;
}
.s2-pill:hover { border-color: var(--primary); color: var(--primary); }
.s2-pill.on    { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* Paid/Credit button */
.s2-paid-btn {
  padding: 7px 16px; border-radius: 20px; border: 2px solid var(--success);
  color: var(--success); background: var(--success-pale); font-weight: 700;
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.s2-paid-btn.credit { border-color: var(--warn); color: var(--warn); background: var(--warn-pale); }

/* Header row */
.s2-hdr { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.s2-hdr-field { display: flex; flex-direction: column; gap: 3px; }
.s2-hdr-label { font-size: 11px; font-weight: 600; color: var(--tx2); }
.inv-no-box {
  background: var(--primary-pale); color: var(--primary); font-size: 18px; font-weight: 800;
  padding: 6px 12px; border-radius: var(--r-sm); font-family: monospace; min-width: 70px;
  text-align: center;
}

/* Customer search */
.c-search-wrap { position: relative; flex: 1; min-width: 180px; }
#cdrop { width: 100%; }

/* Mkt row */
.s2-mkt-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
              padding: 8px; background: var(--warn-pale); border-radius: var(--r-sm);
              margin-bottom: 10px; font-size: 12px; }
.s2-mkt-row label { font-weight: 600; color: var(--tx2); white-space: nowrap; }

/* Line table */
.sg-table-wrap { flex: 1; overflow: auto; border: 1px solid var(--bd); border-radius: var(--r);
                 background: var(--surface); }
.sg-table-wrap table { min-width: 800px; }
.sg-table-wrap thead th { font-size: 10px; padding: 6px 4px; }
.ec { padding: 2px 3px !important; }
.sg-inp {
  width: 100%; padding: 5px 5px; border: 1px solid transparent; border-radius: 3px;
  background: transparent; font-size: 12.5px; color: var(--tx); outline: none;
  transition: border-color .1s, background .1s;
}
.sg-inp:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px var(--primary-pale); }
.sg-inp.r { text-align: right; }
.sg-inp.c { text-align: center; }
.sg-ro {
  width: 100%; padding: 5px; border: none; background: transparent;
  font-size: 11.5px; color: var(--tx2); outline: none;
  text-align: center; cursor: default;
}
.sg-del {
  width: 22px; height: 22px; border: none; background: transparent; cursor: pointer;
  color: var(--tx3); border-radius: 3px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center;
}
.sg-del:hover { background: var(--danger-pale); color: var(--danger); }
.sl-tot { text-align: right; padding-right: 10px !important; font-weight: 700;
          color: var(--tx); font-size: 13px; white-space: nowrap; }
.sg-sl  { font-size: 10px; color: var(--tx3); padding: 0 2px !important; }
.line-info-tag { font-size: 9.5px; color: var(--tx3); padding: 0 4px; }

/* Sale totals panel */
.sal-totals { background: var(--surface); border: 1px solid var(--bd); border-radius: var(--r);
              padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.sal-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.sal-row .k { color: var(--tx2); }
.sal-row .v { font-weight: 600; }
.sal-grand-row { display: flex; justify-content: space-between; font-size: 17px; font-weight: 800;
                 color: var(--primary); padding-top: 8px; margin-top: 4px; border-top: 2px solid var(--bd); }

/* P&L panel in sale form */
.pl-panel { background: var(--surface2); border: 1px solid var(--bd); border-radius: var(--r);
            padding: 10px 14px; font-size: 11.5px; }
.pl-panel .k { color: var(--tx2); }
.pl-panel .v { font-weight: 600; }
.pl-row { display: flex; justify-content: space-between; padding: 3px 0; }

/* Delivery toggle */
.del-tog-btn {
  padding: 4px 12px; border-radius: 20px; border: 1px solid var(--bd);
  font-size: 11.5px; cursor: pointer; background: var(--surface); color: var(--tx2);
}
.del-tog-btn.on { background: var(--warn-pale); border-color: var(--warn); color: var(--warn); }

/* Payment radio row */
.pay-radio-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px;
                 padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; }
.pay-radio-row:hover { background: var(--primary-pale); }
.pay-radio-row input[type=radio] { accent-color: var(--primary); }

/* Held sales mini bar */
#held-mini { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 0; min-height: 16px; }

/* Action bar at bottom of sale */
.sale-actions { padding: 12px 16px; border-top: 1px solid var(--bd); background: var(--surface);
                display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* Sales dashboard sub-tabs */
.stabs { display: flex; gap: 0; border-bottom: 1px solid var(--bd); background: var(--surface);
         padding: 0 16px; flex-shrink: 0; }
.stab { padding: 11px 16px; font-size: 13px; font-weight: 600; color: var(--tx2);
        border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.stab:hover { color: var(--primary); }
.stab.on { color: var(--primary); border-bottom-color: var(--primary); }
.stab-pane { display: none; }
.stab-pane.on { display: block; }

/* Dash sub-tabs: filter buttons */
.sd-range-btn { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--bd);
                font-size: 11.5px; cursor: pointer; background: var(--surface); color: var(--tx2); }
.sd-range-btn:hover { background: var(--primary-pale); color: var(--primary); }
.sd-range-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.sd-kpi-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.sd-kpi { display: flex; align-items: center; gap: 10px; background: var(--surface);
          border: 1px solid var(--bd); border-radius: var(--r); padding: 10px 14px;
          white-space: nowrap; flex-shrink: 0; }
.sd-kpi-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center;
               justify-content: center; font-size: 16px; flex-shrink: 0; }
.sd-kpi-lbl { font-size: 10.5px; font-weight: 600; color: var(--tx2); text-transform: uppercase;
              letter-spacing: .4px; }
.sd-kpi-val { font-size: 16px; font-weight: 800; color: var(--tx); }
.sd-sum-row { display: flex; justify-content: space-between; padding: 5px 0;
              border-bottom: 1px dashed var(--bd); font-size: 13px; }
.sd-sum-row:last-child { border: none; }

/* ── Purchase sub-tabs ───────────────────────────────────── */
.ptabs { display: flex; gap: 0; border-bottom: 1px solid var(--bd); background: var(--surface); padding: 0 16px; }
.ptab  { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--tx2);
         border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.ptab:hover  { color: var(--primary); }
.ptab.on     { color: var(--primary); border-bottom-color: var(--primary); }
.pur-pane    { display: none; padding: 16px; }
.pur-pane.on { display: block; }

/* ── Report tabs ─────────────────────────────────────────── */
.rpt-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.rpt-tab  { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--bd);
            font-size: 12px; cursor: pointer; background: var(--surface); color: var(--tx2); }
.rpt-tab:hover { background: var(--primary-pale); color: var(--primary); }
.rpt-tab.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.rpt-pane { display: none; }
.rpt-pane.on { display: block; }
.pl-r { display: flex; justify-content: space-between; padding: 5px 0;
        border-bottom: 1px dashed var(--bd); font-size: 12.5px; }
.pl-r:last-child { border: none; }
.pl-r-bold { display: flex; justify-content: space-between; padding: 6px 0;
             font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--bd); }
.pl-sep { height: 8px; }

/* ── Modals ──────────────────────────────────────────────── */
.ovl {
  position: fixed; inset: 0; background: rgba(13,39,68,.45); z-index: 900;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px 12px; overflow-y: auto; backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-md);
  width: 100%; max-width: 560px; animation: slideUp .2s ease; margin: auto;
}
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1050px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.mhd { display: flex; align-items: center; justify-content: space-between;
       padding: 14px 18px; border-bottom: 1px solid var(--bd); }
.mhd h3 { font-size: 15px; font-weight: 700; margin: 0; }
.mhd-close { background: none; border: none; font-size: 20px; cursor: pointer;
             color: var(--tx2); padding: 2px 6px; border-radius: 4px; line-height: 1; }
.mhd-close:hover { background: var(--surface2); color: var(--tx); }
.mbd { padding: 18px; }
.mft { padding: 14px 18px; border-top: 1px solid var(--bd); display: flex; gap: 8px;
       justify-content: flex-end; }

/* ── Toast notifications ─────────────────────────────────── */
#twrap { position: fixed; bottom: 20px; right: 20px; z-index: 1100;
         display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; }
.toast {
  background: #1a202c; color: #fff; padding: 11px 16px; border-radius: var(--r);
  font-size: 13px; max-width: 340px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px; pointer-events: all;
  animation: toastIn .2s ease;
}
.toast.s { background: var(--success); }
.toast.e { background: var(--danger); }
.toast.i { background: var(--info); }
.toast.w { background: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Loading overlay ─────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0; background: var(--sidebar-bg); z-index: 2000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
#loading-overlay.hn { display: none; }
.loading-spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.2);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; display: block;
}
.loading-spinner.dark {
  border-color: rgba(21,101,192,.2); border-top-color: var(--primary);
}
#loading-msg { color: rgba(255,255,255,.7); font-size: 13px; }

/* ── Dashboard ───────────────────────────────────────────── */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; margin-bottom: 20px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Settings ────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.settings-tabs { display: flex; flex-direction: column; gap: 2px; }
.settings-tab  { padding: 9px 14px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--tx2); }
.settings-tab:hover { background: var(--surface2); }
.settings-tab.on    { background: var(--primary-pale); color: var(--primary); font-weight: 700; }
.settings-pane { display: none; }
.settings-pane.on { display: block; }

/* ── Print styles ─────────────────────────────────────────── */
@media print {
  #sb, #topbar, .no-print, .btn, .ib, .stabs, .ptabs, .rpt-tabs { display: none !important; }
  body { background: #fff; }
  .mod { display: block !important; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sb-w: 56px; }
  .sb-brand-nm, .sb-brand-tg, .sb-brand-v, .sb-section, .nv li a span:not(.nav-icon) { display: none; }
  .sb-user .sb-uname, .sb-user .sb-urole { display: none; }
  .nv li a { justify-content: center; padding: 10px; }
  .s2-aside { display: none; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #content { padding: 12px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .pgrid   { grid-template-columns: 1fr; }
  .mod-hd  { flex-direction: column; align-items: flex-start; }
  .s2-hdr  { flex-direction: column; }
}
