/* ==========================================================================
   SK MOBILES v5.8.2 — screens polish: credit ledger, payment popup,
   date fields (calendar icon), compact forms, equal-width button rows.
   Presentation only. Loaded last.
   ========================================================================== */

/* ---------- date field wrapper + calendar icon (right corner) ---------- */
html body .sk-date-wrap{position:relative;display:block;width:100%;min-width:0;max-width:100%}
html body .sk-date-wrap > input:not(.sk-date-native){width:100%!important;padding-right:46px!important;box-sizing:border-box}
html body .sk-date-btn{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:34px;height:34px;min-width:0!important;padding:0!important;margin:0!important;border:0!important;border-radius:11px!important;background:linear-gradient(135deg,#dbeafe,#e0e7ff)!important;color:#2563eb!important;display:flex!important;align-items:center;justify-content:center;box-shadow:none!important;cursor:pointer;z-index:2;-webkit-tap-highlight-color:transparent}
html body .sk-date-btn svg{width:19px;height:19px;display:block}
html body .sk-date-btn:active{transform:translateY(-50%) scale(.94)}
html body .sk-date-native{position:absolute!important;right:6px;top:0;width:34px!important;height:100%!important;opacity:0!important;pointer-events:none!important;border:0!important;padding:0!important;margin:0!important}

/* ---------- credit ledger: customer list ---------- */
html body #skCreditLedgerPage .skcp-row{align-items:center!important;gap:10px!important;padding:10px 12px!important}
html body #skCreditLedgerPage .skcp-row-main{min-width:0!important;flex:1 1 0!important}
html body #skCreditLedgerPage .skcp-name{font-size:.95rem!important;line-height:1.2!important;white-space:normal!important;overflow-wrap:anywhere}
html body #skCreditLedgerPage .skcp-sub{font-size:.72rem!important;line-height:1.3!important}
html body #skCreditLedgerPage .skcp-row > div:not(.skcp-row-main):not(.sk-credit-avatar){flex:0 0 auto!important;text-align:right!important;min-width:0!important}
html body #skCreditLedgerPage .skcp-amt{white-space:nowrap!important;font-size:.98rem!important;font-weight:900!important;line-height:1.15!important}
html body #skCreditLedgerPage .skcp-bill{white-space:nowrap!important;font-size:.6rem!important;letter-spacing:.03em;font-weight:800;text-align:right!important}
html body #skCreditLedgerPage .skcp-row > .skcp-btn{width:34px!important;height:34px!important;min-width:0!important;padding:0!important;border-radius:11px!important;flex:0 0 34px!important}
html body #skCreditLedgerPage .skcp-toolbar{display:flex!important;gap:8px!important;align-items:center}
html body #skCreditLedgerPage .skcp-toolbar .form-input{flex:1 1 auto!important;min-width:0!important}
html body #skCreditLedgerPage .skcp-toolbar .skcp-btn{flex:0 0 auto!important;width:auto!important;padding:0 14px!important;min-height:44px!important;white-space:nowrap}

/* ---------- credit ledger: customer detail (screen 9) ---------- */
html body #skCPDetailView{padding:2px 0 14px}
html body #skCPDetailView .skcp-page-head{display:flex!important;align-items:center!important;gap:10px!important;margin:4px 0 10px!important;padding:0!important}
html body #skCPDetailView .skcp-back{flex:0 0 auto!important;width:auto!important;min-height:40px!important;padding:0 14px!important;border-radius:13px!important;font-weight:800;white-space:nowrap}
html body #skCPDetailView .skcp-det-av{flex:0 0 46px!important;width:46px!important;height:46px!important;border-radius:15px!important;font-size:1.15rem!important}
html body #skCPDetailView .skcp-det-who{min-width:0;flex:1 1 auto}
html body #skCPDetailView .skcp-det-who > b{display:block;font-size:1.05rem;line-height:1.2;overflow-wrap:anywhere}
html body #skCPDetailView .skcp-detail-box{padding:10px!important;border-radius:18px!important;margin-bottom:10px}
html body #skCPDetailView .skcp-detail-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;margin-bottom:10px!important}
html body #skCPDetailView .skcp-mini{display:flex!important;flex-direction:column!important;justify-content:center;align-items:flex-start;gap:3px;padding:10px 9px!important;border-radius:14px!important;min-width:0}
html body #skCPDetailView .skcp-mini b{font-size:1rem!important;line-height:1.15;white-space:nowrap;max-width:100%}
html body #skCPDetailView .skcp-mini span{font-size:.58rem!important;line-height:1.15;font-weight:800;letter-spacing:.02em;color:var(--text-muted)}
html body #skCPDetailView .skcp-detail-grid .skcp-mini:nth-child(1) b{color:#dc2626}
html body #skCPDetailView .skcp-detail-grid .skcp-mini:nth-child(2) b{color:#2563eb}
html body #skCPDetailView .skcp-detail-grid .skcp-mini:nth-child(3) b{color:#16a34a}
html body #skCPDetailView .skcp-bill-actions{display:grid!important;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:8px!important;margin-top:8px!important;align-items:stretch}
html body #skCPDetailView .skcp-bill-actions .skcp-btn{width:100%!important;min-width:0!important;min-height:44px!important;padding:0 8px!important;border-radius:13px!important;font-size:.8rem!important;white-space:nowrap;justify-content:center}
html body #skCPDetailView .skcp-bill-actions > span{display:flex;align-items:center;justify-content:center;min-height:44px;padding:0 8px!important;border-radius:13px;background:#dcfce7;color:#166534!important;font-weight:900;font-size:.78rem!important;white-space:nowrap}
html body #skCPDetailView .skcp-bill-card{padding:12px!important;border-radius:16px!important;margin-bottom:10px!important}
html body #skCPDetailView .skcp-bill-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
html body #skCPDetailView .skcp-bill-top > b{white-space:nowrap;font-size:1.02rem}
html body #skCPDetailView .skcp-sales-bill-finance{margin:8px 0 2px!important;padding:8px 10px;border-radius:11px;background:rgba(37,99,235,.07);font-size:.72rem!important;font-weight:700;line-height:1.5}

/* ---------- Payment / Credit popup ---------- */
html body #skCreditActionModal .modal-sheet{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px!important;align-content:start;padding-top:12px!important}
html body #skCreditActionModal .modal-sheet > *{grid-column:1/-1;min-width:0}
html body #skCreditActionModal .modal-sheet > .modal-title{margin:0 0 2px!important;position:static!important}
html body #skCreditActionModal .form-group{margin:0!important}
html body #skCreditActionModal .form-label{margin:0 0 4px!important;font-size:.72rem!important}
html body #skCreditActionModal .form-group:has(#skCPAmount),
html body #skCreditActionModal #skCPAdvanceGroup,
html body #skCreditActionModal .form-group:has(#skCPBalance),
html body #skCreditActionModal .form-group:has(#skCPDate),
html body #skCreditActionModal #skCPDueDateGroup,
html body #skCreditActionModal .form-group:has(#skCPCategory),
html body #skCreditActionModal #skCPPaymentModeGroup{grid-column:span 1}
html body #skCreditActionModal .form-group:has(#skCPName),html body #skCreditActionModal .form-group:has(#skCPPhone){grid-column:span 1}
html body #skCreditActionModal #skCPEmiFields{display:none}
html body #skCreditActionModal #skCPEmiFields[style*="display: grid"],html body #skCreditActionModal #skCPEmiFields[style*="display:grid"],html body #skCreditActionModal #skCPEmiFields[style*="display: block"]{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}
html body #skCreditActionModal textarea{min-height:56px!important}
html body #skCreditActionModal .submit-btn{margin-top:4px!important}

html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-auto-flow:row!important;gap:8px!important;flex-direction:row!important}
html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn{width:100%!important;min-height:46px!important;margin:0!important;flex:1 1 0!important}
html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn.credit{background:linear-gradient(135deg,#2563eb,#4f46e5)!important;color:#fff!important;border-color:transparent!important}
html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn.pay{background:linear-gradient(135deg,#16a34a,#22c55e)!important;color:#fff!important;border-color:transparent!important}
html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn.credit .ski,html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn.pay .ski{background:transparent!important}
html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn.credit .ski::before,html body #skCreditLedgerPage #skCPDetailView .skcp-detail-box > .skcp-bill-actions .skcp-btn.pay .ski::before{background:#fff!important}

/* ---------- Repair Details (screen 11) ---------- */
html body #skRepairDetailContent .rjd{display:flex;flex-direction:column;gap:10px;padding:2px 0 8px}
html body .rjd svg{width:18px;height:18px;flex:0 0 18px;display:block}
html body .rjd-hero{display:flex;align-items:center;gap:12px;padding:12px;border-radius:20px;background:linear-gradient(135deg,#eff6ff,#e0e7ff);border:1px solid #c7d2fe}
html body .rjd-device{flex:0 0 64px;width:64px;height:76px;border-radius:16px;background:#fff;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 16px rgba(37,99,235,.18)}
html body .rjd-device svg{width:50px;height:60px;flex:none}
html body .rjd-who{min-width:0;display:flex;flex-direction:column;gap:2px}
html body .rjd-who b{font-size:1.08rem;line-height:1.2;overflow-wrap:anywhere;color:#0f172a}
html body .rjd-who span{font-size:.9rem;font-weight:700;color:#334155;overflow-wrap:anywhere}
html body .rjd-who small{display:flex;align-items:center;gap:5px;font-size:.78rem;color:#475569;font-weight:600}
html body .rjd-who small svg{width:14px;height:14px;flex-basis:14px}
html body .rjd-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
html body .rjd-btn{display:flex!important;align-items:center;justify-content:center;gap:7px;min-height:48px;padding:0 8px!important;margin:0!important;border:0!important;border-radius:15px!important;color:#fff!important;font-weight:800;font-size:.82rem!important;width:100%!important;min-width:0!important;white-space:nowrap;box-shadow:0 6px 14px rgba(15,23,42,.14)}
html body .rjd-btn span{min-width:0;overflow:hidden;text-overflow:ellipsis}
html body .rjd-btn.call{background:linear-gradient(135deg,#2563eb,#4f46e5)!important}
html body .rjd-btn.wa{background:linear-gradient(135deg,#16a34a,#22c55e)!important}
html body .rjd-btn[disabled]{opacity:.45;filter:grayscale(.5);box-shadow:none;cursor:not-allowed}
html body .rjd-problem,html body .rjd-note{padding:11px 12px;border-radius:16px;background:#fff7ed;border:1px solid #fed7aa}
html body .rjd-note{background:#f8fafc;border-color:#e2e8f0}
html body .rjd-problem small,html body .rjd-note small,html body .rjd-chip small{display:block;font-size:.62rem;font-weight:900;letter-spacing:.06em;color:#64748b;margin-bottom:3px}
html body .rjd-problem p,html body .rjd-note p{margin:0;font-size:.88rem;font-weight:600;color:#1e293b;overflow-wrap:anywhere;line-height:1.4}
html body .rjd-chips{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
html body .rjd-chip{padding:9px 8px;border-radius:14px;background:#f1f5f9;border:1px solid #e2e8f0;min-width:0}
html body .rjd-chip b{display:flex;align-items:center;gap:5px;font-size:.76rem;line-height:1.2;color:#0f172a;overflow-wrap:anywhere}
html body .rjd-chip b svg{width:15px;height:15px;flex-basis:15px;color:#2563eb}
html body .rjd-chip.st-delivered,html body .rjd-chip.st-ready,html body .rjd-chip.st-completed{background:#dcfce7;border-color:#86efac}
html body .rjd-chip.st-delivered b svg,html body .rjd-chip.st-ready b svg,html body .rjd-chip.st-completed b svg{color:#16a34a}
html body .rjd-chip.st-pending,html body .rjd-chip.st-in-progress,html body .rjd-chip.st-received{background:#fef3c7;border-color:#fde68a}
html body .rjd-chip.st-pending b svg,html body .rjd-chip.st-in-progress b svg,html body .rjd-chip.st-received b svg{color:#d97706}
html body .rjd-sched{display:flex;align-items:center;gap:8px;padding:9px 12px;border-radius:14px;background:#ede9fe;color:#5b21b6;font-size:.8rem}
html body .rjd-money{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;margin:0!important;padding:0!important;background:none!important;border:0!important}
html body .rjd-card{display:flex!important;flex-direction:column;gap:3px;padding:11px 12px!important;border-radius:16px!important;background:#eff6ff!important;border:1px solid #bfdbfe!important;min-width:0}
html body .rjd-card span{font-size:.7rem;font-weight:800;color:#64748b}
html body .rjd-card b{font-size:1.15rem;font-weight:900;color:#1d4ed8;white-space:nowrap}
html body .rjd-card.paid{background:#f0fdf4!important;border-color:#bbf7d0!important}
html body .rjd-card.paid b{color:#16a34a}
html body .rjd-card.due{grid-column:1/-1;flex-direction:row;align-items:center;justify-content:space-between;background:linear-gradient(135deg,#fee2e2,#ffe4e6)!important;border:1.5px solid #fca5a5!important;padding:14px!important}
html body .rjd-card.due span{font-size:.85rem;color:#991b1b}
html body .rjd-card.due b{font-size:1.5rem;color:#dc2626}
html body .rjd-problem,html body .rjd-note{padding:11px 13px!important}
html body .rjd-chip{padding:9px 10px!important}
html body .rjd-sched{padding:9px 12px!important}
html body .rjd-money .rjd-card.due{flex-direction:row!important;align-items:center!important;justify-content:space-between!important}
html body .rjd-money .rjd-card:nth-child(odd):nth-last-child(2){grid-column:1/-1}
html body .rjd-money .rjd-card span{white-space:normal}

/* ==========================================================================
   Compact forms: 2-column pairs, tighter gaps (all via :has, no markup change)
   ========================================================================== */
html body .modal-sheet .form-group{margin-bottom:8px!important}
html body .modal-sheet .form-label{margin-bottom:4px!important}
html body .modal-sheet .form-input,html body .modal-sheet .form-select{min-height:42px!important;padding-top:8px!important;padding-bottom:8px!important}
html body .modal-sheet textarea.form-input{min-height:64px!important}

/* Credit entry */
html body #skCreditEntryModal .modal-sheet{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px!important;align-content:start}
html body #skCreditEntryModal .modal-sheet > *{grid-column:1/-1;min-width:0}
html body #skCreditEntryModal .modal-sheet > .form-group{margin:0!important}
html body #skCreditEntryModal .form-group:has(#skCreditName),html body #skCreditEntryModal .form-group:has(#skCreditPhone),
html body #skCreditEntryModal .form-group:has(#skCreditAmount),html body #skCreditEntryModal .form-group:has(#skCreditMode),
html body #skCreditEntryModal .form-group:has(#skCreditDate),html body #skCreditEntryModal .form-group:has(#skCreditCategory),
html body #skCreditEntryModal .form-group:has(#skCreditDueDateV43){grid-column:span 1}
html body #skCreditEntryModal .form-group:has(#skCreditName),html body #skCreditEntryModal .form-group:has(#skCreditPhone){grid-column:span 1}

/* Item editor */
html body #itemEditorForm{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 10px!important}
html body #itemEditorForm > *{grid-column:1/-1;min-width:0}
html body #itemEditorForm > .form-group{margin:0 0 4px!important}
html body #itemEditorForm .form-group:has(#editItemCategory),html body #itemEditorForm .form-group:has(#editItemStock){grid-column:span 1}

/* ==========================================================================
   Coloured field icons (added by js/features/form-icons-v145.js)
   ========================================================================== */
html body .sk-fi{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:7px;margin-right:6px;vertical-align:-5px;flex:0 0 20px;background:var(--fi-bg,#dbeafe);color:var(--fi,#2563eb)}
html body .sk-fi svg{width:13px;height:13px;display:block}
html body .sk-fi.c-blue{--fi:#2563eb;--fi-bg:#dbeafe}html body .sk-fi.c-green{--fi:#16a34a;--fi-bg:#dcfce7}
html body .sk-fi.c-orange{--fi:#ea580c;--fi-bg:#ffedd5}html body .sk-fi.c-violet{--fi:#7c3aed;--fi-bg:#ede9fe}
html body .sk-fi.c-pink{--fi:#db2777;--fi-bg:#fce7f3}html body .sk-fi.c-teal{--fi:#0d9488;--fi-bg:#ccfbf1}
html body .sk-fi.c-red{--fi:#dc2626;--fi-bg:#fee2e2}html body .sk-fi.c-amber{--fi:#d97706;--fi-bg:#fef3c7}
html body .sk-fi.c-slate{--fi:#475569;--fi-bg:#e2e8f0}
html body .form-label:has(> .sk-fi){display:flex;align-items:center;gap:0}
html body label.form-label:has(> input) > .sk-fi,html body label.form-label:has(> select) > .sk-fi{align-self:flex-start}

html body .sk-pair{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:0 10px!important}
html body .sk-pair > .form-group{min-width:0;margin-bottom:8px!important}
/* credit entry ordering: Date | Category, Due full, Details full */
html body #skCreditEntryModal .form-group:has(#skCreditDetails){order:5}
html body #skCreditEntryModal .form-group:has(#skCreditDueDateV43){order:4;grid-column:1/-1}
html body #skCreditEntryModal .form-group:has(select):not(:has(#skCreditMode)){grid-column:span 1}
html body #skCreditEntryModal .submit-btn,html body #skCreditEntryModal .modal-sheet > button{order:9}
html body .sk-fl{display:flex!important;align-items:center;gap:0;text-align:left!important;align-self:stretch;justify-content:flex-start!important;width:100%}
html body .sk-fl > span:last-child{min-width:0;text-align:left!important}
html body label.form-label:has(> .sk-fl){align-items:stretch!important;text-align:left!important}
html body #skCreditEntryModal .modal-sheet > div:has(#skCreditCategory){grid-column:span 1!important}
html body #skCreditEntryModal .modal-sheet > div:has(#skCreditCategory) .form-group{margin:0!important}

/* ==========================================================================
   Button rows: equal width, horizontal (3–4 per row)
   ========================================================================== */
html body .repair-spares-actions,html body .tools-others-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
html body .repair-spares-actions .repair-spares-action{width:100%!important;min-width:0!important;min-height:46px!important;margin:0!important;white-space:normal;font-size:.8rem!important;line-height:1.15;padding:6px 8px!important}
html body #skUsedPurchaseActions .sk-used-action-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;margin-top:8px!important}
html body #skUsedPurchaseActions .sk-used-action-secondary{width:100%!important;min-width:0!important;min-height:52px!important;margin:0!important;padding:6px 4px!important;grid-column:auto!important;display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-align:center;font-size:.72rem!important;line-height:1.15}
html body #skUsedPurchaseActions .sk-used-action-secondary span{white-space:normal;word-break:normal}

/* higher-specificity override of the polish-v143 2-column rule */
html.sk-cui body #skUsedStockModal #skUsedPurchaseActions .sk-used-action-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important}
html.sk-cui body #skUsedStockModal #skUsedPurchaseActions .sk-used-action-grid > *{grid-column:auto!important}

/* compact stat boxes (used stock + credit ledger) so they fit small phones */
html body #skUsedStatsGrid{gap:8px!important}
html body #skUsedStatsGrid .sk-used-stat-card{padding:9px 10px!important;min-height:0!important;gap:8px!important}
html body #skUsedStatsGrid .sk-used-stat-icon{width:38px!important;height:38px!important;flex:0 0 38px!important}
html body #skUsedStatsGrid .sk-used-stat-card strong{font-size:1.25rem!important}
html body #skUsedStatsGrid .sk-used-stat-card small{font-size:.72rem!important}
@media (max-width:480px){
  html.sk-cui body #skCreditLedgerPage .skcp-stat b{font-size:1.2rem!important;white-space:nowrap}
  html.sk-cui body #skCreditLedgerPage .skcp-stat span{font-size:.62rem!important;line-height:1.15}
}
html body #repairSparesModal .repair-spares-info{display:flex!important;align-items:flex-start!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;padding:12px 14px!important;margin:0 0 10px!important;line-height:1.45!important;box-sizing:border-box!important}
html body .modal-sheet > *{flex-shrink:0}
