/* ===== Saaz — design system ===== */
:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f6f1ec;
  --ink: #241b2e;
  --muted: #6f6878;
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-soft: #f1eafe;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --rose: #e11d48;
  --green: #059669;
  --border: #ece6f0;
  --shadow: 0 1px 2px rgba(36,27,46,.04), 0 8px 24px rgba(36,27,46,.06);
  --shadow-lg: 0 12px 40px rgba(91,33,182,.18);
  --radius: 16px;
  --radius-sm: 10px;
  --wrap: 1120px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Poppins', var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(124,58,237,.28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #3a2606; box-shadow: 0 6px 18px rgba(245,158,11,.3); }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn-block { width: 100%; }

.tag {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 11px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark);
}
.tag-accent { background: #fef3c7; color: var(--accent-dark); }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,247,242,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 16px; height: 68px; }
.logo { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 700; font-size: 22px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 18px;
  flex-shrink: 0;
}
/* Collapsible panel: inline on desktop, drop-down drawer on mobile. */
.nav-panel { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-weight: 500; color: var(--muted); font-size: 15px; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
/* Always-visible strip: notification bell + menu button. */
.nav-bar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.nav-toggle {
  display: none; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--ink);
  width: 44px; height: 44px; place-items: center; border-radius: 10px; line-height: 1;
}
.nav-toggle:hover { background: var(--surface-2); }

/* ===== Hero ===== */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(245,158,11,.18), transparent 60%),
    radial-gradient(900px 500px at 10% 0%, rgba(124,58,237,.18), transparent 55%);
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 72px 0 80px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 19px; color: var(--muted); margin: 20px 0 28px; max-width: 520px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 32px; margin-top: 40px; }
.hero-stats .n { font-family: var(--display); font-size: 26px; font-weight: 700; }
.hero-stats .l { font-size: 13px; color: var(--muted); }

.hero-art { position: relative; }
.hero-card {
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 22px; border: 1px solid var(--border);
}
.hero-card .row { display: flex; align-items: center; gap: 13px; }
.hero-card img.av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.hero-card .tipbtn {
  margin-top: 18px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-radius: 14px; padding: 16px; text-align: center; font-family: var(--display); font-weight: 600;
}
.hero-card .amounts { display: flex; gap: 8px; margin-top: 12px; }
.hero-card .amounts span { flex: 1; text-align: center; padding: 9px 0; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; font-size: 14px; }

/* ===== Cards / grid =====
   minmax(0,1fr) throughout: a bare 1fr track inherits min-width:auto from its item and
   refuses to shrink below min-content, which overflows narrow viewports. */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.artist-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .2s ease;
  display: flex; flex-direction: column;
}
.artist-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.artist-card .cover { height: 96px; background: linear-gradient(135deg, var(--primary-soft), #fde9c8); position: relative; }
.artist-card .av {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface);
  position: absolute; left: 20px; bottom: -32px; background: var(--surface-2);
}
.artist-card .body { padding: 44px 20px 20px; flex: 1; display: flex; flex-direction: column; }
.artist-card h3 { font-size: 18px; }
.artist-card .city { font-size: 13px; color: var(--muted); margin-top: 2px; }
.artist-card .genres { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 16px; }
.artist-card .bio { font-size: 14px; color: var(--muted); margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.artist-card .foot { margin-top: auto; }

/* ===== Section head ===== */
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 30px; gap: 16px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 34px); }
.section-head p { color: var(--muted); margin-top: 6px; }

/* ===== How it works ===== */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.step .num { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; background: var(--primary-soft); color: var(--primary-dark); margin-bottom: 14px; font-size: 18px; }
.step h3 { font-size: 18px; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 14.5px; }

/* ===== Filters (artists page) ===== */
.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.filters input, .filters select {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 12px; font-family: var(--font);
  font-size: 14px; background: var(--surface); color: var(--ink); min-width: 150px;
}
.filters input:focus, .filters select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.filters .search { flex: 1; min-width: 220px; }

