/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: var(--r-md); font: 700 16px/1 var(--font-body); letter-spacing: -.01em;
  background: var(--c-primary); color: var(--c-on-primary); border: 1px solid transparent; white-space: nowrap;
  transition: transform .42s var(--ease-spring), background-color var(--dur-2), opacity var(--dur-2), box-shadow var(--dur-2);
}
.btn.is-block { display: flex; width: 100%; }
.btn.sm { height: 40px; padding: 0 16px; font-size: 14px; border-radius: var(--r-sm); }
.btn.lg { height: 58px; font-size: 17px; }
.btn.accent { background: var(--c-accent); color: var(--c-on-accent); }
.btn.secondary { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border); }
.btn.ghost { background: transparent; color: var(--c-text); }
.btn.danger { background: var(--c-danger); color: #fff; }
.btn.inverse { background: var(--c-on-primary); color: var(--c-primary); }
.btn.icon { width: 44px; height: 44px; padding: 0; border-radius: var(--r-pill); }
.btn.icon.sm { width: 36px; height: 36px; }
.btn[disabled], .btn.is-loading { opacity: .5; pointer-events: none; }
.btn.is-loading::after { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.pressing { transform: scale(.97) !important; transition-duration: 90ms !important; transition-timing-function: var(--ease-out) !important; }

/* ---------- surfaces ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-5); }
.card.flat { background: var(--c-surface-2); border-color: transparent; }
.card.press { transition: transform .42s var(--ease-spring); cursor: pointer; }
.card-title { font: 700 16px/1.2 var(--font-display); letter-spacing: -.02em; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 var(--sp-1); }
.section-head h2 { font-size: 18px; }
.link { color: var(--c-text); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: var(--sp-6) var(--sp-5) var(--sp-5);
  background: var(--c-primary); color: var(--c-on-primary); display: flex; flex-direction: column; gap: var(--sp-4);
}
.hero .eyebrow { color: inherit; opacity: .72; }
.hero .amount { font-size: clamp(44px, 14vw, 68px); }
.hero .btn { background: var(--c-on-primary); color: var(--c-primary); }
.hero .btn.accent { background: var(--c-accent); color: var(--c-on-accent); }
.hero .pill { background: color-mix(in srgb, var(--c-on-primary) 16%, transparent); color: inherit; border-color: transparent; }
.hero .rule { height: 1px; background: currentColor; opacity: .16; }

.list { display: flex; flex-direction: column; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: 14px var(--sp-4); border-top: 1px solid var(--c-border); transition: transform .42s var(--ease-spring), background-color var(--dur-2); }
.list-row:first-child { border-top: 0; }
.list-row .lead { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--c-surface-2); flex: none; }
.list-row .t { font-weight: 600; line-height: 1.25; }
.list-row .s { font-size: 13px; color: var(--c-muted); }
.kv { display: flex; justify-content: space-between; gap: var(--sp-4); padding: 11px 0; border-top: 1px solid var(--c-border); font-size: 15px; }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--c-muted); }
.kv .v { font-weight: 600; text-align: right; }
.kv.total .v, .kv.total .k { font-weight: 800; color: var(--c-text); }

/* ---------- pills & badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); font: 600 12px/1 var(--font-body);
  background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); white-space: nowrap; }
html[lang="bn"] .pill { font-size: 13px; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.success { background: var(--c-success-soft); color: var(--c-success); border-color: transparent; }
.pill.warning { background: var(--c-warning-soft); color: var(--c-warning); border-color: transparent; }
.pill.danger { background: var(--c-danger-soft); color: var(--c-danger); border-color: transparent; }
.pill.info { background: var(--c-info-soft); color: var(--c-info); border-color: transparent; }
.pill.plain::before { display: none; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--c-danger); color: #fff; font: 700 11px/1 var(--font-body); }
.badge.is-empty { display: none; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font: 600 13px/1.2 var(--font-body); color: var(--c-muted); }
.input, .select, .textarea {
  width: 100%; height: 52px; padding: 0 16px; border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); outline: none; transition: border-color var(--dur-2), box-shadow var(--dur-2); appearance: none; -webkit-appearance: none;
}
.textarea { height: auto; min-height: 112px; padding: 14px 16px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-primary) 14%, transparent); }
[data-theme="dark"] .input:focus, [data-theme="dark"] .select:focus, [data-theme="dark"] .textarea:focus { border-color: var(--c-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-accent) 18%, transparent); }
.input.is-invalid { border-color: var(--c-danger); }
.field .err { font-size: 13px; color: var(--c-danger); }
.field .hint { font-size: 13px; color: var(--c-muted); }
.input-group { position: relative; }
.input-group .input { padding-right: 52px; }
.input-group .btn.icon { position: absolute; right: 4px; top: 4px; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--c-border); flex: none; transition: background-color var(--dur-2); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform .42s var(--ease-spring); }
.switch[aria-checked="true"] { background: var(--c-primary); }
[data-theme="dark"] .switch[aria-checked="true"] { background: var(--c-accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- segmented control with sliding indicator ---------- */
.segmented { position: relative; display: flex; padding: 4px; border-radius: var(--r-md); background: var(--c-surface-2); border: 1px solid var(--c-border); }
.segmented .seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: calc(var(--r-md) - 4px); background: var(--c-primary);
  width: var(--w, 0px); transform: translate3d(var(--x, 0px), 0, 0); transition: transform var(--dur-3) var(--ease-spring), width var(--dur-3) var(--ease-spring); }
.segmented button { position: relative; z-index: 1; flex: 1 1 0; min-height: 40px; padding: 0 12px; border-radius: calc(var(--r-md) - 4px); font: 600 14px/1 var(--font-body); color: var(--c-muted); white-space: nowrap; transition: color var(--dur-2); }
.segmented button[aria-selected="true"] { color: var(--c-on-primary); }
.segmented.scroll { overflow-x: auto; scrollbar-width: none; } .segmented.scroll::-webkit-scrollbar { display: none; }
.segmented.scroll button { flex: 0 0 auto; }

/* ---------- banner / empty / error ---------- */
.banner { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border-radius: var(--r-md); background: var(--c-info-soft); color: var(--c-info); border: 1px solid transparent; }
.banner.success { background: var(--c-success-soft); color: var(--c-success); }
.banner.warning { background: var(--c-warning-soft); color: var(--c-warning); }
.banner.danger { background: var(--c-danger-soft); color: var(--c-danger); }
.banner .b-body { flex: 1; min-width: 0; color: var(--c-text); }
.banner .b-title { font-weight: 700; }
.banner .b-text { font-size: 14px; color: var(--c-muted); }
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-10) var(--sp-5); }
.state .ico { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--c-surface-2); }
.state h2 { font-size: 20px; } .state p { color: var(--c-muted); max-width: 32ch; }

