@font-face {
  font-family: "Vazirmatn";
  src:
    local("Vazirmatn"),
    url("/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* PinDis Mobile DS: foundations shared by retailer and reviewer surfaces. */
  --ds-color-brand-primary: #e30613;
  --ds-color-brand-hover: #c91820;
  --ds-color-brand-strong: #b71920;
  --ds-color-text-primary: #171717;
  --ds-color-text-secondary: #737373;
  --ds-color-surface-page: #f7f7f7;
  --ds-color-surface-raised: #ffffff;
  --ds-color-surface-brand-soft: #fff7f7;
  --ds-color-border: #e9e6e6;
  --ds-color-warning: #c78116;
  --ds-color-warning-soft: #fff3d8;
  --ds-color-error: #c51420;
  --ds-color-error-soft: #fdecef;
  --ds-color-info: #3169a4;
  --ds-color-success: #16835f;
  --ds-color-success-soft: #e5f5ef;
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-8: 32px;
  --ds-radius-sm: 8px;
  --ds-radius-md: 12px;
  --ds-radius-lg: 16px;
  --ds-radius-xl: 20px;
  --ds-radius-full: 999px;
  --ds-control-height: 48px;
  --ds-top-app-bar-height: 48px;
  --ds-bottom-action-height: 64px;
  --ds-offline-banner-height: 36px;
  --ds-shadow-raised: 0 1px 2px rgb(0 0 0 / 0.025), 0 8px 24px rgb(0 0 0 / 0.035);
  --ds-shadow-overlay: 0 16px 40px rgb(23 23 23 / 0.16);

  /* Compatibility aliases keep existing product components on the DS tokens. */
  --ink: var(--ds-color-text-primary);
  --muted: var(--ds-color-text-secondary);
  --forest-950: var(--ds-color-text-primary);
  --forest-900: var(--ds-color-brand-primary);
  --forest-800: var(--ds-color-brand-hover);
  --forest-700: var(--ds-color-brand-strong);
  --mint-100: #fdebec;
  --mint-50: var(--ds-color-surface-brand-soft);
  --cream: var(--ds-color-surface-page);
  --paper: var(--ds-color-surface-raised);
  --line: var(--ds-color-border);
  --amber: var(--ds-color-warning);
  --amber-soft: var(--ds-color-warning-soft);
  --red: var(--ds-color-error);
  --red-soft: var(--ds-color-error-soft);
  --blue: var(--ds-color-info);
  --success: var(--ds-color-success);
  --success-soft: var(--ds-color-success-soft);
  --shadow: var(--ds-shadow-raised);
  --radius-xl: var(--ds-radius-xl);
  --radius-lg: var(--ds-radius-lg);
  --radius-md: var(--ds-radius-md);
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% -10%, rgb(225 31 38 / 0.08), transparent 28rem),
    var(--cream);
  line-height: 1.6;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgb(225 31 38 / 0.2);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: -100px;
  right: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 0 0 10px 10px;
  background: var(--forest-950);
  color: white;
}

.skip-link:focus {
  top: 0;
}

.offline-banner {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 80;
  display: grid;
  min-height: var(--ds-offline-banner-height);
  padding: var(--ds-space-2) var(--ds-space-4);
  place-items: center;
  background: var(--amber-soft);
  color: #684b11;
  text-align: center;
  font-size: 0.82rem;
}

.app-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.02);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  min-height: 64px;
  max-width: 760px;
  margin: auto;
  padding: var(--ds-space-2) var(--ds-space-4);
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.pindis-logo {
  display: block;
  width: 116px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: #d8d2d2;
}

.brand-product {
  display: grid;
  line-height: 1.15;
}

.brand-product strong,
.brand-product small {
  display: block;
}

.brand-product strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.brand-product small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.58rem;
}

