:root{
  --bg:#0f172a;--panel:#111827;--card:#1e293b;--card2:#172033;
  --input:#1e293b;--border:#334155;--text:#fff;--muted:#94a3b8;
  --green:#22c55e;--red:#ef4444;--amber:#f59e0b;--blue:#38bdf8;
  --purple:#a78bfa;--radius:18px
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html{scroll-behavior:smooth}
body{
  background:linear-gradient(180deg,#0f172a,#020617);
  color:var(--text);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  min-height:100vh;
  padding-bottom:90px;
  -webkit-font-smoothing:antialiased
}
.app{width:100%;max-width:760px;margin:0 auto;padding:14px}
.topbar{display:flex;justify-content:space-between;align-items:center;padding:8px 2px 16px}
.brand{font-size:24px;font-weight:900;letter-spacing:-.5px}
.muted{color:var(--muted);font-size:13px}
.list-sub{color:var(--muted);font-size:13px;line-height:1.4}

/* Cards */
.card,.list-item{
  background:linear-gradient(180deg,var(--card),var(--card2));
  border:1px solid #263449;border-radius:var(--radius);
  padding:14px;margin-bottom:12px;
  box-shadow:0 10px 22px #00000024
}
.card-title{font-size:16px;font-weight:800;margin-bottom:12px}
.hint{font-size:12px;color:var(--muted);margin-top:6px;line-height:1.4}

/* Forms */
.form-group{margin-bottom:12px}
label{display:block;color:var(--muted);font-size:13px;margin-bottom:6px}
input,select,textarea{
  width:100%;border:1px solid var(--border);border-radius:14px;
  background:var(--input);color:#fff;padding:14px;font-size:16px;outline:none;
  -webkit-appearance:none;appearance:none
}
input:focus,select:focus,textarea:focus{border-color:#475569}
textarea{min-height:80px;resize:vertical}
select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;padding-right:36px}
select option{background:#1e293b;color:#fff}

/* Buttons */
.btn{
  width:100%;border:none;border-radius:15px;
  padding:15px 16px;font-size:16px;font-weight:800;
  cursor:pointer;text-decoration:none;
  display:flex;justify-content:center;align-items:center;gap:8px;
  transition:transform .12s,opacity .12s
}
.btn:active{transform:scale(.97)}
.btn-primary{background:var(--green);color:#041306}
.btn-danger{background:var(--red);color:#fff}
.btn-warning{background:var(--amber);color:#111}
.btn-blue{background:var(--blue);color:#07121a}
.btn-ghost{background:#0f172a;color:#fff;border:1px solid var(--border)}

/* Dashboard grid */
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-bottom:12px}
.stat{
  border-radius:20px;padding:15px;
  background:linear-gradient(160deg,#1e293b,#111827);
  border:1px solid #263449;min-height:112px;
  display:flex;flex-direction:column;justify-content:space-between;
  text-decoration:none;color:inherit
}
.stat .icon{font-size:22px}
.stat .value{font-size:20px;font-weight:950;letter-spacing:-.5px}
.stat .label{color:var(--muted);font-size:13px}
.stat .count{font-size:12px;color:#cbd5e1}
.wide{grid-column:1 / -1}

/* List items */
.list-title{font-size:17px;font-weight:800;margin-bottom:4px}
.amount{font-size:20px;font-weight:950;white-space:nowrap}
.row{display:flex;align-items:center;justify-content:space-between;gap:10px}

/* Badges */
.badge{
  display:inline-flex;align-items:center;gap:5px;
  padding:5px 10px;border-radius:999px;
  font-size:12px;font-weight:800;white-space:nowrap
}
.badge.collected{background:#f59e0b22;color:#fbbf24}
.badge.cleared,.badge.completed,.badge.settled{background:#22c55e22;color:#4ade80}
.badge.returned{background:#ef444422;color:#f87171}
.badge.credit,.badge.outstanding{background:#38bdf822;color:#7dd3fc}
.badge.cash{background:#22c55e22;color:#4ade80}
.badge.cheque{background:#a78bfa22;color:#c4b5fd}
.badge.bank-transfer,.badge.banktransfer{background:#38bdf822;color:#7dd3fc}
.badge.recovery{background:rgba(56,189,248,.18);color:#38bdf8}

/* Action buttons */
.actions{display:flex;gap:10px;margin-top:12px;align-items:center;flex-wrap:wrap}
.actions.tight{margin-top:8px;gap:6px}
.icon-actions{margin-top:10px}
.icon-form{display:inline}
.action-btn{
  width:48px;height:48px;border:none;border-radius:50%;
  font-size:22px;font-weight:950;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;text-decoration:none;
  box-shadow:0 6px 14px #00000030;
  transition:transform .12s
}
.action-btn:active{transform:scale(.9)}
.action-btn.clear{background:var(--green);color:#061507}
.action-btn.return{background:var(--red);color:#fff}
.action-btn.recover{background:var(--blue);color:#06141a}

/* Bottom nav */
.bottom-nav{
  position:fixed;bottom:0;left:0;right:0;height:72px;
  background:#020617ee;backdrop-filter:blur(14px);
  border-top:1px solid #263449;
  display:flex;justify-content:center;gap:13px;align-items:center;
  z-index:99;
  padding-bottom:env(safe-area-inset-bottom)
}
.bottom-nav a{
  width:54px;height:54px;border-radius:18px;
  display:flex;align-items:center;justify-content:center;
  text-decoration:none;font-size:25px;color:#fff;
  transition:transform .12s
}
.bottom-nav a.active{background:#1e293b;border:1px solid #334155}
.bottom-nav a:active{transform:scale(.9)}

/* Quick actions (2-col CTA row) */
.quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
.quick-actions .btn{padding:13px;font-size:14px}

/* Summary lines */
.summary-line{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #263449}
.summary-line:last-child{border-bottom:0}

/* Misc */
.empty{text-align:center;color:var(--muted);padding:22px}
.error{background:#ef444422;color:#fca5a5;padding:12px;border-radius:14px;margin-bottom:12px;line-height:1.4}
.success{background:#22c55e22;color:#86efac;padding:12px;border-radius:14px;margin-bottom:12px;line-height:1.4}
.mini-summary{
  display:flex;justify-content:space-between;gap:10px;
  background:#0f172a;border:1px solid #263449;border-radius:14px;
  padding:9px 10px;margin-top:8px;font-size:13px;color:#cbd5e1
}
.mini-summary strong{color:#fff}

/* Progress bar */
.progress{height:10px;background:#334155;border-radius:999px;overflow:hidden;margin:10px 0 6px}
.progress>div{height:100%;background:var(--green);border-radius:999px}

/* Compact filter card */
.compact-filter{padding-bottom:12px}

/* Payment card */
.payment-card{padding:13px}
.payment-card .amount{font-size:18px}

/* Filters / tabs */
.tabs{display:flex;gap:8px;overflow:auto;margin-bottom:12px;padding-bottom:4px;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tabs a{
  white-space:nowrap;text-decoration:none;color:#fff;
  background:#1e293b;border:1px solid #334155;
  border-radius:999px;padding:10px 14px;font-size:13px;font-weight:700
}
.tabs a.active{background:var(--green);color:#041306;border-color:transparent}

/* Date grid */
.date-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.date-grid .form-group{margin-bottom:0}
input[data-date-placeholder][type="text"]{color:#fff}
input[data-date-placeholder][type="text"]::placeholder{color:#9ca3af;opacity:1}

/* PIN / Lock screen */
.lock-body{padding-bottom:0;min-height:100vh;display:flex;align-items:center;justify-content:center}
.lock-wrap{width:100%;max-width:430px;padding:18px}
.lock-card{
  background:linear-gradient(180deg,var(--card),var(--card2));
  border:1px solid #263449;border-radius:26px;
  padding:26px;box-shadow:0 18px 40px #00000045;text-align:center
}
.lock-logo{font-size:48px;margin-bottom:8px}
.lock-brand{font-size:28px;font-weight:900}
.lock-sub{margin:8px 0 18px}
.pin-input{text-align:center;font-size:32px;font-weight:900;letter-spacing:12px;margin-bottom:14px}
.pin-input::placeholder{letter-spacing:12px;color:#94a3b8}
.change-pin-box{margin-top:16px;text-align:left;border-top:1px solid #263449;padding-top:12px}
.change-pin-box summary{cursor:pointer;color:var(--muted);font-size:14px;text-align:center;list-style:none;padding:8px}
.change-pin-box summary::-webkit-details-marker{display:none}
.change-pin-box[open] summary{color:#fff;font-weight:800}
.change-pin-box .form-group{margin-bottom:10px}
.change-pin-box .btn{margin-top:4px}

/* Dashboard outstanding */
.outstanding-item{display:block;text-decoration:none;color:inherit}
.outstanding-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center}
.outstanding-info{min-width:0}
.outstanding-info .list-title,.outstanding-info .list-sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.outstanding-amount{text-align:right;min-width:115px}
.outstanding-amount .amount{font-size:18px}

/* Confirm modal */
.cf-modal{position:fixed;inset:0;background:rgba(2,6,23,.75);backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;z-index:9999;padding:18px}
.cf-modal.hidden{display:none}
.cf-modal-box{width:100%;max-width:360px;background:linear-gradient(180deg,#1e293b,#111827);border:1px solid #334155;border-radius:24px;padding:22px;box-shadow:0 24px 70px #00000080}
.cf-modal-title{font-size:20px;font-weight:900;margin-bottom:10px}
.cf-modal-message{color:#cbd5e1;font-size:16px;line-height:1.35;margin-bottom:18px}
.cf-modal-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.cf-modal-btn{border:0;border-radius:15px;padding:14px;font-size:16px;font-weight:800;cursor:pointer}
.cf-cancel{background:#334155;color:#fff}
.cf-ok{background:var(--green);color:#041306}

/* Search row (rep portal) */
.rep-search{display:grid;grid-template-columns:1fr 54px;gap:10px;margin-bottom:12px}
.rep-search input{height:54px}
.rep-search button{height:54px;border-radius:16px;font-size:24px;padding:0}

/* Responsive */
@media(max-width:420px){
  .app{padding:12px}
  .grid{gap:10px}
  .stat{padding:13px;min-height:105px}
  .stat .value{font-size:18px}
  .bottom-nav{gap:7px}
  .bottom-nav a{width:50px;height:50px}
  .action-btn{width:44px;height:44px;font-size:20px}
  .amount{font-size:18px}
  .payment-card .amount{font-size:17px}
  .icon-actions .action-btn{width:42px;height:42px;font-size:20px}
  .badge{padding:4px 8px;font-size:11px}
  .quick-actions{grid-template-columns:1fr}
  .date-grid{grid-template-columns:1fr}
  .outstanding-row{grid-template-columns:1fr}
  .outstanding-amount{text-align:left;min-width:0}
  .outstanding-info .list-title,.outstanding-info .list-sub{white-space:normal}
}
@media(max-width:360px){
  .brand{font-size:20px}
  .stat .value{font-size:16px}
  .bottom-nav a{width:46px;height:46px;font-size:22px}
}
