@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600;700;800&display=swap');

/* ============================================================
   গ্রামীণ ডিল — Premium Emerald UI (v41)
   Emerald #087A55 · Deep #064E3B · Mint #EAF5EF · Gold #D9B65D · Ink #173D30
   (পুরনো ভেরিয়েবলের নাম রাখা হয়েছে, যাতে সব স্ক্রিন একই থিম পায়)
   ============================================================ */
:root {
  --emerald: #087A55;
  --emerald-light: #0E9468;
  --deep: #064E3B;
  --mint: #EAF5EF;
  --gold: #D9B65D;
  --gold-dark: #B8943F;
  --gold-soft: #F8EFD2;
  --ink: #173D30;

  /* legacy aliases */
  --maroon: var(--emerald);
  --maroon-dark: var(--deep);
  --cream: var(--mint);
  --cream-card: #ffffff;
  --cream-alt: #F0F8F3;
  --ink-soft: #3B6454;
  --muted: #6A887B;
  --muted-light: #9DB6AA;
  --border: #D3E6DB;
  --green: #087A55;
  --green-bg: #DDF1E7;
  --orange: #A9690F;
  --orange-bg: #FBF0D9;
  --blue: #2F6F8F;
  --red: #C0392B;
  --red-bg: #FBE4E0;

  --shadow-soft: 0 8px 22px rgba(8, 122, 85, 0.09), 0 2px 6px rgba(23, 61, 48, 0.06);
  --shadow-press: inset 0 2px 5px rgba(23, 61, 48, 0.08);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans Bengali', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 108px;
  background:
    radial-gradient(circle at 0% 0%, #F7FCF9 0%, rgba(247, 252, 249, 0) 42%),
    radial-gradient(circle at 100% 38%, #D9EFE3 0%, rgba(217, 239, 227, 0) 40%),
    var(--mint);
  background-attachment: fixed;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
.tap:active { transform: scale(0.97); }

/* ---------- Header ---------- */
.app-header {
  position: relative;
  margin: 12px 12px 0;
  padding: 20px 18px 18px 20px;
  border-radius: 24px;
  background: linear-gradient(145deg, #0B8E64 0%, #087A55 45%, #064E3B 100%);
  border: 1.5px solid rgba(217, 182, 93, 0.85);
  box-shadow: 0 10px 26px rgba(6, 78, 59, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.app-header::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 38%);
}
.app-header .eyebrow { color: var(--gold); font-size: 13px; font-weight: 600; letter-spacing: 0.4px; margin-bottom: 2px; }
.app-header h1 { color: #fff; font-size: 27px; font-weight: 800; margin: 0; line-height: 1.25; }
.app-header .sub { color: #CDE8DC; font-size: 13px; margin-top: 4px; }
.header-row { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.header-btn {
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.34);
  color: #fff; padding: 9px 16px; border-radius: 14px; font-size: 13px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ---------- Layout ---------- */
.page { padding: 16px; max-width: 560px; margin: 0 auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card {
  background: rgba(255, 255, 255, 0.84);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
}
.card.tinted { background: rgba(232, 245, 238, 0.9); }
.card-gold {
  background: linear-gradient(135deg, #FFFBEC 0%, var(--gold-soft) 100%);
  border: 1.5px solid rgba(217, 182, 93, 0.75);
}

.stat-label { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.stat-value { font-size: 24px; font-weight: 800; color: var(--ink); margin-top: 6px; }
.section-title { font-weight: 800; color: var(--ink); font-size: 15px; margin: 18px 2px 10px; }
.empty { color: var(--muted); text-align: center; padding: 16px 0; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 16px; padding: 14px 0; font-weight: 800; font-size: 15px;
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 10px;
}
.btn-primary {
  background: linear-gradient(145deg, #0E9468, #087A55 55%, #066248);
  color: #fff;
  box-shadow: 0 7px 16px rgba(8, 122, 85, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary:disabled { background: #CFE0D8; color: #8AA498; box-shadow: none; }
.btn-secondary {
  background: linear-gradient(145deg, #E9CE85, #D9B65D);
  color: var(--deep);
  box-shadow: 0 6px 14px rgba(185, 148, 63, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-secondary:disabled { background: #E7E3D2; color: #A29C84; box-shadow: none; }
.btn-outline {
  background: rgba(255, 255, 255, 0.9); border: 1.5px solid var(--border); color: var(--deep);
  box-shadow: 0 2px 6px rgba(23, 61, 48, 0.05);
}
.btn-toggle {
  flex: 1; padding: 11px 0; border-radius: 14px; border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.9); color: var(--muted); font-weight: 700;
}
.btn-toggle.active-green { border-color: var(--emerald); background: var(--green-bg); color: var(--deep); box-shadow: 0 3px 10px rgba(8, 122, 85, 0.16); }
.btn-toggle.active-orange { border-color: var(--gold-dark); background: var(--gold-soft); color: #7A5A12; box-shadow: 0 3px 10px rgba(185, 148, 63, 0.2); }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { margin-bottom: 0; }
.btn-icon { background: none; border: none; padding: 6px; color: var(--ink-soft); }
.btn-icon.danger { background: var(--red); color: #fff; border-radius: 10px; }

.fab {
  position: fixed; right: 18px; bottom: 112px; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(145deg, #0E9468, #066248); color: #fff; border: 1.5px solid rgba(217, 182, 93, 0.8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(6, 78, 59, 0.38); font-size: 26px;
}

/* ---------- Inputs ---------- */
.field-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; display: block; }
.input, select.input {
  width: 100%; padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--border);
  font-size: 15px; outline: none; background: rgba(255, 255, 255, 0.95); color: var(--ink);
  box-shadow: inset 0 2px 4px rgba(23, 61, 48, 0.05); transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(8, 122, 85, 0.14); }
.input::placeholder { color: var(--muted-light); }
.input-lg { font-size: 26px; font-weight: 800; padding: 10px 14px; }
.field-group { margin-bottom: 12px; }

/* ---------- Floating bottom navigation ---------- */
.bottom-nav {
  position: fixed; left: 14px; right: 14px; max-width: 532px; margin: 0 auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  display: flex; gap: 4px; padding: 7px 8px; z-index: 20;
  background: linear-gradient(135deg, #0B8E64 0%, #087A55 50%, #064E3B 100%);
  border: 1.5px solid rgba(217, 182, 93, 0.45); border-radius: 34px;
  box-shadow: 0 14px 30px rgba(6, 78, 59, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.nav-btn {
  flex: 1; background: none; border: none; padding: 8px 2px 7px; color: rgba(255, 255, 255, 0.72);
  font-weight: 600; font-size: 11.5px; border-radius: 26px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
}
.nav-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn.active {
  color: #fff; font-weight: 800; background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 0 1.5px var(--gold), 0 3px 10px rgba(0, 0, 0, 0.18);
}
.nav-btn.active svg { stroke: #fff; }

/* ---------- Rows / lists ---------- */
.item-row {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  background: rgba(255, 255, 255, 0.86); border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px; margin-bottom: 10px; box-shadow: 0 5px 14px rgba(8, 122, 85, 0.07), 0 1px 3px rgba(23, 61, 48, 0.05);
}
.item-name { font-weight: 700; color: var(--ink); font-size: 14px; }
.item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-total { font-weight: 800; font-size: 16px; color: var(--ink); }
.divider { height: 1px; background: var(--border); margin: 10px 0; }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 15px; }
.total-row.grand { font-size: 20px; font-weight: 800; color: var(--emerald); border-top: 2px dashed var(--border); padding-top: 12px; margin-top: 6px; }

.chip { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.chip-green { background: var(--green-bg); color: var(--deep); }
.chip-orange { background: var(--orange-bg); color: #7A5A12; }
.chip-blue { background: #E1EEF4; color: var(--blue); }

/* ---------- Dashboard ---------- */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.action-card {
  all: unset; cursor: pointer; box-sizing: border-box; text-align: center; color: #fff;
  padding: 20px 10px 16px; border-radius: 22px;
  background: linear-gradient(150deg, #12A06F 0%, #087A55 50%, #064E3B 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 22px rgba(6, 78, 59, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.action-card:active { transform: scale(0.97); }
.action-card svg { width: 34px; height: 34px; stroke: #fff; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.95; }
.action-card span { font-weight: 800; font-size: 15px; }

.stat-card .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); line-height: 1.4; }
.stat-card .val { font-size: 25px; font-weight: 800; color: var(--deep); margin-top: 8px; }
.stat-card .val.neg { color: var(--red); }
.value-pill {
  display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 22px; font-weight: 800;
  background: rgba(217, 182, 93, 0.28); color: #7A5A12; margin-top: 6px;
}
.value-pill svg { width: 18px; height: 18px; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.value-pill.green { background: #D5EFE1; color: var(--emerald); }
.row-card { display: flex; justify-content: space-between; align-items: center; }
.row-card .left { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.row-card .left svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row-card .right { font-weight: 800; font-size: 17px; color: var(--deep); }
.hint { font-size: 11.5px; color: var(--muted); margin: -2px 4px 12px; line-height: 1.6; }

/* ---------- Customers ---------- */
.page-title { font-size: 28px; font-weight: 800; color: var(--deep); line-height: 1.3; margin: 6px 2px 16px; }
.search-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-pill {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 48px; border-radius: 999px;
  background: linear-gradient(135deg, #0E9468, #087A55 60%, #066248);
  box-shadow: 0 7px 16px rgba(8, 122, 85, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.search-pill svg, .filter-btn svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.search-pill input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: #fff; font-size: 15px; }
.search-pill input::placeholder { color: rgba(255, 255, 255, 0.82); }
.filter-btn {
  all: unset; cursor: pointer; box-sizing: border-box; width: 48px; height: 48px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; position: relative;
  background: linear-gradient(135deg, #0E9468, #066248);
  box-shadow: 0 7px 16px rgba(8, 122, 85, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.filter-btn.on { box-shadow: 0 0 0 2px var(--gold), 0 7px 16px rgba(8, 122, 85, 0.28); }
.filter-btn .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 1.5px solid #fff; }
.filter-panel { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.filter-chip {
  all: unset; cursor: pointer; box-sizing: border-box; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(255, 255, 255, 0.9); border: 1.5px solid var(--border); color: var(--ink-soft);
}
.filter-chip.on { background: var(--emerald); border-color: var(--emerald); color: #fff; box-shadow: 0 4px 10px rgba(8, 122, 85, 0.25); }
.mini-card .lbl { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.mini-card .val { font-size: 22px; font-weight: 800; margin-top: 6px; }
.mini-card .val.gold { color: #A9801F; }
.mini-card .val.green { color: var(--emerald); }
.bar { height: 6px; border-radius: 999px; background: rgba(23, 61, 48, 0.08); margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }
.bar.gold > i { background: linear-gradient(90deg, #E9CE85, #C9A24A); }
.bar.green > i { background: linear-gradient(90deg, #2FB583, #087A55); }
.mini-card .cap { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.cust-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid rgba(23, 61, 48, 0.08); }
.cust-row:last-child { border-bottom: none; }
.cust-main { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.cust-main .nm { font-weight: 700; font-size: 15px; color: var(--ink); line-height: 1.35; white-space: normal; overflow-wrap: anywhere; } /* পুরো নাম দেখাতে লাইন ভাঙে, ... দিয়ে কাটা হয় না */
.cust-main .mb { font-size: 12px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(23, 61, 48, 0.18);
}
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge.due { background: var(--red-bg); color: #B3382A; }
.badge.paid { background: var(--green-bg); color: var(--emerald); }
.badge.zero { background: #E9EEEB; color: var(--muted); }
.quick-collect { background: var(--green-bg); border: none; border-radius: 12px; width: 32px; height: 32px; font-size: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #12A06F 0%, rgba(18, 160, 111, 0) 50%), linear-gradient(160deg, #087A55, #064E3B);
}
.auth-card {
  background: rgba(255, 255, 255, 0.94); border-radius: 26px; padding: 28px 22px; width: 100%; max-width: 380px;
  border: 1.5px solid rgba(217, 182, 93, 0.7); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}
.auth-title { font-size: 25px; font-weight: 800; color: var(--emerald); text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.auth-switch button { background: none; border: none; color: var(--emerald); font-weight: 800; padding: 0; }
.error-banner { background: var(--red); color: #fff; padding: 10px 14px; border-radius: 14px; font-size: 13px; margin-bottom: 12px; }
.loading-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.customer-select-btn {
  width: 100%; text-align: left; background: rgba(255, 255, 255, 0.95); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 12px; display: flex; justify-content: space-between; align-items: center;
}

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 40, 30, 0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  z-index: 30; display: flex; align-items: flex-end;
}
.modal-sheet {
  background: #F2F9F5; width: 100%; max-height: 88vh; overflow-y: auto; border-radius: 28px 28px 0 0; padding: 20px 18px 26px;
  box-shadow: 0 -10px 30px rgba(6, 78, 59, 0.2); border-top: 1.5px solid rgba(217, 182, 93, 0.6);
}
.modal-title { font-weight: 800; font-size: 17px; color: var(--ink); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }

/* ---------- GD BOOK ব্র্যান্ডিং ---------- */
.brand-logo { display: block; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.28)); }
.brand-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-header .brand-row .brand-logo { filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.35)); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 10px; }
.auth-brand .brand-logo { filter: drop-shadow(0 6px 12px rgba(6, 78, 59, 0.3)); }
.auth-title { letter-spacing: 0.5px; }
.splash { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: splashIn .5s ease-out both; }
.splash .brand-logo { filter: drop-shadow(0 10px 18px rgba(6, 78, 59, 0.35)); margin-bottom: 8px; }
.splash-name { font-size: 26px; font-weight: 800; color: var(--deep); letter-spacing: 1px; }
.splash-sub { font-size: 13.5px; color: var(--muted); font-weight: 600; }
@keyframes splashIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
.about-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 22px 16px; margin-top: 18px; }
.about-card .brand-logo { margin-bottom: 8px; filter: drop-shadow(0 6px 12px rgba(6, 78, 59, 0.3)); }
.about-name { font-size: 22px; font-weight: 800; color: var(--deep); letter-spacing: 1px; }
.about-sub { font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
.about-tag { font-size: 12.5px; color: var(--gold-dark); font-weight: 700; }
