/* =========================================================
   Counter — application styles (tenant app + master panel)
   Design tokens first; Bootstrap is restyled through them.
   ========================================================= */
:root {
  --brand: #0E6B55; --brand-600: #0B5343; --brand-700: #08402f; --brand-50: #E6F2EC; --brand-100: #CFE6DA;
  --ink: #1C242B; --ink-2: #4B5661; --muted: #7A8590; --muted-2: #A6AFB7;
  --bg: #F3F5F2; --surface: #FFFFFF; --surface-2: #F8FAF8; --line: #E2E7E2; --line-2: #CDD4CD;
  --side-bg: #14251F; --side-ink: #C9D6CF; --side-muted: #7F9489; --side-active: rgba(255,255,255,.08);
  --ok: #1F8A5B; --warn: #B7791F; --danger: #B3402F; --info: #2F6FB5;
  --radius: 10px; --radius-sm: 7px; --shadow: 0 1px 2px rgba(20,37,31,.06), 0 4px 16px rgba(20,37,31,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 248px; --sidebar-w-collapsed: 72px; --topbar-h: 60px;
  --bs-body-font-family: var(--font); --bs-body-color: var(--ink); --bs-body-bg: var(--bg);
  --bs-primary: var(--brand); --bs-primary-rgb: 14,107,85; --bs-link-color: var(--brand); --bs-link-hover-color: var(--brand-600);
  --bs-border-color: var(--line); --bs-border-radius: var(--radius-sm);
}
html { font-size: 15px; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { color: var(--brand-700); background: var(--brand-50); padding: .1em .35em; border-radius: 4px; }
h1,h2,h3,h4,h5 { letter-spacing: -.01em; font-weight: 650; }
.tabular, .stat-value, td.num { font-variant-numeric: tabular-nums; }

/* Bootstrap component overrides */
.btn { --bs-btn-border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); }
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--line-2); --bs-btn-color: var(--ink-2); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line-2); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-2); --bs-btn-active-bg: var(--brand-50); --bs-btn-active-color: var(--brand-700); --bs-btn-active-border-color: var(--brand-100); }
.form-control, .form-select { border-color: var(--line-2); border-radius: var(--radius-sm); color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(14,107,85,.15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(14,107,85,.15); }
.form-label { font-weight: 500; color: var(--ink-2); font-size: .9rem; margin-bottom: .3rem; }
.form-text { color: var(--muted); font-size: .8rem; }
.input-group-text { background: var(--surface-2); border-color: var(--line-2); color: var(--muted); }
.badge-status { font-weight: 600; letter-spacing: .01em; }
.badge.text-bg-light { color: var(--ink-2) !important; }
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); padding: .4rem; }
.dropdown-item { border-radius: 6px; padding: .45rem .7rem; }
.dropdown-item:active { background: var(--brand); }
.pagination { --bs-pagination-color: var(--ink-2); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-border-color: var(--line); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-hover-color: var(--ink); --bs-pagination-focus-box-shadow: none; }
.table-active { --bs-table-bg-state: var(--brand-50); }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.app-shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
.app-sidebar { background: var(--side-bg); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; z-index: 1040; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; min-height: var(--topbar-h); }
.brand-link { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand-link:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.15rem; }
.brand-mark.lg { width: 56px; height: 56px; flex-basis: 56px; border-radius: 14px; font-size: 1.7rem; background: rgba(255,255,255,.14); }
.brand-mark.dark { background: var(--ink); }
/* The cropped ShopPilot icon (bag + rupee tag) on a light tile so it reads on the dark sidebar. */
.brand-mark.logo { background: #fff; padding: 4px; }
.brand-mark.logo.light { background: var(--brand-50); border: 1px solid var(--brand-100); }
.brand-mark.lg.logo { padding: 8px; background: #fff; }
.brand-mark.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .72rem; color: var(--side-muted); letter-spacing: .06em; text-transform: uppercase; }
.sidebar-nav { padding: 6px 10px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.38); }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); padding: 16px 10px 6px; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; font-size: .93rem; white-space: nowrap; width: 100%; border: 0; background: none; text-align: left; }
.nav-item i { font-size: 1.1rem; width: 22px; text-align: center; flex: 0 0 22px; color: var(--side-muted); }
.nav-item:hover { background: var(--side-active); color: #fff; text-decoration: none; }
.nav-item:hover i { color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active i { color: #fff; }
.nav-item.disabled { opacity: .45; cursor: default; }
.nav-item .soon { margin-left: auto; font-style: normal; font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; border: 1px solid rgba(255,255,255,.25); border-radius: 4px; padding: 1px 5px; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .version { font-size: .7rem; color: var(--side-muted); padding: 6px 10px 0; font-family: var(--mono); }
.collapsed .brand-text, .collapsed .nav-item span, .collapsed .nav-section, .collapsed .nav-item .soon, .collapsed .version { display: none; }
.collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.collapsed .nav-item i { width: auto; }
.collapsed .collapse-toggle i { transform: rotate(180deg); }
.sidebar-backdrop { display: none; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020; }
.page-title { font-size: 1.1rem; margin: 0; font-weight: 650; }
.topbar-spacer { flex: 1; }
.btn-icon { border: 0; background: none; width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); font-size: 1.25rem; }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.conn-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.conn-chip.online { color: var(--ok); border-color: #BFE3CF; background: #EAF7EF; }
.conn-chip.offline { color: var(--danger); border-color: #F0C9C1; background: #FBECE8; }
.user-menu { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 6px; border-radius: 10px; color: var(--ink); }
.user-menu:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-name { font-weight: 600; font-size: .9rem; }
.user-role { font-size: .74rem; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: 0 0 34px; }
.avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: .75rem; }
.grace-banner { background: #FFF6E5; color: #7A5410; border-bottom: 1px solid #F3DDB0; padding: 9px 22px; font-size: .9rem; }
.grace-banner.info { background: #EAF2FB; color: #24507F; border-color: #C9DCF1; }
.app-content { padding: 22px; flex: 1; }
@media (min-width: 1400px) { .app-content { padding: 26px 32px; } }

/* Mobile sidebar */
@media (max-width: 991.98px) {
  .app-shell, .app-shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .app-shell.sidebar-open .app-sidebar { transform: none; }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,20,16,.5); z-index: 1035; }
  .collapsed .brand-text, .collapsed .nav-item span, .collapsed .nav-section { display: initial; }
  .collapsed .nav-item { justify-content: flex-start; padding-left: 10px; padding-right: 10px; }
  .app-topbar { padding: 0 14px; }
  .app-content { padding: 14px; }
}

/* ---------- Page pieces ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-heading { font-size: 1.35rem; margin: 0; }
.page-subtitle { color: var(--muted); margin: 4px 0 0; font-size: .92rem; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.app-card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.app-card > .card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-card > .card-header h5 { margin: 0; font-size: 1rem; }
.app-card > .card-body { padding: 18px; }
.app-card > .card-footer { background: var(--surface-2); border-top: 1px solid var(--line); padding: 12px 18px; border-radius: 0 0 var(--radius) var(--radius); }
.stat-card { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); height: 100%; }
.stat-card.attention { border-color: #F3DDB0; background: #FFFBF3; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-size: 1.25rem; flex: 0 0 44px; }
.stat-card.attention .stat-icon { background: #FFF1D6; color: #8A5B00; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.check-list { list-style: none; margin: 0; padding: 6px 0; }
.check-list li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.check-list li:last-child { border-bottom: 0; }
.check-list li i { color: var(--muted-2); font-size: 1.15rem; }
.check-list li.done i { color: var(--ok); }
.check-list li.done span { color: var(--muted); text-decoration: line-through; }
.activity-list { list-style: none; margin: 0; padding: 4px 0; }
.activity-list li { padding: 10px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.activity-list li:last-child { border-bottom: 0; }
.activity-action { font-family: var(--mono); font-size: .82rem; color: var(--brand-700); }
.activity-meta { color: var(--muted); font-size: .8rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }
.kv.two-col { grid-template-columns: max-content 1fr; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filter-bar .form-select, .filter-bar .form-control:not(.search-group .form-control) { width: auto; min-width: 140px; }
.search-group { width: 300px; max-width: 100%; }
.app-table { --bs-table-bg: transparent; font-size: .92rem; }
.app-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: var(--surface-2); padding: 10px 16px; white-space: nowrap; }
.app-table td { padding: 11px 16px; border-color: var(--line); }
.app-table tbody tr:hover { background: var(--surface-2); }
.empty-state { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; font-size: 1.4rem; color: var(--muted-2); }
.empty-state h5 { color: var(--ink); font-size: 1rem; }
.empty-state p { max-width: 42ch; margin: 4px auto 12px; font-size: .9rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: .82rem; font-weight: 500; }
.chip b { font-weight: 700; color: var(--ink); }
.chip.active, .chip:hover { border-color: var(--brand); color: var(--brand-700); text-decoration: none; background: var(--brand-50); }
.role-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 24px; }
.perm-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.perm-group legend { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 6px; float: none; width: auto; }
.perm-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 6px 8px; border-radius: 6px; margin: 0; cursor: pointer; }
.perm-item:hover { background: var(--surface-2); }
.perm-item input { margin: 0; grid-row: span 2; }
.perm-item span { font-size: .9rem; }
.perm-item code { font-size: .7rem; background: none; color: var(--muted); padding: 0; }
.counter-badge { width: 54px; height: 54px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; flex: 0 0 54px; font-family: var(--mono); }
.device-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); font-size: 1.05rem; }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 22px); }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.settings-nav a i { width: 20px; text-align: center; color: var(--muted); }
.settings-nav a:hover { background: var(--surface); text-decoration: none; color: var(--ink); }
.settings-nav a.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow); border: 1px solid var(--line); }
.settings-nav a.active i { color: var(--brand); }
.settings-fields { padding: 0 !important; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.setting-row:last-child { border-bottom: 0; }
.setting-label label { font-weight: 500; }
.setting-control .form-check { display: flex; justify-content: flex-end; }
.setting-control .form-check-input { width: 2.6em; height: 1.4em; }
@media (max-width: 991.98px) { .settings-layout { grid-template-columns: 1fr; } .settings-nav { flex-direction: row; overflow-x: auto; position: static; } .setting-row { grid-template-columns: 1fr; } .setting-control .form-check { justify-content: flex-start; } }
.audit-table td { vertical-align: top; }
.action-code { font-size: .78rem; }
.diff-list { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: .76rem; }
.diff-list li { padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 480px; }
.diff-key { color: var(--muted); margin-right: 6px; }
.diff-old { color: var(--danger); text-decoration: line-through; opacity: .8; }
.diff-new { color: var(--ok); }

/* Toasts */
.toast-stack { position: fixed; top: 14px; right: 14px; z-index: 1080; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 28px)); }
.app-toast { display: flex; align-items: flex-start; gap: 10px; background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: .9rem; animation: toast-in .2s ease; }
.app-toast i { font-size: 1.05rem; margin-top: 1px; }
.app-toast.success i { color: #6BD39B; } .app-toast.error i { color: #FF8A73; } .app-toast.warning i { color: #FFC85C; } .app-toast.info i { color: #8FC1FF; }
.toast-close { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.6); font-size: 1.2rem; line-height: 1; padding: 0 2px; }
.toast-close:hover { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .app-toast, .app-shell, .app-sidebar { animation: none; transition: none; } }

/* ---------- Auth ---------- */
.auth-body { background: var(--bg); min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.auth-side { background: linear-gradient(160deg, var(--brand-700), var(--side-bg) 70%); color: #fff; display: flex; align-items: center; padding: 48px; }
.auth-side-inner { max-width: 420px; }
.auth-side h2 { font-size: 2rem; margin: 22px 0 8px; }
.auth-side .lead { color: rgba(255,255,255,.78); font-size: 1.05rem; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; color: rgba(255,255,255,.85); }
.auth-points i { color: #7ED9B4; margin-right: 8px; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 34px; box-shadow: var(--shadow); position: relative; }
.auth-card .toast-stack { position: static; max-width: none; margin-bottom: 14px; }
.auth-title { font-size: 1.6rem; margin: 0; }
.auth-sub { color: var(--muted); margin: 4px 0 0; }
.auth-foot { margin-top: 18px; color: var(--muted-2); font-size: .78rem; font-family: var(--mono); }
@media (max-width: 899.98px) { .auth-shell { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- Blank / status pages ---------- */
.blank-body { background: var(--bg); min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.blank-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 40px; max-width: 520px; text-align: center; box-shadow: var(--shadow); }
.blank-card h1 { font-size: 1.5rem; }
.blank-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-size: 1.7rem; margin: 0 auto 16px; }
.blank-icon.warn { background: #FFF1D6; color: #8A5B00; }

/* ---------- Master panel ---------- */
.master-body { background: var(--bg); }
.master-nav { background: var(--surface); border-bottom: 1px solid var(--line); height: 58px; display: flex; align-items: center; }
.master-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--ink); }
.master-brand em { font-style: normal; color: var(--muted); font-weight: 500; }
.master-brand:hover { text-decoration: none; color: var(--ink); }
.master-nav nav a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.master-nav nav a:hover { background: var(--surface-2); text-decoration: none; }
.master-nav nav a.active { background: var(--brand-50); color: var(--brand-700); }

/* ---------- Catalogue ---------- */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: -6px 0 18px; }
.subnav a { padding: 9px 14px; color: var(--ink-2); font-weight: 500; font-size: .92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--brand-700); border-bottom-color: var(--brand); }
.stock-pill { display: inline-block; min-width: 56px; text-align: center; padding: 3px 9px; border-radius: 999px; font-weight: 600; font-size: .82rem; background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stock-pill.low { background: #FFF1D6; color: #8A5B00; }
.stock-pill.out { background: #FBE3DE; color: #8F2E1F; }
.stock-pill.ok { background: #E4F3EA; color: #1F6B45; }
.price-main { font-weight: 600; font-variant-numeric: tabular-nums; }
.price-sub { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.badge-soft { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); font-weight: 500; }
.barcode-card { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.barcode-card svg { max-width: 220px; height: 54px; }
.barcode-meta { font-size: .85rem; color: var(--ink-2); }
.barcode-meta code { font-size: .95rem; }
.form-section { margin-bottom: 16px; }
.form-section .card-header h5 { font-size: .95rem; }
.margin-chip { font-size: .8rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.margin-chip.good { background: #E4F3EA; color: #1F6B45; } .margin-chip.bad { background: #FBE3DE; color: #8F2E1F; }
.barcode-rows td { padding: 4px 6px; vertical-align: middle; }
.barcode-rows input { min-width: 90px; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 10px; padding: 24px; text-align: center; color: var(--muted); background: var(--surface-2); }
.dropzone input { display: block; margin: 10px auto 0; }
.cat-tree { list-style: none; margin: 0; padding: 0; }
.cat-tree > li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.cat-tree > li:last-child { border-bottom: 0; }
.cat-row { display: flex; align-items: center; gap: 10px; }
.cat-row .name { font-weight: 600; }
.cat-children { list-style: none; margin: 6px 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cat-children .cat-row .name { font-weight: 500; }
.cat-row .count { color: var(--muted); font-size: .8rem; }
.cat-row .tools { margin-left: auto; display: flex; gap: 4px; }
.inline-edit { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }

/* ---------- Product picker & entry tables ---------- */
.picker-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; margin-top: 4px; }
.picker-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.picker-item:last-child { border-bottom: 0; } .picker-item.active, .picker-item:hover { background: var(--brand-50); }
.picker-item .n { font-weight: 600; } .picker-item .m { font-size: .78rem; color: var(--muted); }
.picker-empty { padding: 10px 12px; color: var(--muted); font-size: .9rem; }
.entry-table td { vertical-align: top; padding: 6px 6px; } .entry-table th { white-space: nowrap; }
.entry-table input.num { text-align: right; font-variant-numeric: tabular-nums; min-width: 72px; }
.entry-table .line-total { font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 12px; }
.totals-box { font-variant-numeric: tabular-nums; }
.totals-box .row-line { display: flex; justify-content: space-between; padding: 4px 0; }
.totals-box .grand { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 1.15rem; }
.count-input { max-width: 120px; text-align: right; }
tr.diff-pos td { background: #EAF7EF; } tr.diff-neg td { background: #FBECE8; }

/* ---------- Reports & dashboard ---------- */
.report-card:hover { border-color: var(--brand); }
.report-card .text-body { color: var(--ink) !important; }
.chart-box { position: relative; height: 240px; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list .bar { height: 6px; border-radius: 3px; background: var(--brand-100); flex: 1; overflow: hidden; }
.rank-list .bar > span { display: block; height: 100%; background: var(--brand); }
.rank-list .val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 84px; text-align: right; }
.rank-list .name { min-width: 120px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bell-badge { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; border-radius: 999px; font-size: .62rem; font-weight: 700; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 4px; }
.notif-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: #F4FAF7; }
.notif-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 36px; background: var(--surface-2); color: var(--ink-2); }
.notif-icon.warning { background: #FFF1D6; color: #8A5B00; } .notif-icon.critical { background: #FBE3DE; color: #8F2E1F; }
.notif-msg { white-space: pre-line; color: var(--ink-2); font-size: .88rem; }