.retailer-badge {
  min-height: 32px;
  padding: 0.25rem var(--ds-space-3);
  border: 1px solid var(--line);
  border-radius: var(--ds-radius-full);
  background: white;
  color: var(--muted);
  direction: ltr;
  font-size: 0.75rem;
}

.page-shell {
  width: min(100% - 2rem, 720px);
  margin: 0 auto;
  padding: 1.3rem 0 2.5rem;
}

.loading-state,
.fatal-state,
.auth-shell {
  display: grid;
  min-height: 55vh;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.loading-state {
  color: var(--muted);
}

.auth-shell {
  width: 100%;
  padding-block: var(--ds-space-4);
}

.auth-card {
  width: min(100%, 420px);
  padding: var(--ds-space-6);
  border: 1px solid var(--line);
  border-radius: var(--ds-radius-xl);
  background: var(--paper);
  box-shadow: var(--ds-shadow-raised);
  text-align: right;
}

.auth-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: var(--ds-space-4);
  place-items: center;
  border-radius: var(--ds-radius-lg);
  background: var(--mint-100);
  color: var(--forest-700);
}

.auth-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-card > .eyebrow {
  color: var(--forest-700);
}

.auth-card h1 {
  margin: var(--ds-space-1) 0 0;
  font-size: 1.35rem;
}

.auth-card > p {
  margin: var(--ds-space-2) 0 var(--ds-space-5);
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-form {
  display: grid;
  gap: var(--ds-space-3);
}

.auth-field {
  display: grid;
  gap: var(--ds-space-1);
  color: #424242;
  font-size: 0.75rem;
  font-weight: 800;
}

.auth-field input {
  width: 100%;
  min-height: var(--ds-control-height);
  padding: var(--ds-space-2) var(--ds-space-3);
  border: 1px solid var(--line);
  border-radius: var(--ds-radius-md);
  background: white;
  color: var(--ink);
}

.auth-field input:focus {
  border-color: var(--forest-900);
  box-shadow: 0 0 0 3px rgb(225 31 38 / 0.1);
  outline: 0;
}

.auth-form > small {
  margin-top: calc(var(--ds-space-2) * -1);
  color: var(--muted);
  font-size: 0.68rem;
}

.auth-error {
  margin: 0;
  padding: var(--ds-space-2) var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.72rem;
}

.otp-destination {
  margin: 0 0 var(--ds-space-1);
  color: var(--muted);
  font-size: 0.78rem;
}

.otp-destination strong {
  color: var(--ink);
  direction: ltr;
  unicode-bidi: isolate;
}

.auth-field .otp-input {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.45rem;
}

.development-otp {
  display: flex;
  padding: var(--ds-space-2) var(--ds-space-3);
  align-items: center;
  justify-content: space-between;
  border: 1px dashed #d1a143;
  border-radius: var(--ds-radius-md);
  background: var(--amber-soft);
  color: #71500f;
  font-size: 0.72rem;
}

.development-otp strong {
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.14rem;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-links .text-button {
  margin: 0;
}

.auth-links .text-button:disabled {
  color: #a3a3a3;
  cursor: not-allowed;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--forest-700);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fatal-state {
  max-width: 420px;
  margin: auto;
}

.fatal-state h1 {
  margin: 1rem 0 0.4rem;
  font-size: 1.5rem;
}

.fatal-state p {
  margin: 0;
  color: var(--muted);
}

.fatal-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 2rem;
  font-weight: 900;
}

.reward-card {
  position: relative;
  overflow: hidden;
  padding: 1.4rem;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 10% 0, rgba(255, 255, 255, 0.13), transparent 14rem),
    linear-gradient(125deg, var(--forest-700), var(--forest-900) 68%, #f13b45);
  color: white;
  box-shadow: 0 20px 52px rgb(227 6 19 / 0.17);
}

.reward-card::after {
  content: "";
  position: absolute;
  top: -4rem;
  left: -2rem;
  width: 11rem;
  height: 11rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255, 255, 255, 0.025);
}