/* ---------- skeleton (shimmer is a transform, so it stays on the GPU) ---------- */
.sk { position: relative; overflow: hidden; border-radius: var(--r-sm); background: var(--c-surface-2); min-height: 14px; }
.sk::after { content: ''; position: absolute; inset: 0; transform: translate3d(-100%, 0, 0);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c-text) 7%, transparent), transparent); animation: shimmer 1.4s var(--ease-in-out) infinite; }
.sk.card, .sk.hero-sk { border-radius: var(--r-lg); border: 0; }
.sk.circle { border-radius: 50%; }
.sk-hero { height: 244px; border-radius: var(--r-lg); }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 10000; left: 0; right: 0; top: calc(var(--safe-top) + 10px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 var(--sp-3); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 420px); padding: 12px 16px; border-radius: var(--r-md);
  background: var(--c-text); color: var(--c-bg); font: 600 14px/1.3 var(--font-body); box-shadow: var(--shadow-2); }
.toast.success { background: var(--c-success); color: #fff; } .toast.danger { background: var(--c-danger); color: #fff; }
.offline-bar { position: fixed; z-index: 10001; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 8px) 16px 8px; text-align: center; font: 600 13px/1.3 var(--font-body);
  background: var(--c-warning); color: #fff; transform: translate3d(0, -110%, 0); transition: transform var(--dur-3) var(--ease-spring); }
.offline-bar.is-visible { transform: none; } .offline-bar.is-ok { background: var(--c-success); }

/* ---------- bottom sheet / dialog ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--scrim); opacity: 0; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--c-surface); color: var(--c-text);
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-3); padding-bottom: var(--safe-bottom); outline: none; will-change: transform; }
.sheet-grab { touch-action: none; cursor: grab; padding: 10px 20px 4px; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--c-border); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 8px; }
.sheet-head h3 { font-size: 19px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 20px; -webkit-overflow-scrolling: touch; }
@media (min-width: 720px) {
  .sheet-root { align-items: center; }
  .sheet { border-radius: var(--r-lg); max-height: 86dvh; padding-bottom: 0; }
  .sheet-handle { display: none; }
}

/* ---------- pull to refresh ---------- */
.ptr { position: absolute; z-index: 5; left: 50%; top: 0; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-2); transform: translate3d(0, -60px, 0); pointer-events: none; }
.ptr svg { transition: transform var(--dur-2) var(--ease-out); }
.ptr.is-loading svg { animation: spin .8s linear infinite; }