/* ===== Artist profile ===== */
.profile-hero { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; padding: 40px 0 90px; position: relative; }
.profile-hero .wrap { position: relative; z-index: 2; }
/* position+z-index required: .profile-hero is position:relative, so it paints in the
   positioned layer and would cover this card's top 66px — including the artist's name. */
.profile-top {
  position: relative; z-index: 3;
  margin-top: -66px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; align-items: start;
}
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 26px; }
.profile-id { display: flex; gap: 18px; align-items: center; }
.profile-id img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); box-shadow: var(--shadow); }
.profile-id h1 { font-size: 28px; }
.samples { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.sample { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.sample .t { font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.sample audio { width: 100%; height: 38px; }

/* Tip Jar box */
.tipjar { position: sticky; top: 88px; scroll-margin-top: 80px; }
/* Mobile-only sticky CTA — the Tip Jar sits below the fold once the grid collapses. */
.tip-cta { display: none; }
.tip-cta-spacer { height: 60px; }
.tipjar .jar { text-align: center; padding: 8px 0 4px; }
.tipjar .jar .emoji { font-size: 40px; }
.amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.amount-grid button, .amount-opt {
  padding: 13px 0; border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px;
  font-family: var(--display); font-weight: 600; cursor: pointer; font-size: 15px; transition: all .12s ease;
}
.amount-grid button:hover { border-color: var(--primary); }
.amount-grid button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.field { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font-family: var(--font); font-size: 15px; margin-top: 10px; }
textarea.field { resize: vertical; min-height: 70px; }

.supporter-wall { margin-top: 22px; }
.support-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.support-item .dot { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.support-item .amt { color: var(--green); font-weight: 700; }

/* ===== Flash ===== */
.flash { padding: 13px 18px; border-radius: 12px; margin: 16px auto; max-width: var(--wrap); font-weight: 500; }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }
.flash-wrap { padding: 0 20px; }

/* ===== Footer ===== */
.site-footer { background: var(--ink); color: #cfc7d8; margin-top: 60px; padding: 48px 0 28px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.site-footer h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.site-footer a { display: block; color: #cfc7d8; padding: 4px 0; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 32px; padding-top: 20px; font-size: 13px; color: #9a91a8; }

/* ===== Auth ===== */
.auth-wrap { max-width: 440px; margin: 48px auto; padding: 0 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 15px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group .field { margin-top: 0; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14.5px; }
.auth-alt a { color: var(--primary); font-weight: 600; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.role-toggle { display: flex; gap: 10px; margin-bottom: 20px; }
.role-toggle label { flex: 1; }
.role-toggle input { position: absolute; opacity: 0; }
.role-toggle .opt { display: block; text-align: center; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; transition: all .12s ease; }
.role-toggle input:checked + .opt { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.otp-input { letter-spacing: 10px; text-align: center; font-size: 26px; font-family: var(--display); font-weight: 700; }

/* ===== Dashboard ===== */
.dash { padding: 40px 0 60px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.dash-head h1 { font-size: 28px; }
/* auto-fit rather than a fixed count: reflows at any width with no breakpoint needed,
   and collapses to fewer columns before a card is squeezed under 150px. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat.accent { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: 0; }
.stat.accent .label { color: rgba(255,255,255,.85); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel h2 { font-size: 19px; margin-bottom: 16px; }
.tip-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.tip-row:last-child { border-bottom: 0; }
.tip-row .dot { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.tip-row .amt { margin-left: auto; font-weight: 700; color: var(--green); }
.quick-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Payment (simulated gateway) ===== */
.pay-page { min-height: 100vh; background: linear-gradient(160deg, #ede9fe, #fef3c7); display: flex; align-items: center; justify-content: center; padding: 24px; }
.pay-card { background: var(--surface); width: 100%; max-width: 420px; border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; }
.pay-head { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; padding: 22px 26px; }
.pay-head .demo-badge { background: rgba(255,255,255,.2); font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pay-body { padding: 26px; }
.pay-amt { text-align: center; margin: 6px 0 22px; }
.pay-amt .n { font-family: var(--display); font-size: 40px; font-weight: 700; }
.pay-amt .to { color: var(--muted); font-size: 14px; }
.wallet-tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.wallet-tabs label { flex: 1; }
.wallet-tabs input { position: absolute; opacity: 0; }
.wallet-tabs .opt { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 13px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 14px; }
.wallet-tabs input:checked + .opt { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.wallet-tabs .jc { color: #b91c1c; } .wallet-tabs .ep { color: #047857; }
.pay-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.5; }
.success-page { text-align: center; max-width: 460px; margin: 60px auto; padding: 0 20px; }
.success-check { width: 90px; height: 90px; border-radius: 50%; background: #dcfce7; color: var(--green); display: grid; place-items: center; font-size: 46px; margin: 0 auto 20px; }

/* ===== Notifications ===== */
.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; font-size: 20px; border-radius: 10px; flex-shrink: 0;
}
.bell:hover { background: var(--surface-2); }
.bell .badge { position: absolute; top: 4px; right: 2px; background: var(--rose); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; }
.notif-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.notif-item.unread { background: var(--primary-soft); margin: 0 -14px; padding: 14px; border-radius: 10px; }
.notif-item .ic { width: 40px; height: 40px; border-radius: 50%; background: #fef3c7; display: grid; place-items: center; flex-shrink: 0; }

/* ===== Tables (wallet ledger, admin) ===== */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; padding: 12px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: var(--surface-2); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.pill-green { background: #dcfce7; color: #14532d; } .pill-amber { background: #fef3c7; color: #92400e; }
.pill-red { background: #fee2e2; color: #7f1d1d; } .pill-blue { background: #dbeafe; color: #1e40af; }
.pill-gray { background: var(--surface-2); color: var(--muted); }
.table-scroll { overflow-x: auto; }

/* ===== Voice recorder ===== */
.voice-rec { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rose); }
.rec-dot.live { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ===== Admin layout ===== */
.admin-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.admin-side { background: var(--ink); color: #cfc7d8; padding: 24px 16px; }
.admin-side .logo { color: #fff; margin-bottom: 24px; }
.admin-side a { display: block; padding: 11px 14px; border-radius: 10px; color: #cfc7d8; font-weight: 500; font-size: 14.5px; margin-bottom: 4px; }
.admin-side a:hover, .admin-side a.active { background: rgba(255,255,255,.08); color: #fff; }
.admin-main { padding: 32px; background: var(--bg); }
/* Mobile-only bar; the sidebar is the sole admin nav, so it needs a way to open. */
.admin-topbar { display: none; }
.admin-toggle {
  background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer;
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; line-height: 1;
}
.admin-toggle:hover { background: rgba(255,255,255,.1); }

/* ===== Empty / 404 ===== */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .emoji { font-size: 48px; margin-bottom: 12px; }

/* ===== Responsive =====
   Ordered widest → narrowest: later blocks must win at equal specificity. */

/* --- Tablet --- */
@media (max-width: 1024px) {
  .grid-3, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding: 52px 0; }
  .hero-inner { padding: 56px 0 64px; }
  .nav-panel { gap: 18px; }
  .nav-links { gap: 18px; }
}

/* --- Mobile: single column + nav drawer --- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; max-width: 360px; }
  .grid-3, .steps { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .profile-top { grid-template-columns: minmax(0, 1fr); }

  /* Tap targets: footer nav and the logo are real navigation on mobile. */
  .site-footer a { min-height: 44px; display: flex; align-items: center; padding: 0; }
  .site-footer .logo { margin-bottom: 4px; }
  .logo { min-height: 44px; }
  /* min-height (not padding) so inline style="padding:…" on small buttons can't undercut it. */
  .btn { min-height: 44px; }
  .table a { display: inline-flex; align-items: center; min-height: 44px; }

  /* Nav: collapse links AND actions together, keep bell + toggle on the bar. */
  .nav-panel {
    display: none;
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    flex-direction: column; align-items: stretch; gap: 2px; margin-left: 0;
    padding: 10px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 68px); overflow-y: auto;
  }
  .nav-panel.open { display: flex; }
  /* nav-panel carries margin-left:auto on desktop; hidden here, so the bar must push itself right. */
  .nav-bar-right { margin-left: auto; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-links a { display: flex; align-items: center; min-height: 48px; padding: 0 4px; font-size: 16px; }
  .nav-actions {
    flex-direction: column; align-items: stretch; gap: 10px;
    margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border);
  }
  .nav-actions form { width: 100%; }
  .nav-actions .btn { width: 100%; }
  .nav-toggle { display: grid; }

  /* Tip Jar: unstick, and surface a persistent CTA instead. */
  .tipjar { position: static; }
  .tip-cta {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(36,27,46,.1);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  @supports (backdrop-filter: blur(10px)) { .tip-cta { background: rgba(255,255,255,.85); backdrop-filter: blur(12px); } }
  .tip-cta .info { flex: 1; min-width: 0; }
  .tip-cta .info .n { font-family: var(--display); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tip-cta .info .l { font-size: 12px; color: var(--muted); }
  .tip-cta .btn { flex-shrink: 0; }
  .tip-cta-spacer { height: 84px; }

  /* iOS zooms the page when a focused input is under 16px. */
  .field, .filters input, .filters select, .otp-input,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="tel"], input[type="search"], select, textarea { font-size: 16px; }

  /* minmax(0,…) not 1fr: grid items default to min-width:auto, so a plain 1fr track
     refuses to shrink below its content's min-content width and overflows the viewport. */
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-main, .admin-side { min-width: 0; }
  .admin-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--ink); color: #fff; padding: 8px 14px;
    position: sticky; top: 0; z-index: 60;
  }
  .admin-topbar .logo { color: #fff; font-size: 19px; }
  .admin-side { display: none; padding: 10px 14px 18px; }
  .admin-side.open { display: block; }
  .admin-side > .logo, .admin-side .admin-side-sub { display: none; }
  .admin-side a { display: flex; align-items: center; min-height: 46px; font-size: 15px; }
  .admin-main { padding: 20px 16px; }
}

/* --- Small phones --- */
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .section { padding: 44px 0; }
  .hero-inner { padding: 36px 0 44px; }
  .hero p.lead { font-size: 17px; }
  .hero-stats { gap: 22px; flex-wrap: wrap; margin-top: 30px; }
  .hero-cta { gap: 10px; }
  .hero-cta .btn { width: 100%; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  .profile-hero { padding: 28px 0 80px; }
  .profile-card { padding: 20px; }
  .profile-id { flex-direction: column; align-items: flex-start; gap: 14px; }
  .profile-id img { width: 78px; height: 78px; }
  .profile-id h1 { font-size: 24px; }

  .auth-wrap { margin: 28px auto; }
  .auth-card { padding: 24px 20px; }
  .filters { gap: 10px; }
  .filters .search, .filters input, .filters select { min-width: 100%; flex: 1 1 100%; }

  .dash { padding: 26px 0 40px; }
  .dash-head h1 { font-size: 23px; }
  .stat { padding: 17px; }
  .stat .value { font-size: 22px; }
  .panel { padding: 18px; }
  .table th, .table td { padding: 10px 8px; white-space: nowrap; }

  .pay-body { padding: 20px; }
  .pay-head { padding: 18px 20px; }
  .pay-amt .n { font-size: 34px; }
  .success-page { margin: 40px auto; }
  .success-check { width: 74px; height: 74px; font-size: 38px; }
}

/* --- Very small phones (iPhone SE / 320px) --- */
@media (max-width: 380px) {
  .logo { font-size: 19px; }
  .amount-grid { gap: 8px; }
  .amount-grid button { font-size: 14px; padding: 12px 0; }
  .wallet-tabs { flex-direction: column; }
  .hero-stats { gap: 16px; }
  .hero-stats .n { font-size: 22px; }
  .btn { padding: 12px 16px; }
}

/* ===== Accessibility ===== */
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
/* Visually-hidden radios still need a visible focus ring on their proxy label. */
.role-toggle input:focus-visible + .opt,
.wallet-tabs input:focus-visible + .opt { outline: 3px solid var(--primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