.reward-topline,
.reward-amount-row,
.progress-labels,
.section-heading,
.invoice-card-header,
.page-meta,
.history-header,
.history-meta,
.sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.eyebrow,
.step-number {
  color: inherit;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.soft-pill {
  padding: 0.24rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.7rem;
}

.reward-card h1 {
  max-width: 25rem;
  margin: 0.7rem 0 1rem;
  font-size: clamp(1.25rem, 5vw, 1.72rem);
  line-height: 1.45;
}

.reward-amount-row {
  position: relative;
  z-index: 1;
  align-items: end;
}

.reward-amount,
.reward-amount + span {
  display: block;
}

.reward-amount {
  font-size: clamp(1.55rem, 7vw, 2.25rem);
  line-height: 1.2;
}

.reward-amount + span {
  margin-top: 0.12rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
}

.per-invoice {
  max-width: 9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.11);
}

.per-invoice span,
.per-invoice small {
  display: block;
}

.per-invoice span {
  color: white;
  font-size: 1.05rem;
  font-weight: 900;
}

.per-invoice small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.66rem;
  line-height: 1.35;
}

.progress-track {
  position: relative;
  z-index: 1;
  height: 8px;
  margin-top: 1.25rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, white, #ffd9dc);
  transition: width 500ms ease;
}

.progress-labels {
  margin-top: 0.55rem;
  align-items: start;
  font-size: 0.72rem;
}

.progress-labels span {
  max-width: 15rem;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
}

.maximum-copy {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
}

.guidance-card {
  display: flex;
  margin-top: 1rem;
  padding: 1rem;
  gap: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
}

.guidance-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--mint-100);
  color: var(--forest-700);
  font-weight: 900;
}

.guidance-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.guidance-card ul {
  margin: 0;
  padding-right: 1.15rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.guidance-card li::marker {
  color: var(--forest-700);
}

.text-button {
  margin-top: 0.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--forest-700);
  font-size: 0.78rem;
  font-weight: 800;
}

.capture-section,
.history-section {
  margin-top: 2rem;
}

.section-heading {
  margin-bottom: 0.85rem;
}

.section-heading h2 {
  margin: 0.12rem 0 0;
  font-size: 1.25rem;
}

.step-number {
  color: var(--forest-700);
}

.count-badge {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--mint-100);
  color: var(--forest-700);
  font-size: 0.72rem;
  font-weight: 800;
}

.invoice-list {
  display: grid;
  gap: 0.9rem;
}

.invoice-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.invoice-card.upload-error {
  border-color: rgba(190, 64, 56, 0.55);
}

.invoice-card-header {
  padding: 1rem 1.05rem 0.8rem;
  border-bottom: 1px solid #edf0ee;
}

.invoice-card-header h3 {
  margin: 0;
  font-size: 1rem;
}

.invoice-card-header p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.remove-invoice {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
}

.remove-invoice:hover {
  background: var(--red-soft);
  color: var(--red);
}

.empty-upload {
  padding: 1.1rem;
  text-align: center;
}

.receipt-illustration {
  display: grid;
  width: 104px;
  height: 94px;
  margin: 0 auto 0.7rem;
  place-items: center;
  border-radius: 24px;
  background: var(--mint-50);
}

.receipt-paper {
  position: relative;
  width: 52px;
  height: 65px;
  padding: 15px 10px 8px;
  border: 2px solid #ee8b91;
  border-radius: 8px 8px 4px 4px;
  background: white;
  transform: rotate(-4deg);
  box-shadow: 8px 8px 0 #fde0e2;
}

.receipt-paper span {
  display: block;
  height: 3px;
  margin-bottom: 6px;
  border-radius: 9px;
  background: #f1b6ba;
}

.receipt-paper span:nth-child(2) { width: 72%; }
.receipt-paper span:nth-child(3) { width: 86%; }

