/* =====================================================================
   MSING DIGITAL POS — styles (assets/css/style.css)
   Bootstrap 5.3 + a small custom layer. Copy to public/css in Laravel.
   ===================================================================== */
:root {
  --brand: #0e4f6e;
  --brand-dark: #0a3a52;
  --brand-soft: #e7f1f6;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --sidebar: 248px;
  --topbar: 60px;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-primary: #0e4f6e;
  --bs-primary-rgb: 14, 79, 110;
  --bs-link-color: #0e4f6e;
  --bs-link-color-rgb: 14, 79, 110;
}
body { background: var(--bg); color: var(--text); font-size: .925rem; }

/* ---------- Bootstrap brand overrides ---------- */
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --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); --bs-btn-active-border-color: var(--brand); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #f1f5f9; --bs-btn-hover-border-color: #cbd5e1; }
.form-control:focus, .form-select:focus { border-color: #7fb3c9; box-shadow: 0 0 0 .2rem rgba(14, 79, 110, .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-tabs .nav-link { color: var(--muted); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 600; }
.text-brand { color: var(--brand) !important; }
.modal-content { border: 0; border-radius: 18px; }
.modal-header { border-bottom-color: var(--line); }
.modal-footer { border-top-color: var(--line); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(circle at 15% 10%, #1b6f96 0, transparent 45%), radial-gradient(circle at 90% 90%, #b45309 0, transparent 35%), linear-gradient(160deg, #0a3a52, #0e4f6e 55%, #12303f); }
.login-card { background: #fff; border-radius: 24px; padding: 30px 26px; width: 100%; max-width: 360px; box-shadow: 0 30px 60px rgba(0, 0, 0, .28); text-align: center; }
.logo-mark { width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), #fbbf24); color: #1f2937; display: grid; place-items: center; font-size: 27px; margin: 0 auto 12px; box-shadow: 0 8px 18px rgba(245, 158, 11, .35); }
.logo-mark.sm { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; margin: 0; box-shadow: none; flex: none; }
.login-brand h1 { font-size: 1.55rem; font-weight: 800; margin: 0; color: var(--brand-dark); letter-spacing: -.02em; }
.login-brand p { color: var(--muted); margin: 2px 0 18px; font-size: .9rem; }
.login-hint-title { font-weight: 600; margin-bottom: 4px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 12px 0 6px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #cbd5e1; transition: .15s; }
.pin-dots span.filled { background: var(--brand); border-color: var(--brand); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
.pin-dots.shake span { border-color: var(--bad); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-9px); } 75% { transform: translateX(9px); } }
.login-error { min-height: 20px; color: var(--bad); font-size: .85rem; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.keypad button { height: 62px; border-radius: 16px; border: 1px solid var(--line); background: #f8fafc; font-size: 1.45rem; font-weight: 600; color: var(--text); transition: .1s; }
.keypad button:hover { background: var(--brand-soft); }
.keypad button:active { transform: scale(.95); background: #d4e7ef; }
.keypad .k-fn { font-size: 1.1rem; color: var(--muted); }
.demo-pins { margin-top: 18px; font-size: .78rem; color: var(--muted); background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px; padding: 8px; }
.login-footer { color: rgba(255, 255, 255, .75); font-size: .8rem; margin-top: 18px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--brand-dark); color: #fff; display: flex; flex-direction: column; z-index: 1040; transition: transform .25s ease; }
.sb-brand { display: flex; gap: 10px; align-items: center; padding: 14px 16px; height: var(--topbar); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sb-title { font-weight: 800; letter-spacing: -.01em; }
.sb-sub { font-size: .72rem; opacity: .65; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 10px; }
.sb-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; opacity: .5; padding: 14px 12px 6px; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 500; font-size: .9rem; cursor: pointer; margin-bottom: 2px; }
.sb-link i { font-size: 1.1rem; }
.sb-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sb-link.active { background: var(--accent); color: #1f2937; font-weight: 600; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #1f2937; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.avatar.alt { background: var(--brand-soft); color: var(--brand); }
.min-w-0 { min-width: 0; }
.sb-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 20px; position: sticky; top: 0; z-index: 1020; }
.page-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.clock { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.content { padding: 20px; flex: 1; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border-radius: 10px; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sb-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; }
}

/* ---------- Generic UI ---------- */
.card-soft { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card-soft h6 { font-weight: 700; margin-bottom: .75rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: .75rem; }
.card-head h6 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-box { position: relative; min-width: 200px; flex: 1; max-width: 360px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 36px; }
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .65rem .85rem; border-bottom-color: #eef2f6; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: #dcfce7; color: #166534; }
.pill-warn { background: #fef3c7; color: #92400e; }
.pill-bad { background: #fee2e2; color: #991b1b; }
.pill-info { background: var(--brand-soft); color: var(--brand); }
.pill-muted { background: #f1f5f9; color: #475569; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty i { font-size: 2.2rem; opacity: .35; display: block; margin-bottom: 6px; }
.stat { padding: 14px 16px; }
.stat .l { font-size: .78rem; color: var(--muted); }
.stat .v { font-size: 1.2rem; font-weight: 800; }
.kpi { padding: 16px; display: flex; gap: 12px; align-items: flex-start; height: 100%; }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.kpi-label { font-size: .78rem; color: var(--muted); }
.kpi-value { font-size: 1.25rem; font-weight: 800; line-height: 1.25; word-break: break-word; }
.kpi-delta { font-size: .72rem; font-weight: 600; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 260px; }
.period-group .btn { font-weight: 600; }
.bar-track { height: 6px; background: #eef2f6; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 99px; }
.link-row { cursor: pointer; }
#toasts { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }

/* ---------- POS ---------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; height: calc(100vh - var(--topbar) - 40px); }
.pos-left { display: flex; flex-direction: column; min-height: 0; }
.pos-search { display: flex; gap: 8px; position: relative; margin-bottom: 12px; }
.pos-search > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: var(--muted); z-index: 2; }
.pos-search input { padding-left: 46px; border-radius: 12px; }
.pos-search .btn { border-radius: 12px; width: 52px; flex: none; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; scrollbar-width: thin; flex: none; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .42rem .9rem; font-size: .84rem; font-weight: 500; color: var(--text); }
.chip:hover { border-color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.p-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; padding: 2px 4px 10px 2px; }
.p-card { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 3px; transition: .12s; position: relative; min-height: 150px; }
.p-card:hover:not(:disabled) { border-color: var(--brand); box-shadow: 0 6px 16px rgba(14, 79, 110, .12); transform: translateY(-1px); }
.p-card:active:not(:disabled) { transform: scale(.97); }
.p-card:disabled { opacity: .5; cursor: not-allowed; }
.p-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 1.05rem; margin-bottom: 4px; }
.p-icon.kit { background: #fef3c7; color: #b45309; }
.p-name { font-weight: 600; font-size: .86rem; line-height: 1.25; }
.p-meta { font-size: .72rem; color: var(--muted); }
.p-price { font-weight: 800; color: var(--brand-dark); margin-top: auto; }
.p-price small { font-size: .7rem; }
.p-badge { position: absolute; top: 10px; right: 10px; }
.pos-cart { display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 12px; border-bottom: 1px solid var(--line); }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 12px; }
.cart-empty { text-align: center; color: var(--muted); padding: 50px 12px; }
.cart-empty i { font-size: 2.6rem; opacity: .35; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.cart-line.flash { animation: flash .6s; }
@keyframes flash { from { background: #fef3c7; } to { background: transparent; } }
.cl-name { font-weight: 600; font-size: .86rem; line-height: 1.25; }
.cl-sub { font-size: .74rem; color: var(--muted); }
.cl-right { text-align: right; }
.cl-total { font-weight: 700; white-space: nowrap; }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; justify-self: start; }
.qty-ctl button { border: 0; background: #f8fafc; width: 32px; height: 32px; }
.qty-ctl button:hover { background: var(--brand-soft); }
.qty-ctl input { width: 58px; border: 0; text-align: center; font-weight: 600; height: 32px; -moz-appearance: textfield; }
.qty-ctl input::-webkit-outer-spin-button, .qty-ctl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cl-del { border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 8px; }
.cl-del:hover { color: var(--bad); background: #fee2e2; }
.cart-foot { padding: 12px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }
.tot-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: .9rem; }
.tot-row.grand { font-size: 1.35rem; font-weight: 800; color: var(--brand-dark); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.disc-input { width: 110px; text-align: right; }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin: 10px 0; }
.btn-pay { background: var(--accent); color: #1f2937; font-weight: 800; font-size: 1.08rem; padding: 14px; border-radius: 12px; border: 0; }
.btn-pay:hover { background: var(--accent-dark); color: #111; }
.btn-pay:disabled { background: #e2e8f0; color: #94a3b8; }
.btn-pay kbd { background: rgba(0, 0, 0, .14); color: inherit; font-size: .68rem; margin-left: 6px; }
@media (max-width: 1199.98px) { .pos-grid { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 767.98px) {
  .pos-grid { grid-template-columns: 1fr; height: auto; }
  .p-grid { max-height: 50vh; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .cart-lines { max-height: 45vh; }
}

/* ---------- Payment ---------- */
.pay-total { text-align: center; padding: 4px 0 14px; }
.pay-total .l { color: var(--muted); font-size: .85rem; }
.pay-total .amt { font-size: 2.2rem; font-weight: 800; color: var(--brand-dark); letter-spacing: -.02em; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.method-btn { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 4px; font-weight: 600; font-size: .82rem; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.method-btn i { font-size: 1.4rem; }
.method-btn.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.method-btn[data-m="mpesa"].active { border-color: #16a34a; background: #dcfce7; color: #166534; }
.quick-cash { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.change-box { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #f0fdf4; display: flex; justify-content: space-between; font-weight: 700; font-size: 1.1rem; color: #166534; }
.change-box.short { background: #fef2f2; color: #991b1b; }
.mpesa-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px; font-size: .85rem; }
.sale-banner { background: #dcfce7; color: #166534; border-radius: 12px; padding: 10px 14px; font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- Products / bundles ---------- */
.calc-box { background: var(--brand-soft); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.calc-box .v { font-weight: 800; font-size: 1.1rem; }
.calc-box .l { font-size: .72rem; color: var(--muted); }
.b-card { padding: 16px; height: 100%; display: flex; flex-direction: column; }
.b-comp { font-size: .84rem; display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.row-editor .row-item { display: grid; grid-template-columns: 1fr 90px 110px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
.row-editor.no-cost .row-item { grid-template-columns: 1fr 100px 36px; }

/* ---------- Accounts / roles ---------- */
.acc-type-row td { background: #f8fafc !important; font-weight: 700; color: var(--brand-dark); }
.acc-header td { font-weight: 600; }
.fin-table td:last-child, .fin-table th:last-child { text-align: right; }
.fin-table .sub td { font-weight: 700; border-top: 2px solid var(--line); }
.fin-table .grand td { font-weight: 800; font-size: 1.05rem; background: var(--brand-soft) !important; }
.perm-table td, .perm-table th { text-align: center; vertical-align: middle; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.journal-group td { border-bottom: 0; }
.journal-group.first td { border-top: 1px solid var(--line); }

/* ---------- Receipt (screen + print) ---------- */
.receipt { font-family: 'Courier New', Courier, monospace; font-size: 12px; width: 300px; max-width: 100%; margin: 0 auto; color: #000; background: #fff; padding: 14px; line-height: 1.35; }
.receipt-wrap { background: #f1f5f9; border-radius: 12px; padding: 14px; max-height: 60vh; overflow-y: auto; }
.receipt .c { text-align: center; }
.receipt .hr { border-top: 1px dashed #000; margin: 6px 0; }
.receipt .row2 { display: flex; justify-content: space-between; gap: 8px; }
.receipt .big { font-size: 14px; font-weight: 700; }
.receipt .biz { font-size: 15px; font-weight: 700; text-transform: uppercase; }
.receipt .qr { width: 84px; height: 84px; margin: 6px auto; border: 1px solid #000; display: grid; place-items: center; font-size: 9px; background: repeating-linear-gradient(45deg, #fff 0 4px, #eee 4px 8px); }
#print-area { display: none; }
@media print {
  @page { size: 80mm auto; margin: 0; }
  body { background: #fff !important; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing .receipt { width: 72mm; padding: 3mm; font-size: 11px; }
}

/* ---------- Laravel integration additions ---------- */
.logo-mark.logo-img { object-fit: contain; background: #fff; padding: 4px; }
.login-card .form-control { border-radius: 12px; padding: .6rem .85rem; }
.login-card .btn-primary { border-radius: 12px; }
.login-card .alert { border-radius: 12px; text-align: left; }
.sb-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
fieldset:disabled .form-control, fieldset:disabled .form-select { background-color: #f8fafc; }
.etims-opt { background: #f8fafc; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.etims-opt:has(input:checked) { background: var(--brand-soft); border-color: #7fb3c9; }
