/* LUXIO ERP styles - mobile friendly, no external files needed */
[hidden] { display: none !important; }
:root {
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1f2333;
  --muted: #6b7084;
  --line: #e3e5ee;
  --primary: #5b3fd6;
  --primary-dark: #4a31b8;
  --success: #128a5c;
  --danger: #c8333b;
  --warning: #b7791f;
  --sidebar: #1d1f2e;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.inline { display: inline; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ---------- Layout ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: .08em; color: var(--text); display: inline-flex; align-items: center; }
.brand img { height: 22px; width: auto; display: block; }
@media (max-width: 480px) { .brand img { height: 18px; } }
.brand:hover { text-decoration: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { font-size: .85rem; color: var(--muted); padding: 0 6px; }
.menu-btn { display: block; background: none; border: 0; font-size: 1.4rem; cursor: pointer; padding: 4px 8px; }
.sidebar {
  position: fixed; top: 56px; bottom: 0; left: 0; width: 220px; overflow-y: auto; z-index: 25;
  background: var(--sidebar); padding: 10px 8px;
}
.nav-link { display: flex; align-items: center; gap: 10px; color: #c9cbe0; padding: 9px 12px; border-radius: 8px; font-size: .93rem; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }
.ico { width: 22px; text-align: center; }
.nav-backdrop { display: none; }
.content { margin-left: 220px; padding: 76px 22px 40px; }
.content-full { padding: 20px; }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,.35); z-index: 20; }
  .content { margin-left: 0; padding: 70px 12px 40px; }
  .hide-sm { display: none !important; }
}

/* ---------- Components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.stat { border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); background: var(--card); }
.stat .val { font-size: 1.45rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: .88rem; }
.stat.c1 { background: #efeaff; } .stat.c2 { background: #e6f6ef; } .stat.c3 { background: #fdecee; } .stat.c4 { background: #fff6e0; }
.stat.c5 { background: #e5f4fb; } .stat.c6 { background: #f1f1f5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600;
  cursor: pointer; background: var(--line); color: var(--text); text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; filter: brightness(.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #fff; border-color: var(--line); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: #e8f7f0; border-color: #a8dfc6; color: #0d5e3f; }
.alert-error { background: #fdecee; border-color: #f2b7bc; color: #8e1d24; }
.alert-warning { background: #fff6e0; border-color: #f0d79a; color: #7a5310; }
.alert-info { background: #ecf1ff; border-color: #bdccf6; color: #26408b; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--line); }
.badge-danger { background: #fdecee; color: var(--danger); }
.badge-success { background: #e6f6ef; color: var(--success); }
.badge-warning { background: #fff6e0; color: var(--warning); }

/* ---------- Forms ---------- */
.form label, label.field { display: block; margin-bottom: 12px; font-size: .9rem; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=email], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-weight: 400;
  border: 1px solid #cfd2de; border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c9bdf7; border-color: var(--primary); }