.receipt-paper b {
  position: absolute;
  display: grid;
  right: -12px;
  bottom: -11px;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--forest-700);
  color: white;
  font-size: 1rem;
  line-height: 1;
}

.empty-upload h4 {
  margin: 0;
  font-size: 0.95rem;
}

.empty-upload > p {
  max-width: 25rem;
  margin: 0.25rem auto 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.upload-action {
  display: inline-flex;
  min-height: 46px;
  padding: var(--ds-space-2) var(--ds-space-3);
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  color: var(--forest-800);
  font-size: 0.8rem;
  font-weight: 800;
}

.upload-action.primary-soft {
  border-color: var(--forest-700);
  background: var(--forest-700);
  color: white;
}

.pages-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.9rem;
  gap: 0.7rem;
}

.page-tile {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f2f2ef;
}

.page-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 146px;
  overflow: hidden;
  border: 0;
  background: #ecece7;
}

.page-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.page-state {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.82);
  color: white;
  font-size: 0.62rem;
  backdrop-filter: blur(5px);
}

.page-state.error {
  background: rgba(190, 64, 56, 0.9);
}

.page-meta {
  padding: 0.55rem 0.6rem;
  background: white;
}

.page-meta strong {
  font-size: 0.72rem;
}

.page-controls {
  display: flex;
  gap: 0.2rem;
}

.page-controls button {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--mint-50);
  color: var(--forest-700);
}

.page-controls button:disabled {
  opacity: 0.3;
  cursor: default;
}

.filled-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0 0.9rem 0.9rem;
  gap: 0.6rem;
}

.add-page {
  display: inline-flex;
  min-height: 42px;
  padding: var(--ds-space-2) var(--ds-space-3);
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  border: 1px dashed #ef9ba0;
  border-radius: 12px;
  background: var(--mint-50);
  color: var(--forest-700);
  font-size: 0.76rem;
  font-weight: 800;
}

.button-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add-page .button-icon {
  width: 18px;
  height: 18px;
}

.upload-error-copy {
  margin: 0 0.9rem 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.72rem;
}

.add-invoice-button {
  width: 100%;
  min-height: 52px;
  margin-top: 0.85rem;
  border: 1px dashed #d7b7b9;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
  color: var(--forest-700);
  font-weight: 800;
}

.add-invoice-button span {
  font-size: 1.2rem;
  vertical-align: -0.08rem;
}

.submission-confirmation {
  margin: 0.8rem auto 0;
  padding: 0 0.5rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.7rem;
}

.history-list {
  display: grid;
  gap: 0.65rem;
}

.history-empty {
  padding: 1.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
}

.history-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  padding: 0.75rem;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: white;
}

