/* ======================================================================
   ERP theme — deep navy / charcoal shell, white surfaces, subtle violet accent.
   Loaded after style.css: it refines the base rules without touching them.
   ====================================================================== */
:root {
  --accent: #6D5DE8;
  --accent-d: #5847D3;
  --accent-l: #8B7FF0;
  --accent-bg: #F0EEFE;
  --accent-line: #D9D4FB;
  --shell-1: #151B36;
  --shell-2: #0D1226;
  --bg: #F4F5FA;
}
body { background: var(--bg); }
a { color: var(--accent-d); }
.sidebar { background: linear-gradient(185deg, var(--shell-1) 0%, var(--shell-2) 100%); }
.side-brand { padding: 18px 18px 8px; }
.side-brand .mark { background: linear-gradient(135deg, var(--accent-l), var(--accent-d)); color: #fff; box-shadow: 0 4px 14px rgba(109,93,232,.45); }
.side-brand small { color: #8E98BF; }
.nav { padding: 6px 10px 10px; gap: 1px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav a { color: #B7C0DC; min-height: 38px; padding: 8px 12px; gap: 11px; font-size: 14px; border-radius: 9px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(109,93,232,.20); color: #fff; }
.nav a.active::before { background: var(--accent-l); left: -10px; top: 8px; bottom: 8px; }
.nav .grp { margin-top: 2px; }
.nav .grp-head { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; color: #8E98BF; font-weight: 700; font-size: 11.5px; letter-spacing: .9px; text-transform: uppercase; padding: 12px 12px 6px; cursor: pointer; text-align: left; }
.nav .grp-head:hover { color: #fff; }
.nav .grp-head .chev { margin-left: auto; transition: transform .2s; opacity: .7; }
.nav .grp.open > .grp-head .chev { transform: rotate(180deg); }
.nav .grp-items { display: none; flex-direction: column; gap: 1px; padding-bottom: 4px; }
.nav .grp.open > .grp-items { display: flex; }
.nav .grp-items a { padding-left: 14px; font-size: 13.5px; min-height: 35px; }
.nav .grp-items a .ico { opacity: .85; }
.nav .grp.has-active > .grp-head { color: #C9D1EE; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.logo-card { background: #FAFBE9; }
.topbar { background: rgba(255,255,255,.94); }
.global-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109,93,232,.16); }
.quick-add { height: 40px; padding: 0 14px 0 12px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 4px 12px rgba(109,93,232,.35); }
.quick-add:hover { background: var(--accent-d); }
.avatar { background: linear-gradient(135deg, var(--shell-1), #2A3566); }
.avatar.lg { background: linear-gradient(135deg, var(--accent-l), var(--accent-d)); }

.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-d); }
.btn.navy { background: var(--shell-1); border-color: var(--shell-1); }
.btn.navy:hover { background: #222B52; }
.btn:focus-visible, .icon-btn:focus-visible, .nav a:focus-visible, input:focus-visible { outline-color: rgba(109,93,232,.4); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .search-box input:focus, .filter select:focus, .filter input:focus,
.items-table td input:focus, .items-table td select:focus, .items-table td textarea:focus, .terms-grid input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109,93,232,.15); }
.check input { accent-color: var(--accent-d); }
.page-head h1 { color: var(--shell-1); }
.card-head h3, .cell-main { color: var(--shell-1); }
.table th.sortable:hover { color: var(--accent-d); }
.sort-ind.on { color: var(--accent-d); }
.table tbody tr:hover { background: #FAFAFE; }
.menu-item:hover, .menu-item.active, .sp-item:hover, .sp-item.active { background: var(--accent-bg); }
.ta-footer, .sp-group, .form-section > h4 { color: var(--accent-d); }
.chip-btn:hover { border-color: var(--accent); background: var(--accent-bg); }
.chip-btn.on { background: var(--shell-1); border-color: var(--shell-1); }
.seg button.on { color: var(--accent-d); }
.tabs .on { color: var(--accent-d); border-bottom-color: var(--accent); }
.state-ico, .stat-ico { background: var(--accent-bg); color: var(--accent-d); }
.state-ico.red, .stat-ico.red { background: var(--red-bg); color: var(--red); }
.stat-ico.navy { background: #E4E8F5; color: var(--shell-1); }
.stat-ico.yellow { background: var(--yellow-bg); color: #8A6100; } .stat-ico.blue { background: var(--blue-bg); color: var(--blue); }
.spin { border-top-color: var(--accent); }
a.stat-card:hover, .quick button:hover, .quick a:hover { border-color: var(--accent); background: #FCFBFF; }
.quick .q-ico { background: var(--shell-1); } .quick .q-ico.g { background: var(--accent); } .quick .q-ico.y { background: #F5B301; color: var(--shell-1); }
.wa-opt:hover { border-color: var(--accent); background: #FCFBFF; }
.wa-opt.primary { border-color: var(--accent); background: var(--accent-bg); }
.wa-opt .ico { color: var(--accent-d); }
.balance-box { background: linear-gradient(135deg, var(--shell-1), #25306A); }
.login-hero { background: linear-gradient(160deg, var(--shell-1) 0%, var(--shell-2) 100%); }
.login-hero::after { background: radial-gradient(circle at 30% 30%, rgba(139,127,240,.55), rgba(139,127,240,0) 65%); }
.login-hero h2 em, .login-hero .pts .ico { color: #B6ACFF; }
.global-search .ico, .search-box .ico { color: #8A92A6; }
.badge.accent { background: var(--accent-bg); color: var(--accent-d); }
.badge.teal { background: #E0F5F2; color: #0F6F63; }
.tabs a:hover, .tabs button:hover { color: var(--accent-d); }
.notif .dot { background: var(--accent); }
.notif.unread { background: #FBFAFF; }
.notif.read { opacity: .62; }
.notif-pop .np-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 700; color: var(--shell-1); border-bottom: 1px solid var(--line-2); }
.notif-pop .np-head button { border: 0; background: none; color: var(--accent-d); font-weight: 600; font-size: 12.5px; }

/* ---------- ERP components ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; display: block; color: inherit; text-decoration: none; }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.1); transition: .12s; }
.kpi .k-top { display: flex; align-items: flex-start; gap: 8px; }
.kpi .k-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .k-val { font-size: 24px; font-weight: 800; color: var(--shell-1); letter-spacing: -.4px; margin-top: 6px; line-height: 1.15; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi .k-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-d); margin-left: auto; flex: none; }
.kpi.red .k-val { color: var(--red); } .kpi.red .k-ico { background: var(--red-bg); color: var(--red); }
.kpi.green .k-val { color: #15803D; } .kpi.green .k-ico { background: var(--green-bg); color: #3B6B0F; }
.kpi.amber .k-ico { background: var(--amber-bg); color: var(--amber); }
.kpi.blue .k-ico { background: var(--blue-bg); color: var(--blue); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); font-weight: 800; margin: 26px 0 10px; }
.legend i.sq { border-radius: 3px; }
.filters-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0,1fr) 90px; gap: 10px; align-items: center; padding: 7px 0; font-size: 13.5px; }
.bar-row .track { height: 9px; background: #EEF0F6; border-radius: 9px; overflow: hidden; } .bar-row .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-l), var(--accent)); border-radius: 9px; }
.bar-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.col-menu { padding: 8px; min-width: 210px; }
.col-menu label { display: flex; gap: 9px; align-items: center; padding: 7px 8px; border-radius: 7px; font-size: 14px; cursor: pointer; }
.col-menu label:hover { background: var(--accent-bg); }
.table td.sel, .table th.sel { width: 36px; padding-left: 12px; padding-right: 0; }
.table td.sel input, .table th.sel input { width: 17px; height: 17px; accent-color: var(--accent-d); cursor: pointer; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--accent-bg); border-bottom: 1px solid var(--accent-line); font-weight: 600; color: var(--accent-d); flex-wrap: wrap; }
.stock-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.stock-chip.ok { background: var(--green-bg); color: #3B6B0F; } .stock-chip.low { background: var(--amber-bg); color: #93400D; } .stock-chip.out { background: var(--red-bg); color: #B42318; } .stock-chip.svc { background: #EEF0F3; color: #475467; }
.avail { font-size: 12px; color: var(--muted); }
.avail.bad { color: var(--red); font-weight: 600; }
.neg-num { color: var(--red); } .pos-num { color: #15803D; }
.pay-box { background: #FAFAFE; border: 1px dashed var(--accent-line); border-radius: 12px; padding: 14px 16px; }
.pay-box h4 { color: var(--accent-d); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.doc-chain { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-chain a, .doc-chain span { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; background: var(--accent-bg); color: var(--accent-d); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.doc-chain a:hover { background: #E4E0FC; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--accent-line); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.timeline li:last-child { border-left-color: transparent; }
.sig-pad { border: 1px dashed #B8BFD3; border-radius: 10px; background: #fff; touch-action: none; width: 100%; height: 150px; display: block; cursor: crosshair; }
.diff-box { font-size: 12.5px; background: #FAFAFE; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; max-height: 170px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.diff-box.old { background: #FFF6F5; } .diff-box.new { background: #F4FBF1; }
.kbd-hint kbd, kbd.k { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-size: 11.5px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.skeleton { background: linear-gradient(90deg, #EEF0F6 25%, #F6F7FB 37%, #EEF0F6 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 8px; min-height: 16px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel-table { padding: 8px 16px 16px; display: grid; gap: 12px; }
.skel-table .skeleton { height: 20px; }
.upgrade-banner { display: flex; gap: 14px; align-items: flex-start; background: #FFF9E8; border: 1px solid #F3DC9A; border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; color: #6B4E00; }
.upgrade-banner b { color: #4A3600; }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-tabs a { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13.5px; color: var(--ink); text-decoration: none; }
.pill-tabs a:hover { border-color: var(--accent); }
.pill-tabs a.on { background: var(--shell-1); border-color: var(--shell-1); color: #fff; }
.sum-strip { display: flex; flex-wrap: wrap; gap: 8px 26px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: #FAFAFE; font-size: 14px; justify-content: flex-end; }
.sum-strip span { color: var(--muted); } .sum-strip b { color: var(--shell-1); }
.inline-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.warn-text { color: var(--amber); font-weight: 600; }
.col-2 { grid-column: span 2; }
.items-table td .stk { font-size: 11.5px; margin-top: 2px; color: var(--muted); }
.items-table td .stk.bad { color: var(--red); font-weight: 700; }
.items-table td .stk.warn { color: var(--amber); font-weight: 600; }

/* mobile: every list table becomes a stack of cards */
@media (max-width: 760px) {
  .list-card .table-wrap { overflow: visible; }
  .list-card .table, .list-card .table tbody { display: block; }
  .list-card .table thead { display: none; }
  .list-card .table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px 14px; margin: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; position: relative; }
  .list-card .table tbody tr:hover { background: #fff; }
  .list-card .table td { display: block; padding: 0; border: 0; text-align: left !important; min-width: 0; }
  .list-card .table td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 1px; }
  .list-card .table td:first-child, .list-card .table td.wide { grid-column: 1 / -1; }
  .list-card .table td.act { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  .list-card .table td.act::before, .list-card .table td.sel::before { display: none; }
  .list-card .table td.sel { position: absolute; top: 12px; right: 44px; width: auto; }
  .list-card .table td:first-child { padding-right: 70px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 12px; } .kpi .k-val { font-size: 18px; }
  .bar-row { grid-template-columns: 90px minmax(0,1fr) 78px; }
  .quick-add span { display: none; } .quick-add { padding: 0 10px; }
  .col-2 { grid-column: auto; }
  .sum-strip { justify-content: space-between; }
}
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