/* ---------- success ---------- */
.success { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); text-align: center; padding: var(--sp-8) 0 var(--sp-4); }
.success-ring { width: 112px; height: 112px; }
.success-ring circle, .success-ring path { fill: none; stroke: var(--c-success); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.success-ring circle { stroke-dasharray: 302; stroke-dashoffset: 302; animation: draw .7s var(--ease-out) .05s forwards, ring-pop .7s var(--ease-spring) .05s; transform-origin: center; }
.success-ring path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .5s var(--ease-out) .55s forwards; }
.success .amount { font-size: 48px; }
.confetti { position: absolute; left: 50%; top: 64px; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); opacity: 0; animation: burst .9s var(--ease-out) forwards; animation-delay: .5s; }
.confetti i:nth-child(3n) { background: var(--c-primary); } .confetti i:nth-child(3n+1) { background: var(--c-success); width: 6px; height: 6px; }

/* ---------- receipt ---------- */
.receipt { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-6) var(--sp-5); }
.qr { width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: var(--r-sm); }
.qr svg { width: 100%; height: 100%; }
@media print {
  body { overflow: visible; background: #fff; } .topbar, .bottomnav, .sidebar, .toasts, .no-print { display: none !important; }
  #app, .shell, .outlet, .screen { position: static !important; overflow: visible !important; transform: none !important; }
  .receipt { border: 0; }
}

/* ---------- tables (admin) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 12px/1 var(--font-body); color: var(--c-muted); padding: 14px 16px; border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.table td { padding: 14px 16px; border-top: 1px solid var(--c-border); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table tbody tr { transition: background-color var(--dur-1); } .table tbody tr:hover { background: var(--c-surface-2); }
.table .r { text-align: right; }
.stat { display: flex; flex-direction: column; gap: 10px; }
.stat .amount { font-size: 30px; }
.grid { display: grid; gap: var(--sp-4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- admin toolkit ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 220px; min-width: 0; }
.toolbar .input, .toolbar .select { height: 44px; border-radius: var(--r-sm); }
.toolbar .select { width: auto; min-width: 130px; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--c-muted) 50%), linear-gradient(135deg, var(--c-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--c-muted) 50%), linear-gradient(135deg, var(--c-muted) 50%, transparent 50%); background-position: calc(100% - 22px) 23px, calc(100% - 17px) 23px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.json { margin: 0; padding: 14px; border-radius: var(--r-sm); background: var(--c-surface-2); font: 500 12.5px/1.6 var(--font-mono); white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow: auto; }
.json .jk { color: var(--c-info); } .json .js { color: var(--c-success); } .json .jn { color: var(--c-warning); } .json .jb { color: var(--c-danger); }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.palette-card { text-align: left; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface); display: flex; flex-direction: column; gap: 10px; transition: transform .42s var(--ease-spring), box-shadow var(--dur-2), border-color var(--dur-2); }
.palette-card[aria-pressed="true"] { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary); }
.swatches { display: flex; height: 36px; border-radius: 10px; overflow: hidden; border: 1px solid var(--c-border); }
.swatches i { flex: 1; }
.flag-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--c-border); }
.flag-row:first-child { border-top: 0; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 8px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { transform-box: fill-box; transform-origin: bottom; animation: bar-grow .8s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
.chart text { font: 600 11px var(--font-body); fill: var(--c-muted); }
.chart .grid-line { stroke: var(--c-border); stroke-width: 1; }
.donut-seg { animation: donut-in 1s var(--ease-out) both; }
.lock-banner { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--r-md); border: 1px solid var(--c-danger); background: var(--c-danger-soft); color: var(--c-text); }
.lock-banner.open { border-color: var(--c-warning); background: var(--c-warning-soft); }
.lock-banner code, .code { font: 600 13px var(--font-mono); background: var(--c-surface-2); padding: 2px 6px; border-radius: 6px; }
.field[data-locked] .input, .field[data-locked] .select { opacity: .65; }
@media print {
  html.print-sheet #app, html.print-sheet .toasts { display: none !important; }
  html.print-sheet .sheet-root { position: static; display: block; }
  html.print-sheet .sheet { max-height: none; box-shadow: none; border-radius: 0; }
  html.print-sheet .sheet-grab, html.print-sheet .sheet-backdrop, html.print-sheet .no-print { display: none !important; }
}