.history-thumb {
  position: relative;
  overflow: hidden;
  min-height: 90px;
  border-radius: 12px;
  background: var(--mint-50);
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-thumb span {
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  padding: 0.1rem 0.35rem;
  border-radius: 7px;
  background: rgba(23, 23, 23, 0.82);
  color: white;
  font-size: 0.6rem;
}

.history-header strong {
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.status-pill {
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: #eef1ef;
  color: #5e6864;
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.valid,
.status-pill.available,
.status-pill.credited {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.invalid,
.status-pill.not_eligible,
.status-pill.upload_failed {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.needs_resubmission,
.status-pill.earned_but_locked {
  background: var(--amber-soft);
  color: #815d14;
}

.status-pill.pending_review,
.status-pill.under_review,
.status-pill.pending_verification {
  background: #eaf2fb;
  color: var(--blue);
}

.history-meta {
  margin-top: 0.45rem;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 0.68rem;
}

.reward-status-row {
  display: flex;
  margin-top: 0.5rem;
  align-items: center;
  gap: 0.4rem;
}

.reward-status-row > span:first-child {
  color: var(--muted);
  font-size: 0.66rem;
}

.reason-box {
  margin-top: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 9px;
  background: var(--amber-soft);
  color: #71500f;
  font-size: 0.68rem;
}

.resubmit-button {
  margin-top: 0.45rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #c69127;
  border-radius: 8px;
  background: white;
  color: #765511;
  font-size: 0.68rem;
  font-weight: 800;
}

.icon-button,
.close-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
}

.submit-dock {
  position: fixed;
  z-index: 60;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.7rem max(1rem, calc((100% - 720px) / 2));
  padding-bottom: calc(0.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 -12px 38px rgb(0 0 0 / 0.08);
  backdrop-filter: blur(18px);
}

.primary-button,
.secondary-button {
  min-height: var(--ds-control-height);
  padding: var(--ds-space-3) var(--ds-space-4);
  border-radius: var(--ds-radius-md);
  font-weight: 900;
}

.primary-button {
  width: 100%;
  border: 0;
  background: var(--forest-900);
  color: white;
  box-shadow: 0 8px 20px rgb(227 6 19 / 0.18);
}

.primary-button:hover:not(:disabled) {
  background: var(--forest-800);
}

.primary-button:disabled {
  background: #c8cfcc;
  color: #77807c;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--forest-700);
  background: white;
  color: var(--forest-700);
}

.full-width {
  width: 100%;
}

.submit-progress {
  margin-bottom: 0.55rem;
}

.submit-progress > div {
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.submit-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--forest-700);
  transition: width 250ms ease;
}

.submit-progress small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.66rem;
}

dialog {
  border: 0;
  padding: 0;
}

dialog::backdrop {
  background: rgba(8, 24, 18, 0.62);
  backdrop-filter: blur(3px);
}

.bottom-sheet {
  width: min(100%, 620px);
  max-height: 90vh;
  margin: auto auto 0;
  border-radius: var(--ds-radius-xl) var(--ds-radius-xl) 0 0;
  background: white;
  box-shadow: var(--ds-shadow-overlay);
}

.sheet-content {
  max-height: 90vh;
  overflow-y: auto;
  padding: 0.7rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 1rem;
  border-radius: 99px;
  background: var(--line);
}

.sheet-heading {
  align-items: start;
}

.sheet-heading .eyebrow {
  color: var(--forest-700);
}

.sheet-heading h2 {
  margin: 0.15rem 0;
  font-size: 1.25rem;
}

.terms-list {
  display: grid;
  margin: 1rem 0;
  padding: 0;
  gap: 0.6rem;
  list-style: none;
  counter-reset: terms;
}

.terms-list li {
  position: relative;
  padding: 0.7rem 3rem 0.7rem 0.8rem;
  border-radius: 12px;
  background: var(--mint-50);
  color: #43534c;
  counter-increment: terms;
  font-size: 0.8rem;
}

.terms-list li::before {
  content: counter(terms, persian);
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 9px;
  background: var(--mint-100);
  color: var(--forest-700);
  font-weight: 900;
}

.period-note {
  color: var(--muted);
  font-size: 0.75rem;
}

.preview-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  background: #151515;
  color: white;
}

.preview-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto 1fr auto;
}

.preview-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  padding: calc(0.7rem + env(safe-area-inset-top)) 1rem 0.7rem;
  align-items: center;
}

.preview-toolbar .close-button {
  justify-self: end;
}

.close-button.dark {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.preview-stage {
  display: grid;
  min-height: 0;
  overflow: auto;
  place-items: center;
}

.preview-stage img {
  max-width: 92%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 180ms ease;
}

.preview-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0.7rem 0.75rem calc(0.7rem + env(safe-area-inset-bottom));
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
}

.preview-actions button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-size: 0.69rem;
}

.preview-actions .danger-text {
  color: #ff9e99;
}

.success-dialog {
  width: min(calc(100% - 2rem), 420px);
  border-radius: var(--ds-radius-xl);
  background: white;
  box-shadow: var(--ds-shadow-overlay);
}

.success-content {
  padding: 1.5rem;
  text-align: center;
}

