@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;600&family=Noto+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #f7f1e8;
  --bg-2: #efe4d4;
  --ink: #1c1410;
  --muted: #6b5a4a;
  --gold: #c9a227;
  --gold-deep: #8a6a12;
  --gold-soft: #f3e2a8;
  --silver: #7a8694;
  --card: rgba(255, 252, 247, 0.92);
  --line: rgba(28, 20, 16, 0.08);
  --ok: #1f7a4c;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(70, 42, 12, 0.08);
  --radius: 22px;
  --font: "Noto Sans Bengali", "Noto Sans", sans-serif;
  --display: "Noto Sans Bengali", "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #ffe7a8 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e8d4b8 0%, transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 28px;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 52px; height: 52px; border-radius: 12px; object-fit: cover;
  background: #000; flex-shrink: 0; border: 1px solid var(--line);
}
@media (max-width: 640px) {
  .app-shell { padding: 12px; padding-bottom: 32px; }
  .brand { font-size: 1.15rem; }
  .top-actions .btn { padding: 10px 12px; font-size: .9rem; }
  input, select, textarea { font-size: 16px !important; }
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 22px;
}
.brand {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  letter-spacing: 0;
  line-height: 1.25;
}
.brand small {
  display: block;
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 4px;
}
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn {
  border: 0; border-radius: 14px; padding: 12px 18px; cursor: pointer;
  background: var(--ink); color: #fff; font-weight: 500;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: linear-gradient(135deg, #e0b93d, #a87d12); color: #1c1410; }
.btn-soft { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); }

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(8px);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(70, 42, 12, 0.12);
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.card-kicker {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 8px; font-weight: 500;
}
.card-title {
  font-family: var(--display);
  font-size: 1.05rem; font-weight: 500; margin: 0 0 6px;
}
.card-value {
  font-family: var(--font);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 500; margin: 8px 0 0;
}
.card-sub { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }

.rate-gold {
  background: linear-gradient(145deg, #fff8df, #f0d789 65%, #e5bf4a);
  border-color: rgba(138, 106, 18, 0.2);
}
.rate-silver {
  background: linear-gradient(145deg, #f7f9fb, #dce3ea 70%, #b8c3cf);
}
.rate-offer {
  background: linear-gradient(145deg, #eef9f1, #c8ebd4 70%, #8fd0a8);
  border-color: rgba(31, 122, 76, 0.2);
}

.icon-badge {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.7);
  font-size: 1.35rem; margin-bottom: 10px;
}

.section-title {
  font-family: var(--display);
  font-size: 1.15rem; margin: 26px 0 12px; font-weight: 500;
}

.nav-cards .card { text-align: center; min-height: 130px; }
.nav-cards .card-title { font-size: 1rem; }

table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: rgba(255,255,255,.7); font-size: .85rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

.form-card { max-width: 720px; }
.form-row { display: grid; gap: 8px; margin-bottom: 14px; }
.form-row.two { grid-template-columns: 1fr 1fr; gap: 12px; }
label { font-weight: 600; font-size: .92rem; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff;
}
.flash {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px;
  background: #e8f7ee; color: var(--ok); border: 1px solid rgba(31,122,76,.2);
}
.flash.error { background: #fdeceb; color: var(--danger); border-color: rgba(180,35,24,.2); }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
}
.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: rgba(255,252,247,.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.login-card h1 {
  font-family: var(--display);
  margin: 0 0 6px; font-size: 1.4rem; font-weight: 500;
}
.muted { color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: .85rem;
}

@media (max-width: 980px) {
  /* Business/stock: 2 per row on tablet; rate row (.span-4) stays 3 across */
  .span-3 { grid-column: span 6; }
}
/* Phone: 3 cards per row (Gold + Silver + Offer Discount together) */
@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
  }
  .span-3, .span-4 { grid-column: span 2; } /* 3 per row */
  .span-6 { grid-column: span 3; }
  .span-8, .span-12 { grid-column: span 6; }
  .card {
    padding: 10px 8px;
    border-radius: 14px;
    min-width: 0;
  }
  .card-kicker { font-size: 0.62rem; letter-spacing: .04em; margin-bottom: 4px; }
  .card-title { font-size: 0.85rem; }
  .card-value { font-size: 1.05rem !important; word-break: break-word; }
  .card-sub { font-size: 0.7rem; }
  .icon-badge { width: 28px; height: 28px; font-size: 0.95rem; margin-bottom: 6px; }
  .nav-cards .card { min-height: 96px; padding: 12px 8px; }
  .nav-cards .card-title { font-size: 0.82rem; }
  .form-card { grid-column: span 6; padding: 16px; }
  .form-row.two { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .sale-toolbar { flex-direction: column; align-items: stretch; }
  .sale-toolbar-actions { width: 100%; }
  .sale-toolbar-actions .btn { flex: 1; justify-content: center; }
  .modal-sheet { width: min(96vw, 440px); padding: 16px; }
}

/* Sale flow: toolbar + popups (no long side cards) */
.sale-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 12px;
}
.sale-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(28, 20, 16, 0.45);
  display: grid; place-items: end center;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.modal-backdrop[hidden] { display: none !important; }
.modal-sheet {
  width: min(96vw, 440px);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 20px 20px 16px 16px;
  box-shadow: 0 24px 60px rgba(40, 24, 8, 0.28);
  padding: 18px;
  animation: sheetUp .2s ease;
}
.modal-sheet-tall { max-height: min(92vh, 820px); }
@keyframes sheetUp {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 10px;
}
.modal-close {
  border: 0; background: #f1ebe3; border-radius: 999px;
  width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
}
.modal-actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px;
}
.modal-actions .btn { flex: 1; min-width: 120px; }
.modal-actions-stack { flex-direction: column; }
.modal-actions-stack .btn { width: 100%; }
.cart-list {
  list-style: none; padding: 0; margin: 8px 0 0;
}
.cart-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.btn-sm { padding: 8px 10px; font-size: .85rem; min-height: 0; }
.check-row {
  display: flex; gap: 8px; align-items: center;
  margin: 0 0 14px; font-weight: 600;
}
@media (min-width: 700px) {
  .modal-backdrop { place-items: center; }
  .modal-sheet { border-radius: 20px; }
}

.total-pay-box {
  margin: 12px 0 14px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff8df, #f0d789 70%, #e5bf4a);
  border: 1px solid rgba(138, 106, 18, 0.25);
  text-align: center;
}
.total-amount-btn {
  display: block; width: 100%;
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  color: var(--ink);
  padding: 6px 0;
}
.total-amount-btn:active { transform: scale(0.98); }
.pay-row-one select {
  font-size: 16px;
  min-height: 48px;
  font-weight: 600;
}