textarea { min-height: 70px; resize: vertical; }
.narrow { max-width: 520px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.checkbox { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.checkbox input { width: auto; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; margin-top: 0; }
.filters label { font-size: .8rem; font-weight: 600; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfd; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:hover td { background: #fafaff; }
tfoot td { font-weight: 700; background: #fafbfd; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 14px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
/* Login page */
body.login-page { background: #ececec; background-image: radial-gradient(circle at 15% 20%, #ffffff 0, transparent 45%), radial-gradient(circle at 85% 90%, #dcdcdc 0, transparent 40%); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-panel { width: 100%; max-width: 880px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06); }
.login-side { position: relative; background: #0d0d0d; color: #fff; padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; min-height: 460px; overflow: hidden; }
.login-side::before { content: ""; position: absolute; right: -90px; bottom: -90px; width: 300px; height: 300px; background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,.06) 50%); }
.login-side::after { content: ""; position: absolute; left: -60px; top: -60px; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.08); transform: rotate(30deg); }
.login-logo-side { width: 100%; max-width: 260px; height: auto; position: relative; }
.login-tag { margin: 22px 0 0; font-size: .95rem; letter-spacing: .32em; text-transform: uppercase; color: rgba(255,255,255,.75); position: relative; }
.login-foot { position: absolute; left: 40px; bottom: 26px; margin: 0; font-size: .78rem; letter-spacing: .12em; color: rgba(255,255,255,.4); }
.login-form { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-form label { margin-bottom: 14px; }
.login-logo { display: none; width: 150px; height: auto; margin: 0 auto 22px; }
.login-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.login-sub { margin: 4px 0 22px; }
.login-form input[type=text], .login-form input[type=password] { padding: 11px 12px; font-size: 1rem; border-radius: 9px; }
.login-form input:focus { border-color: #111; box-shadow: 0 0 0 3px rgba(0,0,0,.1); outline: none; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: .82rem; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.pw-eye:hover { background: #f1f1f1; color: #111; }
.login-btn { margin-top: 8px; background: #111; color: #fff; border: 0; padding: 12px; font-size: 1rem; font-weight: 700; border-radius: 9px; letter-spacing: .02em; }
.login-btn:hover { background: #2b2b2b; color: #fff; }
.login-copy { text-align: center; margin: 22px 0 0; }
@media (max-width: 760px) {
  .login-panel { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
  .login-side { display: none; }
  .login-logo { display: block; }
  .login-form { padding: 36px 26px; }
  .login-title, .login-sub { text-align: center; }
}

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .pos { grid-template-columns: 1fr; } }
.search-box { position: relative; }
.search-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 15; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.1); max-height: 320px; overflow-y: auto; display: none;
}
.search-results.open { display: block; }
.search-results button {
  display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; cursor: pointer; font: inherit; text-align: left;
}
.search-results button:hover, .search-results button.hl { background: #f1edff; }
.items-table input { margin: 0; padding: 6px 8px; min-width: 70px; }
.items-table td { padding: 6px 8px; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { font-size: 1.3rem; font-weight: 800; border-top: 2px solid var(--line); padding-top: 10px; }
.remove-row { background: none; border: 0; color: var(--danger); font-size: 1.2rem; cursor: pointer; }

/* ---------- Charts ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 200px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.bar-chart .bar { flex: 1; background: linear-gradient(#8b6ff0, var(--primary)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar-chart .bar:hover { background: #3b259c; }
.bar-labels { display: flex; gap: 3px; font-size: .68rem; color: var(--muted); }
.bar-labels span { flex: 1; text-align: left; overflow: visible; white-space: nowrap; }

/* ---------- Invoice / print ---------- */
.invoice { max-width: 820px; }
.invoice-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
@media print {
  .topbar, .sidebar, .no-print, .nav-backdrop, .alert { display: none !important; }
  .content { margin: 0; padding: 0; }
  body { background: #fff; font-size: 13px; }
  .card { border: 0; padding: 0; }
}
a.stat { display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--primary); }

/* ---------- v2: menu groups ---------- */
.nav-group summary { cursor: pointer; list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '▸'; margin-left: auto; font-size: .8rem; opacity: .7; }
.nav-group[open] summary::after { content: '▾'; }
.nav-sub { padding: 7px 12px 7px 44px; font-size: .88rem; }
.btn-warning { background: #f0a020; color: #fff; }

/* ---------- v2: product form ---------- */
.product-top { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.image-box { width: 150px; text-align: center; }
.image-drop { display: flex !important; align-items: center; justify-content: center; width: 150px; height: 150px; margin: 0 0 6px !important;
  border: 2px dashed #f0a020; border-radius: 10px; cursor: pointer; overflow: hidden; color: var(--muted); font-weight: 400 !important; text-align: center; background: #fffaf0; }
.image-drop img { width: 100%; height: 100%; object-fit: cover; }
.type-switch { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px; background: #f7f7fb; border-radius: 8px; }
.type-switch .checkbox { margin: 0; }
.field-block { margin-bottom: 12px; }
.field-title { font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { display: inline-flex !important; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #cfd2de; border-radius: 99px;
  background: #fff; cursor: pointer; font-weight: 500 !important; font-size: .88rem; margin: 0 !important; user-select: none; }
.chip:has(input:checked) { background: #e6f6ef; border-color: var(--success); color: #0d5e3f; }
.chip input { margin: 0; width: auto; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); display: inline-block; }
.color-input { width: 48px !important; height: 36px; padding: 2px !important; min-width: 0 !important; }
#variant-picker { padding: 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.apply-all { margin: 6px 0 14px; }
.apply-grid { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)) auto; gap: 8px; }
.apply-grid input { margin: 0; }
@media (max-width: 900px) { .apply-grid { grid-template-columns: repeat(2, 1fr); } }
.variant-table input { margin: 0; padding: 6px 7px; min-width: 80px; }
.variant-table input[name="v_sort[]"] { min-width: 50px; width: 60px; }
.variant-table input.bc { min-width: 120px; border-color: #7cc79f; }
.variant-table td { padding: 6px 5px; }
.variant-table th { font-size: .72rem; }
tbody.simple .remove-row { visibility: hidden; }

/* ---------- v2: product list / view ---------- */
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: #f1f1f5; }
.thumb-empty { font-size: 1.3rem; opacity: .5; }
.product-table td.lines div { padding: 2px 0; white-space: nowrap; }
.product-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.product-photo { width: 140px; height: 140px; object-fit: cover; border-radius: 10px; }
tr.muted td { color: var(--muted); }

/* ---------- v2: barcode labels 50 x 30 mm ---------- */
.labels { display: flex; flex-wrap: wrap; gap: 6px; }
.label {
  width: 50mm; height: 30mm; padding: 1.2mm 2mm; background: #fff; color: #000; border: 1px dashed #bbb;
  display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  font-family: Arial, sans-serif; text-align: center; line-height: 1.1;
}
.label .l-shop { font-size: 7.5pt; font-weight: 700; letter-spacing: .08em; }
.label .l-name { font-size: 6.5pt; max-height: 2.3em; overflow: hidden; }
.label .l-meta { font-size: 6pt; }
.label .l-bars { width: 100%; height: 9mm; margin: .5mm 0 0; }
.label .l-bars svg { width: 100%; height: 100%; display: block; }
.label .l-num { font-size: 7pt; letter-spacing: .06em; }
.label .l-price { font-size: 8.5pt; }
.label .l-price s { font-size: 6.5pt; color: #333; }
@media print {
  body.barcode-page { background: #fff; margin: 0; }
  body.barcode-page .content { padding: 0 !important; margin: 0 !important; max-width: none; }
  body.barcode-page .labels { display: block; gap: 0; }
  body.barcode-page .label { border: 0; page-break-after: always; break-after: page; margin: 0; }
  body.barcode-page .label:last-child { page-break-after: auto; break-after: auto; }
}
.filters input[type=checkbox] { min-width: 0; width: auto; }
.product-table td:nth-child(3) { min-width: 190px; }

/* ---------- v4: Orders ---------- */
.badge-info { background: #e5f4fb; color: #1b6d93; }
.badge-primary { background: #efeaff; color: var(--primary); }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.round-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.4rem; flex: none; }
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20,22,35,.45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 1100px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin: -4px 0 14px; padding-bottom: 10px; }
.modal-head h3 { margin: 0; }
.modal-x { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.vm-list { display: flex; flex-direction: column; gap: 6px; }
.vm-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; text-align: left; }
.vm-item:hover { background: #f1edff; border-color: var(--primary); }

body.fullscreen .sidebar { display: none; }
body.fullscreen .menu-btn { display: block; }
body.fullscreen.nav-open .sidebar { display: block; transform: none; }
body.fullscreen .content { margin-left: 0; padding-top: 66px; }
.order-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 12px; height: calc(100vh - 80px); }
@media (max-width: 1000px) { .order-screen { grid-template-columns: 1fr; height: auto; } }
.op-left, .op-right { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.op-filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.op-filters input, .op-filters select { margin: 0; }
@media (max-width: 640px) { .op-filters { grid-template-columns: 1fr; } }
.op-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 10px; align-content: start; }
.op-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: #f8f8fc; padding: 0; overflow: hidden; cursor: pointer; font: inherit; text-align: center; }
.op-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(91,63,214,.15); }
.op-card img, .op-noimg { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #ececf3; display: flex; align-items: center; justify-content: center; font-size: 2rem; opacity: .9; }
.op-name { font-size: .8rem; padding: 6px 6px 0; line-height: 1.25; height: 2.6em; overflow: hidden; }
.op-stock { font-size: .78rem; padding: 2px 6px 7px; color: var(--muted); }
.op-more { text-align: center; padding: 6px; }
.op-head { display: flex; gap: 12px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cust-box { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 260px; }
.cust-box input { margin: 0; }
.cust-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #a8dfc6; background: #e8f7f0; border-radius: 8px; padding: 8px 10px; }
.cust-chip button { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--danger); }
.op-cart { flex: 1; overflow-y: auto; padding: 0 6px; }
.op-cart td input { margin: 0; padding: 6px; }
.qty-box { display: flex; align-items: center; }
.qty-box button { width: 30px; height: 34px; border: 0; color: #fff; font-size: 1.1rem; cursor: pointer; }
.qty-box .q-minus { background: var(--danger); border-radius: 6px 0 0 6px; }
.qty-box .q-plus { background: var(--success); border-radius: 0 6px 6px 0; }
.qty-box input { width: 56px; text-align: center; border-radius: 0 !important; min-width: 0 !important; }
.op-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; padding: 8px 14px; background: #faf7ef; border-top: 1px solid var(--line); font-size: .92rem; }
.op-summary div { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px dashed #e3dcc8; }
.op-summary input { width: 110px; margin: 0; padding: 4px 8px; text-align: right; }
.op-payable { grid-column: 1 / -1; font-size: 1.1rem; font-weight: 700; border-bottom: 0 !important; }
.op-actions { display: flex; gap: 8px; align-items: center; padding: 10px; background: var(--sidebar); border-radius: 0 0 var(--radius) var(--radius); }
.op-total { color: #fff; font-size: 1.5rem; font-weight: 800; margin-right: auto; }
.pay-box { max-width: 1150px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; }
@media (max-width: 900px) { .pay-grid { grid-template-columns: 1fr; } }
.pay-summary th { text-align: right; font-size: .85rem; text-transform: none; letter-spacing: 0; color: var(--text); width: 42%; background: #fafbfd; }
.pay-summary td { text-align: right; }
.pay-summary td input, .pay-summary td textarea { margin: 0; text-align: left; }
.pay-total-banner { background: var(--sidebar); color: #fff; text-align: center; font-size: 1.5rem; font-weight: 800; padding: 12px; border-radius: 8px; margin-bottom: 10px; }
.pay-form td { padding: 5px; }
.pay-form select, .pay-form input { margin: 0; }
.pay-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 10px; }
.pay-fields label { font-size: .88rem; font-weight: 600; margin-bottom: 8px; }
.pay-fields input[readonly] { background: #f1f1f5; }
.pay-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.pay-buttons .btn { min-width: 150px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 8px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .9rem; }
.tab:hover { text-decoration: none; border-color: var(--primary); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 99px; background: rgba(0,0,0,.08); font-size: .78rem; text-align: center; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .order-layout { grid-template-columns: minmax(0, 1fr); } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
@media print { .order-layout { display: block; } }

/* ---------- v5: order list ---------- */
.badge-dark { background: #2e3140; color: #fff; }
.badge-purple { background: #f3e8ff; color: #7b2cbf; }
.btn-info { background: #1fa2d8; color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.order-filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.order-filters input, .order-filters select { margin: 0; }
.order-filters .date-range { grid-column: span 2; display: flex; align-items: center; gap: 0; }
.order-filters .date-range span { background: #1fa2d8; color: #fff; padding: 9px 8px; font-size: .85rem; }
.order-filters .wide { grid-column: span 2; }
.order-filters .filter-buttons { display: flex; gap: 8px; }
@media (max-width: 1100px) { .order-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bulk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.bulk-bar select { width: auto; min-width: 230px; margin: 0; }
.export-btns { margin-left: auto; display: flex; gap: 6px; }
.order-table th, .order-table td { padding: 7px 6px; font-size: .86rem; }
.order-table thead th { background: #17915f; color: #fff; }
.order-table input[type=checkbox] { width: 16px; height: 16px; }
.remark-cell { max-width: 180px; }
.row-menu { position: relative; }
.row-menu summary { list-style: none; cursor: pointer; white-space: nowrap; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu .menu { position: fixed; z-index: 40; max-width: calc(100vw - 16px); max-height: 70vh; overflow-y: auto; min-width: 220px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px 0; }
.row-menu .menu a, .row-menu .menu button { display: block; width: 100%; text-align: left; padding: 7px 16px; color: var(--text); background: none; border: 0; font: inherit; font-size: .88rem; cursor: pointer; }
.row-menu .menu a:hover, .row-menu .menu button:hover { background: #f1edff; text-decoration: none; }
@media print {
  .order-table thead th { background: #eee !important; color: #000; }
  .orders-wrap { overflow: visible; }
}
.ex-box { margin: 10px 6px; padding: 10px 12px; border: 1px dashed #1fa2d8; border-radius: 8px; background: #eef8fd; }
.ex-head { display: flex; justify-content: space-between; align-items: center; }
.ex-credit { margin-top: 6px; }
.ex-sale { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.ex-sale-head { background: #f7f7fb; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.ex-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 12px; }
.ex-line input { width: 80px; margin: 0; }

/* ---------- v5.1: full-width order list, no sideways scrolling ---------- */
body.fullscreen .nav-backdrop { display: none; }
body.fullscreen.nav-open .nav-backdrop { display: block; position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,.35); z-index: 20; }
.order-table { table-layout: auto; }
.order-table td { vertical-align: top; }
.order-table .cust-cell { min-width: 120px; max-width: 200px; overflow-wrap: anywhere; }
.order-table .remark-cell { min-width: 90px; max-width: 170px; overflow-wrap: anywhere; }
.order-table th, .order-table td { padding: 7px 5px; }
.order-table .order-cell { min-width: 110px; max-width: 190px; }
@media (min-width: 901px) { .content { padding-left: 16px; padding-right: 16px; } }

/* ---------- v5.2: order list on tablets & phones: each order becomes a card ---------- */
@media (max-width: 1100px) {
  .order-table thead { display: none; }
  .order-table, .order-table tbody, .order-table tr, .order-table td, .order-table tfoot { display: block; width: 100%; }
  .order-table tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px 10px; background: #fff; position: relative; }
  .order-table td { border: 0; padding: 3px 0; text-align: left !important; max-width: none !important; }
  .order-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 86px; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  .order-table td.num div, .order-table td.num b { display: inline; margin-left: 6px; }
  .order-table td:first-child { position: absolute; right: 10px; top: 8px; width: auto; }
  .order-table td.cust-cell div, .order-table td.order-cell div { display: inline; margin-left: 6px; }
  .order-table tfoot tr { background: #fafbfd; }
  .order-table tfoot td:empty { display: none; }
  .bulk-bar .export-btns { margin-left: 0; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .order-table tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .order-table tr { margin-bottom: 0; }
}
.order-filters .date-range input { min-width: 0; flex: 1; }
@media (max-width: 640px) { .order-filters .date-range, .order-filters .wide { grid-column: 1 / -1; } }
/* ---------- v6: supplier pay ---------- */
.pay-table input[type=number] { margin: 0; padding: 6px 8px; }
.pay-bottom { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; align-items: flex-start; }
.pay-side { flex: 1; min-width: 300px; max-width: 560px; margin-left: auto; }
.pay-line { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 600; font-size: .9rem; }
.pay-line input, .pay-line select { margin: 0; }
.pay-line input[readonly] { background: #f1f1f5; }
/* ---------- v7: purchase ---------- */
.pf-table input { margin: 0; padding: 6px 7px; min-width: 60px; }
.pay-row { display: flex; gap: 6px; margin-bottom: 6px; }
.pay-row select { width: 120px; margin: 0; }
.pay-row input { margin: 0; flex: 1; min-width: 80px; }
.pay-side { min-width: 0; }
@media (max-width: 760px) {
  .pf-table thead { display: none; }
  .pf-table, .pf-table tbody, .pf-table tr, .pf-table td { display: block; width: 100%; }
  .pf-table tr { position: relative; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
  .pf-table td { border: 0; padding: 4px 0; }
  .pf-table td.r-sl { display: none; }
  .pf-table td.r-name { padding-right: 34px; font-weight: 600; }
  .pf-table td[data-l] { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: right; }
  .pf-table td[data-l]::before { content: attr(data-l); font-size: .85rem; color: var(--muted, #6b7280); text-align: left; }
  .pf-table td[data-l] > input, .pf-table td[data-l] > .qty-box { max-width: 170px; }
  .pf-table td.r-del { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  .pay-line { grid-template-columns: 105px minmax(0, 1fr); }
  #pf-pays { min-width: 0; }
  .pay-row input { min-width: 50px; }
  .pay-bottom > div:first-child:empty { display: none; }
  .pay-row select { width: 92px; }
  .pay-row .btn-sm { padding-left: 8px; padding-right: 8px; }
}
/* ---------- v8: inventory / branches ---------- */
.text-warning { color: var(--warning, #b7791f); }
.branch-switch select { margin: 0; padding: 5px 8px; font-size: .85rem; font-weight: 600; max-width: 190px; }
.lf-table input, .lf-table select { margin: 0; padding: 6px 7px; }
.stock-table .thumb { width: 38px; height: 38px; }
@media (max-width: 760px) {
  .lf-table thead { display: none; }
  .lf-table, .lf-table tbody, .lf-table tr, .lf-table td, .lf-table tfoot { display: block; width: 100%; }
  .lf-table tbody tr { position: relative; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
  .lf-table td { border: 0; padding: 4px 0; }
  .lf-table td.lf-name { padding-right: 34px; font-weight: 600; }
  .lf-table td[data-l] { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .lf-table td[data-l]::before { content: attr(data-l); font-size: .85rem; color: var(--muted, #6b7280); }
  .lf-table td[data-l] > input, .lf-table td[data-l] > select { max-width: 170px; }
  .lf-table td.lf-del { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  .lf-table tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .lf-table tfoot td { width: auto; }
  .branch-switch select { max-width: 130px; }
}
@media print { .sign-row { page-break-inside: avoid; } }
.topbar-actions .btn { white-space: nowrap; }
@media (max-width: 480px) {
  .hide-xs { display: none !important; }
  .branch-switch select { max-width: 120px; font-size: .8rem; padding: 5px 4px; }
}
/* ---------- v9: POS ---------- */
.pos-screen .op-filters { grid-template-columns: 1fr 1fr auto; align-items: center; }
.pos-branch { white-space: nowrap; }
.pos-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 8px; }
.pos-head .cust-box { display: flex; gap: 6px; align-items: center; min-width: 0; }
.pos-head input { margin: 0; }
@media (max-width: 640px) { .pos-head { grid-template-columns: minmax(0, 1fr); } .pos-screen .op-filters { grid-template-columns: 1fr 1fr; } .pos-branch { grid-column: 1 / -1; } }
.disc-box { display: flex; gap: 4px; }
.disc-box select { margin: 0; padding: 4px 6px; width: auto; font-size: .85rem; }
.disc-box input { width: 90px !important; }
.vm-item[disabled] { opacity: .5; cursor: not-allowed; }
.inv-preview { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.inv-title { text-align: center; color: var(--primary); background: #f1effc; border-radius: 8px; padding: 8px; margin: 0 0 10px; }
.pv-table { width: 100%; margin: 8px 0; font-size: .85rem; }
.pv-table th, .pv-table td { padding: 4px 6px; }
.op-actions .badge { background: var(--primary); color: #fff; }
@media (max-width: 640px) { .op-actions { flex-wrap: wrap; } .op-total { width: 100%; font-size: 1.2rem; } .op-actions .btn-lg { flex: 1; } }
.pos-screen > section { min-width: 0; }
@media (max-width: 1000px) {
  .pos-screen .op-right { order: -1; }
  .pos-screen .op-grid { max-height: 60vh; }
}
@media (max-width: 640px) {
  .pos-screen .op-summary { grid-template-columns: minmax(0, 1fr); }
  .pos-screen .op-summary > div:empty { display: none; }
  .pos-cart th:nth-child(2), .pos-cart td:nth-child(2) { width: 80px !important; }
  .pos-cart .c-price { width: 72px; }
  .pos-cart .qty-box input { width: 42px; }
}
.pos-screen .op-total { white-space: nowrap; font-size: 1.3rem; }
.pos-screen .op-actions .btn { white-space: nowrap; }
/* ---------- v9.1: POS full screen + stock out ---------- */
body.pos-page .content { padding: 62px 8px 8px; }
body.pos-page .content > .alert { margin-bottom: 6px; }
body.pos-page .order-screen { height: calc(100vh - 72px); }
:fullscreen body.pos-page .order-screen, body.pos-page:fullscreen .order-screen { height: calc(100vh - 72px); }
@media (max-width: 1000px) { body.pos-page .order-screen { height: auto; } }
.op-card { position: relative; }
.op-card.out { opacity: .55; }
.out-tag { position: absolute; top: 8px; left: 8px; background: #e53e3e; color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.vm-item.out { opacity: .55; }
.pos-toast { position: fixed; top: 70px; right: 16px; z-index: 80; background: #f56565; color: #fff; font-weight: 700; padding: 14px 20px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 360px; }
/* ---------- v10: POS exchange ---------- */
.ex-panel { border-bottom: 2px solid #b6d4fe; background: #eef6ff; padding: 8px 10px; }
.ex-panel-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: .9rem; margin-bottom: 6px; }
.ex-panel table td { padding: 4px 6px; }
.ex-panel input { margin: 0; padding: 4px 6px; }
.ex-panel .ex-credit { text-align: right; font-size: .95rem; padding-top: 4px; }
/* ---------- v12: courier fraud checker ---------- */
.fc-badge { display: inline-block; margin-top: 4px; border: 0; border-radius: 99px; padding: 2px 9px; font-size: .78rem; font-weight: 700; cursor: pointer; background: #edf2f7; color: #4a5568; white-space: nowrap; }
.fc-good { background: #c6f6d5 !important; color: #22543d !important; }
.fc-mid { background: #fefcbf !important; color: #744210 !important; }
.fc-bad { background: #fed7d7 !important; color: #9b2c2c !important; }
.fc-new { background: #e2e8f0 !important; color: #4a5568 !important; }
.fc-err { background: #fff5f5 !important; color: #c53030 !important; }
.fc-pill { display: inline-block; border-radius: 99px; padding: 1px 8px; font-weight: 700; font-size: .82rem; }
.fc-pill.big { font-size: 1.15rem; padding: 4px 12px; }
.fc-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fc-table td, .fc-table th { padding: 6px 8px; }
.fc-own { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #f7fafc; font-size: .9rem; }
.fc-set { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 8px 12px 10px; margin: 10px 0; }
.fc-set legend { font-weight: 700; padding: 0 6px; }
.fc-box { min-height: 0; }
@media (max-width: 600px) {
  .fc-table thead { display: none; }
  .fc-table, .fc-table tbody, .fc-table tr, .fc-table td { display: block; width: 100%; }
  .fc-table tr { border: 1px solid var(--line, #e5e7eb); border-radius: 8px; margin-bottom: 8px; padding: 4px 0; }
  .fc-table td { border: 0 !important; padding: 3px 10px; text-align: left !important; }
  .fc-table td[data-label] { display: flex; justify-content: space-between; gap: 10px; }
  .fc-table td[data-label]::before { content: attr(data-label); color: #6b7280; font-size: .85rem; }
  .fc-table td.fc-empty { display: none; }
}
/* Branch Stock */
.bs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin-bottom: 16px; }
.bs-card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.bs-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bs-card-head h3 { margin: 0; }
.bs-bar { height: 6px; border-radius: 6px; background: #eef0f4; overflow: hidden; }
.bs-bar span { display: block; height: 100%; background: #6d4aff; }
.bs-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bs-nums div { background: #f7f8fb; border-radius: 8px; padding: 8px; text-align: center; }
.bs-nums b { display: block; font-size: 1.25rem; }
.bs-nums span { font-size: .75rem; color: #6b7280; }
.bs-money { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: .88rem; color: #4b5563; }
.bs-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; }
.bs-card > .btn { align-self: flex-start; margin-top: auto; }
.bs-q { display: inline-block; min-width: 2.2em; padding: 2px 8px; border-radius: 999px; font-weight: 700; text-align: center; }
.bs-ok { background: #e7f6ec; color: #17733a; }
.bs-low { background: #fff4d6; color: #8a5a00; }
.bs-zero { background: #fde8e8; color: #b42318; }
.bs-transit { background: #e8efff; color: #2f4fb5; }
.bs-name { display: flex; align-items: center; gap: 10px; min-width: 200px; }
@media (max-width: 700px) {
  .bs-table thead { display: none; }
  .bs-table, .bs-table tbody, .bs-table tfoot, .bs-table tr, .bs-table td { display: block; width: 100%; }
  .bs-table tr { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; margin-bottom: 10px; padding: 6px 0; }
  .bs-table td { border: 0 !important; padding: 4px 12px; text-align: left !important; }
  .bs-table td:first-child { display: none; }
  .bs-table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .bs-table td[data-label]::before { content: attr(data-label); color: #6b7280; font-size: .88rem; }
  .bs-table tfoot td.right { text-align: left !important; }
  .bs-name { min-width: 0; }
}
/* Expenses */
.exp-mini { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .9rem; border-bottom: 1px dashed #eceef3; }
.exp-mini:last-child { border-bottom: 0; }
.exp-mini span { min-width: 0; overflow-wrap: anywhere; }
.stat .exp-mini { font-size: .85rem; }
.exp-presets { margin-top: -4px; }
.exp-due h3 { margin: 0 0 8px; }
.exp-due-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid #f0f1f5; }
.exp-rejected td { opacity: .65; }
.exp-approve { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.exp-reject { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.exp-reject input { min-width: 200px; }
.exp-receipt { max-width: 100%; max-height: 480px; border: 1px solid var(--line); border-radius: 8px; }
.exp-heads .exp-head-main td { background: #f8f7ff; }
.exp-sub { padding-left: 26px !important; }
.exp-head-edit form { padding: 6px 12px; }
.exp-head-edit label { display: block; font-size: .85rem; margin-bottom: 6px; }
.exp-head-edit input, .exp-head-edit select { width: 100%; }
.voucher { max-width: 760px; }
.voucher-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid #222; padding-bottom: 10px; margin-bottom: 12px; }
.voucher-head h2, .voucher-head h3 { margin: 0; }
.voucher-table { width: 100%; }
.voucher-table th { width: 30%; text-align: left; color: #555; font-weight: 600; }
.voucher-table th, .voucher-table td { padding: 8px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
.voucher-amount td { font-size: 1.3rem; }
.voucher-sign { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 46px 0 10px; text-align: center; font-size: .85rem; color: #555; }
.voucher-sign div { border-top: 1px solid #333; padding-top: 4px; }
.voucher-sign span { display: block; color: #111; font-weight: 600; margin-top: -26px; height: 22px; }
.exp-channel td, .exp-channel th { white-space: nowrap; }
.exp-profit td { border-top: 2px solid #ddd; background: #fafbff; }
.exp-headrow { border-bottom: 1px solid #f0f1f5; padding: 6px 0; }
.exp-headrow summary { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; cursor: pointer; list-style: none; }
.exp-headrow summary::-webkit-details-marker { display: none; }
.exp-hn { overflow-wrap: anywhere; }
.exp-hbar { height: 8px; background: #eef0f4; border-radius: 6px; overflow: hidden; }
.exp-hbar span { display: block; height: 100%; background: #e2556a; }
.exp-hv { text-align: right; white-space: nowrap; }
.exp-subrow { padding-left: 14px; color: #4b5563; }
.exp-trend { display: flex; align-items: flex-end; gap: 6px; height: 130px; margin-bottom: 26px; padding-top: 6px; }
.exp-tcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.exp-tbar { width: 70%; background: #e2556a; border-radius: 4px 4px 0 0; min-height: 2px; }
.exp-tcol span { position: absolute; bottom: -20px; font-size: .72rem; color: #6b7280; white-space: nowrap; }
@media (max-width: 700px) {
  .exp-table thead, .exp-month thead, .exp-channel thead { display: none; }
  .exp-table, .exp-table tbody, .exp-table tfoot, .exp-table tr, .exp-table td,
  .exp-month, .exp-month tbody, .exp-month tfoot, .exp-month tr, .exp-month td,
  .exp-channel, .exp-channel tbody, .exp-channel tr, .exp-channel td { display: block; width: 100%; }
  .exp-table tr, .exp-month tr, .exp-channel tr { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; margin-bottom: 10px; padding: 6px 0; }
  .exp-table td, .exp-month td, .exp-channel td { border: 0 !important; padding: 3px 12px; text-align: left !important; white-space: normal; }
  .exp-table td[data-label], .exp-month td[data-label], .exp-channel td[data-label] { display: flex; justify-content: space-between; gap: 12px; }
  .exp-table td[data-label] > *:not(:first-child) { text-align: right; }
  .exp-table td[data-label]::before, .exp-month td[data-label]::before, .exp-channel td[data-label]::before { content: attr(data-label); color: #6b7280; font-size: .85rem; flex: 0 0 auto; }
  .exp-table td:empty { display: none; }
  .exp-table tfoot td.right { text-align: left !important; }
  .exp-month td:first-child, .exp-channel td:first-child { font-weight: 700; }
  .voucher-sign { gap: 8px; }
}
@media print {
  .voucher { max-width: none; border: 0; box-shadow: none; }
}
/* Reports */
.rp-group { margin: 22px 0 10px; font-size: 1.05rem; color: #4b5563; text-transform: uppercase; letter-spacing: .04em; }
.rp-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.rp-card { display: flex; gap: 12px; align-items: flex-start; margin: 0; color: inherit; transition: box-shadow .15s, transform .15s; }
.rp-card:hover { text-decoration: none; box-shadow: 0 6px 18px rgba(30, 20, 80, .1); transform: translateY(-1px); }
.rp-card b { display: block; margin-bottom: 3px; color: var(--text, #111); }
.rp-icon { font-size: 1.6rem; line-height: 1; flex: 0 0 auto; }
.rp-filters { align-items: flex-end; }
.rp-presets { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.rp-period { margin: 4px 0 12px; }
.rp-kpis { margin-bottom: 16px; }
.rp-kpis .stat .val { overflow-wrap: anywhere; }
.rp-block + .rp-block { margin-top: 18px; }
.rp-block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rp-block-head h2 { margin: 0; }
.rp-table th.rp-sortable { cursor: pointer; user-select: none; }
.rp-table th.rp-sortable:hover { color: var(--primary, #6d4aff); }
.rp-table th[data-dir="desc"]::after { content: ' ▼'; font-size: .7em; }
.rp-table th[data-dir="asc"]::after { content: ' ▲'; font-size: .7em; }
.rp-table td { vertical-align: top; }
.rp-hbar { display: inline-block; width: 90px; height: 8px; border-radius: 6px; background: #eef0f4; overflow: hidden; vertical-align: middle; }
.rp-hbar i { display: block; height: 100%; background: #6d4aff; }
.rp-chart-wrap { margin-bottom: 14px; }
.rp-chart-title { font-weight: 700; margin-bottom: 6px; }
.rp-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: #4b5563; margin-bottom: 6px; }
.rp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rp-chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-bottom: 22px; border-bottom: 1px solid #e5e7eb; }
.rp-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 0; }
.rp-stack { display: flex; flex-direction: column-reverse; width: 100%; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 1px; }
.rp-x { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: #6b7280; white-space: nowrap; }
.rp-s0 { background: #6d4aff; }
.rp-s1 { background: #f2a33a; }
.rp-s2 { background: #2bb673; }
@media (max-width: 700px) {
  .rp-table thead { display: none; }
  .rp-table, .rp-table tbody, .rp-table tfoot, .rp-table tr, .rp-table td { display: block; width: 100%; }
  .rp-table tr { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; margin-bottom: 10px; padding: 6px 0; }
  .rp-table td { border: 0 !important; padding: 3px 12px; text-align: left !important; }
  .rp-table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .rp-table td[data-label]::before { content: attr(data-label); color: #6b7280; font-size: .84rem; flex: 0 0 auto; max-width: 50%; }
  .rp-table td[data-label] > *:last-child { text-align: right; }
  .rp-table td[data-label=""]::before, .rp-table td[data-label="#"] { display: none; }
  .rp-table td:empty, .rp-table tfoot td:empty { display: none; }
  .rp-table td.empty { display: block; }
  .rp-table tr td:nth-child(2):not(.num) { font-weight: 600; }
  .rp-chart { gap: 1px; height: 120px; }
  .rp-x { font-size: .6rem; }
}
@media print {
  .rp-hbar { border: 1px solid #ccc; }
  .rp-table td, .rp-table th { font-size: 10px; padding: 3px 4px; }
  .rp-kpis { grid-template-columns: repeat(4, 1fr) !important; }
}
/* Corporate orders */
.corp-sub { margin: -6px 0 12px; }
.corp-new { background: #f8f7ff; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.corp-items td { vertical-align: top; }
.corp-items .corp-item { min-width: 260px; }
.corp-items select, .corp-items input[type="text"], .corp-items input[type="search"] { width: 100%; margin-bottom: 4px; }
.corp-num { width: 90px; text-align: right; }
.corp-search { position: relative; }
.corp-results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow: auto; }
.corp-res { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-bottom: 1px solid #f0f1f5; background: #fff; cursor: pointer; }
.corp-res:hover { background: #f5f3ff; }
.corp-res span { display: block; }
.corp-charge { display: flex; gap: 6px; margin-bottom: 6px; }
.corp-charge input[type="text"] { flex: 1; min-width: 0; }
.corp-totals .exp-mini { align-items: center; padding: 6px 0; }
.corp-totals input { width: 110px; text-align: right; }
.corp-totals .corp-vat { width: 70px; }
.corp-grand { font-size: 1.15rem; border-top: 2px solid #222 !important; margin-top: 4px; }
.corp-margin { background: #f6fbf8; border-radius: 10px; padding: 8px 12px; margin: 12px 0; }
.corp-steps { display: flex; list-style: none; padding: 0; margin: 0 0 14px; counter-reset: s; flex-wrap: wrap; gap: 4px; }
.corp-steps li { flex: 1; min-width: 110px; padding: 8px 10px; background: #eef0f4; color: #6b7280; font-size: .85rem; font-weight: 600; border-radius: 8px; counter-increment: s; }
.corp-steps li::before { content: counter(s) '. '; }
.corp-steps li.done { background: #e7f6ec; color: #17733a; }
.corp-steps li.now { background: var(--primary, #6d4aff); color: #fff; }
.corp-main > div > .card { margin-bottom: 16px; }
.corp-sum { margin-left: auto; max-width: 360px; margin-top: 8px; }
.corp-act { margin-top: 10px; }
.corp-act > summary { list-style: none; display: inline-block; }
.corp-act > summary::-webkit-details-marker { display: none; }
.corp-act form { margin-top: 8px; }
.corp-stack { margin: 10px 0; }
.corp-stack label { display: block; margin-bottom: 6px; }
.corp-next .inline { display: inline-block; margin: 4px 4px 4px 0; }
.corp-files { display: grid; gap: 8px; margin-bottom: 10px; }
.corp-file { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; }
.corp-file img, .corp-pdf { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #b42318; background: #fff5f5; }
.corp-log { list-style: none; padding: 0; margin: 8px 0 0; max-height: 420px; overflow: auto; }
.corp-log li { padding: 6px 0; border-bottom: 1px solid #f0f1f5; font-size: .9rem; }
.corp-remind h3 { margin: 0 0 8px; }
.corp-remind a { display: block; padding: 5px 0; border-bottom: 1px dashed #eceef3; color: inherit; font-size: .9rem; }
@media (max-width: 700px) {
  .corp-items thead { display: none; }
  .corp-items, .corp-items tbody, .corp-items tr, .corp-items td { display: block; width: 100%; }
  .corp-items tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px; }
  .corp-items td { border: 0 !important; padding: 3px 0; text-align: left !important; }
  .corp-items td[data-label]:not(.corp-item) { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .corp-items td[data-label]:not(.corp-item)::before { content: attr(data-label); color: #6b7280; font-size: .85rem; }
  .corp-items .corp-item { min-width: 0; }
  .corp-items td[data-label="Logo"] input { width: 60%; }
  .corp-steps li { min-width: 30%; font-size: .78rem; }
  .corp-sum { max-width: none; }
}
@media (min-width: 1100px) { .corp-main { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); } }
.dash-links { display: flex; flex-wrap: wrap; gap: 8px; }
.cost-hidden { display: none; }
.corp-nocost .corp-items th:nth-child(5), .corp-nocost .corp-items th:nth-child(7),
.corp-nocost .corp-items td[data-label="Cost / pc"], .corp-nocost .corp-items td[data-label="Margin"] { display: none !important; }
/* Users & permissions */
.radio-card { display: flex !important; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.radio-card input { margin-top: 3px; }
.u-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; margin: 8px 0 12px; }
.u-tpl { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; }
button.u-tpl:hover { border-color: var(--primary); }
.u-tpl.on { border-color: var(--primary); background: #f5f2ff; box-shadow: 0 0 0 2px #e4dcff; }
.u-grid td { vertical-align: top; }
.u-grid td:first-child { min-width: 150px; }
.u-chk { display: flex !important; gap: 6px; align-items: flex-start; margin: 2px 0 6px; font-weight: normal !important; }
.u-chk input { margin-top: 2px; }
.u-key span { font-weight: 700; color: #8a5a00; }
.u-row { background: none; border: 0; color: var(--primary); padding: 0; cursor: pointer; }
@media (max-width: 700px) {
  .u-grid thead { display: none; }
  .u-grid, .u-grid tbody, .u-grid tr, .u-grid td { display: block; width: 100%; }
  .u-grid tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 10px; }
  .u-grid td { border: 0 !important; padding: 2px 0; }
  .u-grid td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: .75rem; color: #6b7280; text-transform: uppercase; margin-top: 4px; }
}

/* ---- v17 settings tabs, Pathao ---- */
.settings-tabs { margin-bottom: 14px; }
.tab.tab-alert { border-color: #f59e0b; color: #92400e; background: #fffbeb; }
.tab.tab-alert.active { background: #f59e0b; color: #fff; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-light { background: #f1f5f9; color: #334155; }
.stat.stat-warn { outline: 2px solid #f59e0b; }
.kv { width: 100%; }
.kv td { padding: 3px 0; vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 42%; padding-right: 8px; }
.settings-grid { align-items: start; }
.settings-grid .card input[readonly] { background: #f8fafc; font-family: ui-monospace, monospace; font-size: .85rem; }
#pathao-book textarea { width: 100%; }
@media (max-width: 760px) {
  .pa-table thead { display: none; }
  .pa-table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .pa-table td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 3px 0; text-align: right; }
  .pa-table td[data-label]::before { content: attr(data-label); color: #6b7280; font-size: .85rem; text-align: left; }
  .pa-table td.empty { display: block; text-align: center; }
}

/* ---- v17.1 print ---- */
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.prn-logo-box { background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; text-align: center; margin-bottom: 10px; }
.prn-logo-box img { max-height: 90px; max-width: 100%; object-fit: contain; }
.prn-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 14px; margin-bottom: 10px; }
.menu-btn { min-width: 40px; min-height: 40px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ---- v17.2: icons-only menu (like AmarSolution) ---- */
.nav-fly-title { display: none; }
@media (min-width: 901px) {
  body.nav-mini .sidebar { width: 64px; padding: 10px 6px; overflow-x: hidden; }
  body.nav-mini .content { margin-left: 64px; }
  body.nav-mini .sidebar .nav-label, body.nav-mini .nav-group > summary::after, body.nav-mini .sidebar .nav-link .badge { display: none; }
  body.nav-mini .sidebar > .nav-link, body.nav-mini .nav-group > summary { justify-content: center; padding: 10px 0; gap: 0; }
  body.nav-mini .sidebar .ico { width: auto; font-size: 1.15rem; }
  body.nav-mini .nav-group[open] > summary { background: rgba(255,255,255,.1); color: #fff; }
  body.nav-mini .nav-group[data-active] > summary { box-shadow: inset 3px 0 0 var(--primary); }
  body.nav-mini .nav-group > .nav-children { position: fixed; left: 60px; width: 230px; max-height: calc(100vh - 70px); overflow-y: auto; z-index: 40;
    background: var(--sidebar); border-radius: 0 10px 10px 0; padding: 6px; box-shadow: 6px 6px 24px rgba(0,0,0,.3); }
  body.nav-mini .nav-fly-title { display: block; color: #fff; font-weight: 700; padding: 8px 12px 6px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 4px; }
  body.nav-mini .nav-children .nav-sub { padding: 8px 12px; }
  body.nav-mini .nav-children .nav-sub .badge { display: inline-block; }
  body.nav-mini.fullscreen .sidebar { display: none; }
}
.sidebar, .content { transition: width .15s, margin-left .15s; }

/* v17.2.1: icons-only menu hides the words even if a page's menu has no .nav-label spans */
@media (min-width: 901px) {
  body.nav-mini .sidebar > .nav-link, body.nav-mini .nav-group > summary { font-size: 0; }
  body.nav-mini .sidebar > .nav-link .ico, body.nav-mini .nav-group > summary .ico { font-size: 1.15rem; }
  body.nav-mini.pos-page .content, body.nav-mini.fullscreen .content { margin-left: 0; }
}

/* v17.3 customer "where they buy" */
.cust-tabs { margin-bottom: 14px; }
.cust-where { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.cust-where .badge { font-size: .72rem; font-weight: 600; }

/* ---- v18 messages ---- */
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .msg-grid { grid-template-columns: minmax(0, 1fr); } }
.msg-summary { position: sticky; top: 70px; }
.msg-big { font-size: 1.9rem; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.msg-big .small { font-size: .85rem; font-weight: 500; color: var(--muted); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-bottom: 10px; }
.radio-cards .radio-card { margin-bottom: 0; }
.msg-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.msg-pick { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.msg-pick summary { cursor: pointer; font-weight: 600; }
.msg-pick .pick-search { width: 100%; margin: 8px 0 4px; }
.pick-list { max-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 12px; margin-top: 6px; }
.pick-list label { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; font-size: .9rem; }
.msg-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
#msg-body { width: 100%; font-size: 1rem; }
.msg-meter { margin: 4px 0 8px; color: var(--muted); }
.inline-input { display: inline-block; width: auto; min-width: 160px; padding: 4px 8px; }
.when-box { display: flex; flex-direction: column; gap: 6px; }
.bubble { background: #e7f8ec; border-radius: 12px 12px 12px 2px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: .92rem; min-height: 2.5em; }
.msg-phone-preview { margin-top: 10px; }
.msg-progress { height: 12px; background: #eef0f5; border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.msg-progress .bar { height: 100%; background: var(--primary); transition: width .3s; }
.msg-snip { max-width: 420px; }
.link-btn { background: none; border: 0; padding: 0 4px; cursor: pointer; font: inherit; }
.link-btn:hover { text-decoration: underline; }