.success-content h2 {
  margin: 0.9rem 0 0.4rem;
  font-size: 1.25rem;
}

.success-content p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.success-mark {
  display: grid;
  width: 62px;
  height: 62px;
  margin: auto;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.6rem;
  font-weight: 900;
}

.reference-list {
  display: grid;
  margin: 1rem 0;
  gap: 0.35rem;
}

.reference-list code {
  padding: 0.45rem;
  border-radius: 9px;
  background: #f4f5f3;
  color: var(--ink);
  direction: ltr;
  font-size: 0.72rem;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 1rem;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: 420px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: var(--forest-950);
  color: white;
  box-shadow: var(--shadow);
  font-size: 0.76rem;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  background: #8d2f2a;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (min-width: 680px) {
  .page-shell {
    padding-top: 2rem;
  }

  .reward-card {
    padding: 1.75rem;
  }

  .pages-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-preview {
    height: 170px;
  }

  .bottom-sheet {
    margin-bottom: 2rem;
    border-radius: var(--ds-radius-xl);
  }
}

/*
 * Figma Mobile DS / Layout / Page Structure:
 * fixed 48px header, independently scrolling body, fixed 64px action footer.
 */
@media (max-width: 679px) {
  html,
  body.capture-app {
    height: 100%;
    overflow: hidden;
  }

  body.capture-app {
    --capture-header-offset: var(--ds-top-app-bar-height);
    --capture-footer-offset: 0px;
    padding-bottom: 0;
    overscroll-behavior: none;
  }

  body.capture-app.is-offline {
    --capture-header-offset: calc(
      var(--ds-top-app-bar-height) + var(--ds-offline-banner-height)
    );
  }

  body.capture-app.has-action-footer {
    --capture-footer-offset: calc(
      var(--ds-bottom-action-height) + env(safe-area-inset-bottom)
    );
  }

  body.capture-app.has-action-footer.is-submitting {
    --capture-footer-offset: calc(96px + env(safe-area-inset-bottom));
  }

  .capture-app .app-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: var(--ds-top-app-bar-height);
    transition: top 160ms ease;
  }

  .capture-app.is-offline .app-header {
    top: var(--ds-offline-banner-height);
  }

  .capture-app .header-inner {
    min-height: var(--ds-top-app-bar-height);
    height: var(--ds-top-app-bar-height);
    padding: var(--ds-space-2) var(--ds-space-3);
  }

  .capture-app .pindis-logo {
    width: 96px;
    height: 20px;
  }

  .capture-app .brand-divider,
  .capture-app .brand-product {
    display: none;
  }

  .capture-app .page-shell {
    position: fixed;
    top: var(--capture-header-offset);
    right: 0;
    bottom: var(--capture-footer-offset);
    left: 0;
    width: 100%;
    margin: 0;
    padding: var(--ds-space-3) var(--ds-space-3) var(--ds-space-6);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-block: var(--ds-space-4);
    scrollbar-gutter: stable;
    transition: top 160ms ease, bottom 160ms ease;
  }

  .capture-app .submit-dock {
    min-height: calc(
      var(--ds-bottom-action-height) + env(safe-area-inset-bottom)
    );
    padding: var(--ds-space-2) var(--ds-space-3);
    padding-bottom: calc(var(--ds-space-2) + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgb(0 0 0 / 0.06);
  }

  .capture-app .submit-dock .primary-button {
    min-height: var(--ds-control-height);
  }

  .capture-app .toast-region {
    bottom: calc(var(--capture-footer-offset) + var(--ds-space-3));
  }

  .page-shell {
    width: min(100% - 1.5rem, 720px);
  }

  .header-inner {
    padding-inline: var(--ds-space-3);
  }

  .reward-card {
    padding: 1.15rem;
    border-radius: 20px;
  }

  .reward-amount-row {
    align-items: start;
  }

  .per-invoice {
    max-width: 7.7rem;
  }

  .preview-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
