/* ===== Ikaa module — reuses Leogo's panel/form classes; only the accent differs
   (warm rose/copper vs Leogo gold) to prevent tab confusion. ===== */
:root { --ik-accent: #d98a6a; }   /* warm rose/copper */

/* Ikaa-only chrome: hide the Hisaab summary/settle/surplus/FAB while on the tab */
body.ikaa-mode .summary,
body.ikaa-mode .settle,
body.ikaa-mode .surplus-banner,
body.ikaa-mode .warn-banner,
body.ikaa-mode .fab { display: none; }

/* sub-nav pills (mirror .lg-subnav/.lg-pill with the Ikaa accent) */
.ik-subnav {
  display: flex; gap: 8px; overflow-x: auto;
  margin: 0 -16px 16px; padding: 2px 16px 8px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.ik-subnav::-webkit-scrollbar { display: none; }
.ik-pill {
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 11px 16px; min-height: 44px;
  display: inline-flex; align-items: center;
  cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: all 0.15s ease;
}
.ik-pill.active { color: #1a1210; background: var(--ik-accent); border-color: var(--ik-accent); }
.ik-pill:active { transform: scale(0.95); }

.ik-section { display: none; }
.ik-section.active { display: block; }

/* Ikaa accent on shared buttons/badges when inside the Ikaa tab */
body.ikaa-mode .lg-btn:not(.ghost) { background: var(--ik-accent); color: #1a1210; }
body.ikaa-mode .lg-pill.active { background: var(--ik-accent); border-color: var(--ik-accent); color: #1a1210; }
body.ikaa-mode .lg-panel-title .lg-panel-sub a { color: var(--ik-accent); }

/* item cards */
.ik-item-card { cursor: pointer; }
.ik-stock {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--invested);
}
.ik-stock.low { color: var(--pending); }
.ik-stock.none { color: #e05c5c; }
.ik-item-meta { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.lg-badge.ik { color: var(--ik-accent); background: rgba(217, 138, 106, 0.14); }
.lg-badge.nostock { color: var(--muted); background: rgba(153, 153, 153, 0.12); }

/* ---- catalog: search + filter chips ---- */
.ik-search { width: 100%; background: #0d0d0d; border: 1px solid var(--border); border-radius: 10px;
  color: var(--white); font-family: inherit; font-size: 15px; padding: 11px 13px; margin-bottom: 10px; }
.ik-chiprow { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.ik-chip { flex: 0 0 auto; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  color: var(--muted); background: var(--card); border: 1px solid var(--border); white-space: nowrap; }
.ik-chip.active { color: #1a1210; background: var(--ik-accent); border-color: var(--ik-accent); font-weight: 600; }

/* ---- photo-first item grid ---- */
.ik-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ik-tile { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.ik-tile.closed { opacity: 0.5; }
.ik-thumb { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #0d0d0d; display: block; }
.ik-noimg { display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--muted); }
.ik-tile-body { padding: 8px 10px 10px; }
.ik-tile-name { font-size: 13.5px; font-weight: 600; color: var(--white); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ik-tile-sku { font-size: 15px; font-weight: 800; letter-spacing: 0.02em; color: var(--ik-accent); margin: 3px 0 2px; font-variant-numeric: tabular-nums; }
.ik-tile-foot { font-size: 12px; color: var(--muted); }
.ik-tile-tags { font-size: 11px; color: var(--muted); margin-top: 3px; opacity: 0.85; }
.ik-typechip { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; vertical-align: middle; }
.ik-typechip.raw_material { color: #e0a05c; background: rgba(224, 160, 92, 0.15); }
.ik-typechip.service { color: #7aa2f7; background: rgba(122, 162, 247, 0.15); }
.ik-tile-actions { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ik-consume-btn { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 8px; border: none; cursor: pointer; color: #1a1210; background: var(--ik-accent); }
.ik-adjust-btn { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 8px; cursor: pointer;
  color: var(--ik-accent); background: rgba(217,138,106,0.12); border: 1px solid rgba(217,138,106,0.45); flex: 0 0 auto; }
.ik-adjust-btn:active { background: rgba(217,138,106,0.22); }
.ik-low { color: var(--pending); }

/* Items catalog: thin horizontal strips (single items + variant-group heads share this
   shape). Pickers keep the large photo tiles above — this only restyles the mgmt list. */
.ik-list { display: flex; flex-direction: column; gap: 8px; }
.ik-thumb.strip { width: 64px; height: 64px; aspect-ratio: auto; border-radius: 8px; flex: 0 0 auto; }
.ik-strip { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px; cursor: pointer; overflow: hidden; }
.ik-strip.closed { opacity: 0.5; }
.ik-strip-body { flex: 1; min-width: 0; }
.ik-strip-name { font-size: 14px; font-weight: 600; color: var(--white); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ik-strip-meta { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ik-strip-sku { font-weight: 800; color: var(--ik-accent); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.ik-strip-price { color: #cfcfcf; }
.ik-strip-tags { font-size: 11px; color: var(--muted); margin-top: 2px; opacity: 0.85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ik-strip-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }

/* catalog colour-variant group: expandable rows under the design head */
.ik-vlist { display: flex; flex-direction: column; }
.ik-vlist[hidden] { display: none; }
.ik-vrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid rgba(255,255,255,0.07); cursor: pointer; }
.ik-vrow.closed { opacity: 0.5; }
.ik-vrow .ik-thumb.sm { width: 40px; height: 40px; }
.ik-vrow-body { flex: 1; min-width: 0; }
.ik-vrow-name { font-size: 13px; font-weight: 600; color: var(--white); }
.ik-vrow-sku { font-size: 12.5px; font-weight: 800; color: var(--ik-accent); font-variant-numeric: tabular-nums; }
/* stock-adjust modal */
.ik-modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.62); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 560px) { .ik-modal { align-items: center; padding: 20px; } }
.ik-modal-card { width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; margin: 0; border-radius: 18px 18px 0 0; }
@media (min-width: 560px) { .ik-modal-card { border-radius: 16px; } }
.ik-adj-cur { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.ik-adj-cur b { color: var(--white); }
.ik-adj-delta { font-size: 13px; font-weight: 700; margin-top: 6px; min-height: 16px; color: var(--muted); }
.ik-adj-delta.up { color: #3f9d6b; }
.ik-adj-delta.down { color: #e05c5c; }

/* ---- form: radios, tags, photo, qty ---- */
.ik-radiorow { display: flex; gap: 6px; flex-wrap: wrap; }
.ik-radio { flex: 1 0 auto; position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 14px; background: #0d0d0d; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; line-height: 1.15; text-align: center; white-space: nowrap; color: var(--text, #eee);
  cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* native radio drives state but is not painted — the pill itself is the control */
.ik-radio input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; pointer-events: none; }
.ik-radio span { pointer-events: none; }
.ik-radio:has(input:checked) { border-color: var(--ik-accent); background: rgba(217, 138, 106, 0.16); color: var(--ik-accent); font-weight: 600; }
.ik-radio:focus-within { outline: 2px solid var(--ik-accent); outline-offset: 1px; }
.ik-field-hint { display: block; font-size: 11.5px; color: var(--muted, #8a8a8a); margin-top: 4px; line-height: 1.4; }
.ik-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ik-tag { font-size: 12px; padding: 3px 4px 3px 9px; border-radius: 999px; background: rgba(217,138,106,0.14); color: var(--ik-accent); display: inline-flex; align-items: center; gap: 4px; }
.ik-tag button { border: none; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; }
.ik-photo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ik-photo-preview { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; background: #0d0d0d; border: 1px solid var(--border); flex: 0 0 auto; }
.ik-photo-btn { position: relative; overflow: hidden; }
.ik-dup { font-size: 12px; color: #e0a05c; margin: -4px 0 8px; min-height: 0; }
.ik-dup:empty { margin: 0; }
.ik-qty { display: flex; align-items: center; gap: 8px; }
.ik-qty button { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; border: 1px solid var(--border); background: #0d0d0d; color: var(--white); cursor: pointer; }
.ik-qty input { flex: 1; text-align: center; font-size: 18px; font-weight: 700; }
.ik-cost { margin: 8px 0; }
.ik-cost summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.ik-cost input { margin-top: 8px; }
.ik-skuprev { font-size: 13px; color: var(--muted); margin: 10px 0; }
.ik-skuprev b { color: var(--ik-accent); font-size: 16px; font-weight: 800; }

/* ---- inventory overview + recount session ---- */
.ik-invsummary { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.ik-invsummary b { color: var(--white); font-size: 15px; }
.ik-invsummary .ik-low b { color: var(--pending); }
.ik-invrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 13.5px; }
.ik-thumb.inv { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 7px; flex: 0 0 auto; }
.ik-invrow .ik-noimg.inv { font-size: 18px; }
.ik-invrow-name { color: var(--white); flex: 1; min-width: 0; }
.ik-invrow.sub { padding-left: 12px; border-left: 2px solid var(--border); margin-left: 2px; }
.ik-invgroup { margin: 4px 0; }
.ik-invgroup-head { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--white); padding: 8px 0 4px; }
.ik-invgroup-head .ik-thumb.sm { width: 36px; height: 36px; }
.ik-invgroup-headtext { min-width: 0; }
.ik-invgroup-meta { font-weight: 400; color: var(--muted); font-size: 11px; }
.ik-session { margin-top: 14px; }
.ik-session-h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }

/* ---- sales ---- */
.ik-muted { color: var(--muted); }

/* PayU placeholder-rate flag (amber) shown wherever the commission appears */
.ik-payu-flag { background: rgba(224,160,92,0.12); border: 1px solid rgba(224,160,92,0.5); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; color: #e8b878; line-height: 1.5; }
.ik-payu-flag b { color: #f0c88a; }
.ik-payu-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ik-payu-edit input { width: 88px; background: #0d0d0d; border: 1px solid var(--border); border-radius: 8px;
  color: var(--white); font-size: 14px; padding: 8px 10px; text-align: right; }
.ik-payu-edit .lg-btn { padding: 8px 12px; font-size: 13px; }
.ik-payu-note { margin-top: 6px; font-size: 11px; color: var(--muted); }
.ik-payu-ok { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.ik-payu-ok b { color: var(--white); }
.ik-payu-cut { color: #e0a05c; font-variant-numeric: tabular-nums; }
.ik-amber-dot { color: #e0a05c; font-size: 10px; vertical-align: middle; }
.ik-linkbtn { background: none; border: none; color: var(--ik-accent); cursor: pointer; font-size: 12.5px; text-decoration: underline; padding: 0; }
.ik-pending-banner { background: rgba(245, 166, 35, 0.14); color: var(--pending); border: 1px solid rgba(245,166,35,0.3);
  border-radius: 10px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; cursor: pointer; }
.ik-sale-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #0d0d0d; flex: 0 0 auto; }
.ik-sale-thumb.lg { width: 68px; height: 68px; border-radius: 10px; }
.ik-match-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.ik-match-info { flex: 1; color: var(--white); }
.ik-match-actions { display: flex; gap: 6px; flex-direction: column; }

/* ---- dashboard ---- */
.ik-dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.ik-dcard { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.ik-dcard-v { font-size: 17px; font-weight: 700; color: var(--white); white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.ik-dcard-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.ik-dcard.good .ik-dcard-v { color: var(--surplus); }
.ik-dcard.bad .ik-dcard-v { color: #e05c5c; }
.ik-dsub { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.ik-dsub b { color: var(--white); }
.ik-low b { color: var(--pending); }

/* ---- invoice sale lines ---- */
.iksi-line { display: grid; grid-template-columns: 1fr 56px 72px 28px; gap: 6px; align-items: center; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.iksi-line-name { font-size: 13px; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iksi-qty, .iksi-rate { text-align: right; padding: 6px 8px !important; font-size: 13px; }
.iksi-total { text-align: right; font-size: 15px; font-weight: 700; color: var(--white); margin: 10px 0; }

/* ---- Items: filter sheet + FAB ---- */
.ik-filter-sheet { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.ik-filter-sheet[hidden] { display: none; }
.ik-filter-h { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 4px 0 6px; }
.ik-fab { position: fixed; right: 18px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--ik-accent); color: #1a1210; font-size: 28px; font-weight: 400; line-height: 1; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.45); z-index: 50; }
.ik-fab:active { transform: scale(0.94); }
.ik-fab-menu { position: fixed; right: 18px; bottom: calc(150px + env(safe-area-inset-bottom)); background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.55); z-index: 51; min-width: 190px; }
.ik-fab-menu[hidden] { display: none; }
.ik-fab-item { text-align: left; background: transparent; border: none; color: var(--white); font-family: inherit; font-size: 15px; padding: 12px 14px; min-height: 44px; border-radius: 8px; cursor: pointer; }
.ik-fab-item:active { background: rgba(255, 255, 255, 0.06); }

/* ---- picker: colour-variant group card ---- */
.ik-vgroup { grid-column: 1 / -1; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ik-vhead { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px; background: transparent; border: none; color: var(--white); font-family: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.ik-thumb.sm { width: 52px; height: 52px; aspect-ratio: auto; border-radius: 8px; flex: 0 0 auto; }
/* prominent design photo on a collapsed variant-group head (photo-first, recognisable) */
.ik-thumb.md { width: 92px; height: 92px; aspect-ratio: auto; border-radius: 10px; flex: 0 0 auto; }
.ik-vhead .ik-tile-body { padding: 0; flex: 1; min-width: 0; }
.ik-vchevron { color: var(--muted); font-size: 14px; flex: 0 0 auto; }
.ik-vswatches { display: flex; gap: 8px; overflow-x: auto; padding: 2px 10px 12px; -webkit-overflow-scrolling: touch; }
.ik-vswatches[hidden] { display: none; }
.ik-swatch { flex: 0 0 auto; width: 80px; background: #0d0d0d; border: 1px solid var(--border); border-radius: 10px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--white); font-family: inherit; }
.ik-swatch:active { border-color: var(--ik-accent); transform: scale(0.96); }
.ik-swatch-img { width: 66px; height: 66px; border-radius: 8px; object-fit: cover; background: var(--card); font-size: 22px; display: flex; align-items: center; justify-content: center; }
.ik-swatch-label { font-size: 12px; font-weight: 600; white-space: nowrap; }
.ik-swatch-stock { font-size: 10px; color: var(--muted); }
