/* Only what Tailwind cannot express. Everything else stays in utilities. */

:root {
  color-scheme: dark;
  --bg: #071320;
  --surface: #0E2033;
  --surface-2: #16304A;
  --line: #1E3E5C;
  --text: #E8F1F8;
  --text-muted: #8FA9BF;
  --accent: #3DE0D0;
  --accent-ink: #04222B;
  --gold: #E8B54B;
  --success: #35C48C;
  --danger: #E86A6A;
  --info: #4D9BF5;
}

body {
  line-height: 1.7;                 /* Bengali needs more room than Latin */
  -webkit-tap-highlight-color: transparent;
  background-image:
    radial-gradient(900px 500px at 80% -10%, rgba(61, 224, 208, .07), transparent 60%),
    radial-gradient(700px 400px at 0% 0%, rgba(77, 155, 245, .06), transparent 55%);
  background-attachment: fixed;
}

h1, h2, h3 { line-height: 1.3; }

.pwa-body {
  background-color: var(--bg);
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 18%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 18%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
}

.pwa-shell {
  isolation: isolate;
  /* Clips the decorative glows without becoming a scroll container.
     `overflow: hidden` would: it is scrollable by script but not by the user,
     so anything scrolled out of view — or any content taller than the box —
     becomes unreachable. `clip` clips without that trap; `hidden` is the
     fallback for browsers that predate it. */
  overflow: hidden;
  overflow: clip;
  background:
    radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--info) 12%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 45%, var(--bg)), var(--bg) 42%);
  box-shadow: 0 0 70px color-mix(in srgb, var(--info) 12%, transparent);
}

.pwa-shell > *:not(.pwa-glow) {
  position: relative;
  z-index: 1;
}

.pwa-glow {
  position: absolute;
  z-index: 0;
  width: 13rem;
  height: 13rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: .12;
  pointer-events: none;
}

.pwa-glow--accent {
  top: 18rem;
  right: -9rem;
  background: var(--accent);
}

.pwa-glow--info {
  top: 42rem;
  left: -10rem;
  background: var(--info);
}

.pwa-card {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface-2) 72%, transparent), color-mix(in srgb, var(--surface) 92%, transparent));
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--info));
  box-shadow:
    inset 0 1px color-mix(in srgb, var(--text) 5%, transparent),
    0 12px 30px color-mix(in srgb, var(--bg) 52%, transparent);
}

.pwa-stat-card {
  min-height: 8.25rem;
  overflow: hidden;
  position: relative;
}

.pwa-stat-card::after {
  content: "";
  position: absolute;
  width: 6rem;
  height: 6rem;
  right: -2.25rem;
  bottom: -3rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stat-color, var(--accent)) 16%, transparent);
  filter: blur(4px);
}

.pwa-primary-action {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, var(--info)));
  color: var(--accent-ink);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 20%, transparent);
}

.pwa-primary-action:active {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Small offline fallbacks; Lucide replaces these elements with SVGs online. */
i[data-lucide]::before {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-style: normal;
  line-height: 1;
}
i[data-lucide="bell"]::before { content: "•"; }
i[data-lucide="arrow-left"]::before { content: "‹"; font-size: 1.5em; }
i[data-lucide="wallet"],
i[data-lucide="wallet-cards"] { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
i[data-lucide="wallet"]::before,
i[data-lucide="wallet-cards"]::before { content: "৳"; }
i[data-lucide="clock"],
i[data-lucide="clock-3"] { font-family: ui-sans-serif, system-ui, sans-serif; }
i[data-lucide="clock"]::before,
i[data-lucide="clock-3"]::before { content: "◷"; }
i[data-lucide="user-plus"]::before { content: "+"; font-size: 1.35em; }
i[data-lucide="send"]::before { content: "➤"; }
i[data-lucide="calendar"]::before,
i[data-lucide="calendar-days"]::before { content: "□"; }
i[data-lucide="banknote"]::before { content: "৳"; }
i[data-lucide="info"]::before { content: "i"; }

.pwa-bottom-nav {
  border: 1px solid color-mix(in srgb, var(--line) 90%, var(--accent));
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 -12px 32px color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px);
}

/* The ID chip: the one element that carries the product's whole idea. */
.id-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .78rem; letter-spacing: .04em;
  padding: .18rem .55rem .18rem .45rem;
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 8px; background: color-mix(in srgb, var(--surface-2) 50%, transparent);
  white-space: nowrap; cursor: pointer;
}
.id-chip--patient  { border-left-color: var(--accent); }
.id-chip--referrer { border-left-color: var(--info); }
.id-chip--hospital { border-left-color: var(--success); }
.id-chip--referral { border-left-color: var(--text-muted); }
.id-chip--money    { border-left-color: var(--gold); }

.scroll-x { scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

.status-filter-scroll {
  scroll-behavior: smooth;
  scroll-padding-inline: 1rem;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 65%, var(--line)) transparent;
}
.status-filter-scroll::-webkit-scrollbar { height: 5px; }
.status-filter-scroll::-webkit-scrollbar-track { background: transparent; }
.status-filter-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 65%, var(--line));
}

.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

input, select, textarea { font-size: 16px; }   /* stops iOS zoom on focus */

/* The journey line draws itself once, and not at all if motion is reduced. */
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.journey-line { transform-origin: left; animation: draw .4s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.toast {
  position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: .5rem .9rem; border-radius: 10px; font-size: .85rem; z-index: 60;
}

/* --- Confirm dialog -----------------------------------------------------
   Replaces window.confirm() for [data-confirm] actions. The native dialog is
   unstyleable and reads as a browser warning rather than part of the app. */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(6px);
  animation: confirm-in .13s ease-out;
}
.confirm-overlay[hidden] { display: none; }

@keyframes confirm-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes confirm-rise {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.confirm-box {
  width: 100%;
  max-width: 21rem;
  padding: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--line) 85%, var(--accent));
  border-radius: 18px;
  background:
    linear-gradient(150deg,
      color-mix(in srgb, var(--surface-2) 70%, transparent),
      color-mix(in srgb, var(--surface) 96%, transparent));
  box-shadow:
    inset 0 1px color-mix(in srgb, var(--text) 6%, transparent),
    0 22px 48px color-mix(in srgb, #000 55%, transparent);
  animation: confirm-rise .16s ease-out;
}

.confirm-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  margin-bottom: .85rem;
  border-radius: 12px;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}

.confirm-message {
  margin: 0 0 1.15rem;
  font-size: .95rem;
  line-height: 1.6;
  color: var(--text);
}

.confirm-actions { display: flex; gap: .6rem; }

.confirm-actions button {
  flex: 1 1 0;
  height: 2.75rem;
  border-radius: 11px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter .12s ease, background-color .12s ease;
}
.confirm-actions button:active { transform: scale(.99); }
.confirm-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.confirm-cancel {
  background: transparent;
  border-color: var(--line);
  color: var(--text-muted);
}
.confirm-cancel:hover { color: var(--text); background: color-mix(in srgb, var(--line) 35%, transparent); }

.confirm-ok {
  background: var(--danger);
  color: #fff;
}
.confirm-ok:hover { filter: brightness(1.08); }
