:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --bg-elevated: #ffffff;
  --text: #171717;
  --muted: #666666;
  --soft: #8a8f98;
  --line: rgba(23, 23, 23, 0.08);
  --line-strong: rgba(23, 23, 23, 0.14);
  --primary: #171717;
  --primary-hover: #000000;
  --accent: #0072f5;
  --accent-soft: #ebf5ff;
  --done: #16a34a;
  --done-soft: #ecfdf3;
  --payback-blue: #2563eb;
  --payback-blue-soft: #eff6ff;
  --review-red: #dc2626;
  --review-red-soft: #fff1f2;
  --review-green: #16a34a;
  --review-green-soft: #ecfdf3;
  --purchase-only: #dc2626;
  --purchase-only-soft: #fff1f2;
  --success: #0f9f6e;
  --success-soft: #e9fbf3;
  --danger: #d92d20;
  --danger-soft: #fff1f0;
  --warning-soft: #fff7ed;
  --shadow-border: 0 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 2px rgba(0, 0, 0, 0.04), 0 12px 28px -20px rgba(0, 0, 0, 0.28), inset 0 0 0 1px #fafafa;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --page-pad: clamp(16px, 4vw, 48px);
  --max-width: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'liga' 1;
  background:
    radial-gradient(circle at top left, rgba(0, 114, 245, 0.10), transparent 32rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #f4f6fa 100%);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button, input, select, textarea, label { min-width: 0; }
[hidden] { display: none !important; }
button { touch-action: manipulation; }

.app-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 0 var(--page-pad) max(40px, env(safe-area-inset-bottom));
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--page-pad);
}
.auth-card {
  width: min(100%, 460px);
  display: grid;
  gap: 16px;
  padding: clamp(22px, 5vw, 34px);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-card);
}
.auth-card h1 { margin: 0; font-size: clamp(30px, 8vw, 46px); }
.auth-form { display: grid; gap: 10px; }
.auth-message { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  padding: 8px 4px;
  min-height: 44px;
  font-weight: 700;
}
.link-button.inline {
  display: inline;
  min-height: 0;
  padding: 0;
  font-size: inherit;
}
.auth-card .secondary { width: 100%; }

.hero {
  padding: clamp(18px, 4vw, 36px) 0 clamp(20px, 4vw, 42px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: clamp(24px, 5vw, 52px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: #171717;
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--shadow-card);
}
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong { font-size: 15px; letter-spacing: -0.02em; }
.eyebrow, .section-kicker {
  margin: 0;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.safe-badge {
  margin-left: auto;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #3f4652;
  box-shadow: var(--shadow-border);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.safe-badge a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--page-pad);
}
.legal-card {
  width: min(100%, 760px);
  display: grid;
  gap: 14px;
  padding: clamp(22px, 5vw, 38px);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-card);
}
.legal-card h1, .legal-card h2, .legal-card p { margin: 0; }
.legal-card h1 { font-size: clamp(30px, 7vw, 44px); letter-spacing: -0.05em; }
.legal-card h2 { margin-top: 8px; font-size: 18px; }
.legal-card ul { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.65; }
.legal-card p { color: var(--muted); line-height: 1.65; }
.legal-updated { font-size: 12px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 4vw, 34px);
  align-items: stretch;
}
.hero-copy { min-width: 0; }
.status-pill, .mini-badge, .status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: #0068d6;
  white-space: nowrap;
}
h1 {
  max-width: 760px;
  margin: 14px 0 14px;
  font-size: clamp(34px, 7vw, 64px);
  line-height: .98;
  letter-spacing: clamp(-2.6px, -0.06em, -1.2px);
  font-weight: 700;
}
h2 {
  margin: 4px 0 0;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.18;
  letter-spacing: -0.04em;
}
.subcopy {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.65;
}

.hero-card, .panel, .summary-card, .item-card {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
}
.hero-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  align-content: center;
}
.flow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.flow-step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f2f4f7;
  color: var(--muted);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 600;
}
.flow-step.active span { background: #171717; color: #fff; }
.flow-step strong { min-width: 0; font-size: 14px; letter-spacing: -0.02em; }
.flow-step em { min-width: 0; color: var(--muted); font-size: 12px; font-style: normal; }
.flow-line { width: 1px; height: 14px; margin-left: 27px; background: linear-gradient(var(--line-strong), transparent); }

main { display: grid; gap: 18px; }
.summary-section { display: grid; gap: 12px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.section-heading.compact { margin-bottom: 0; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.summary-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 15px;
}
.summary-card::after {
  content: '';
  position: absolute;
  right: -24px;
  top: -24px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: rgba(0, 114, 245, 0.08);
}
.summary-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.summary-card strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 700;
}
.summary-filter-row {
  display: flex;
  justify-content: flex-end;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.import-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.panel { padding: clamp(16px, 3vw, 22px); }
.hint, .meta, .empty { color: var(--muted); }
.hint { margin: 0 0 16px; line-height: 1.55; }
.form-panel { display: grid; }
.base-info-panel { gap: 12px; }
.base-info-form {
  display: grid;
  gap: 10px;
}
.base-info-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, .72fr);
  gap: 10px;
  align-items: end;
}
.base-info-form .manual-source-field { grid-column: 1 / -1; }
.base-info-form .primary-action { min-height: 40px; white-space: nowrap; }
.primary-import { gap: 10px; }
.ocr-preview-panel { gap: 14px; border: 2px solid rgba(0, 114, 245, .16); }
.preview-items { display: grid; gap: 12px; }
.ocr-preview-card { border-radius: 14px; box-shadow: var(--shadow-border); }
.manual-entry-panel { gap: 12px; }
.manual-entry-panel > summary {
  cursor: pointer;
  font-weight: 900;
  letter-spacing: -.02em;
  list-style-position: inside;
}
.manual-entry-panel > summary::marker { color: var(--accent); }
.manual-entry-panel[open] > summary { margin-bottom: 14px; }
.manual-item-panel { display: grid; gap: 12px; }
.partners-admin-panel {
  gap: 14px;
  border: 2px solid rgba(23, 23, 23, .12);
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 251, 255, .94));
}
.partners-admin-form { display: grid; gap: 12px; }
.affiliate-disclosure {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warning-soft);
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.5;
}
.partners-admin-result { display: grid; gap: 10px; }
.partners-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.partners-history-header h3 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
.partners-result-summary { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.partners-result-list,
.partners-history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.partners-result-list li,
.partners-history-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-border);
}
.partners-result-list li > span { font-weight: 750; }
.partners-result-list li > a { grid-column: 1 / -1; }
.partners-result-list .copy-link-button { grid-column: 2; grid-row: 1; }
.partners-history-list li > div { display: grid; gap: 4px; min-width: 0; }
.partners-history-list small { color: var(--soft); font-size: 12px; }
.partners-result-list a,
.partners-history-list a {
  color: var(--accent);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.copy-link-button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

label, .field-label {
  display: grid;
  gap: 5px;
  margin-bottom: 7px;
  color: #303744;
  font-size: 13px;
  font-weight: 650;
}
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 13px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-border);
  outline: none;
  transition: box-shadow .16s ease, background .16s ease, transform .16s ease;
}
textarea { min-height: 148px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px rgba(0, 114, 245, .14);
}

.file-drop {
  position: relative;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 84px;
  margin-bottom: 0;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-border);
  cursor: pointer;
}
.file-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.file-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #171717;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}
.file-copy { display: grid; gap: 3px; min-width: 0; }
.file-copy strong { font-size: 15px; letter-spacing: -0.02em; }
.file-copy em { color: var(--muted); font-size: 13px; font-style: normal; }

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
button:hover { background: var(--primary-hover); transform: translateY(-1px); }
button:disabled { opacity: .62; cursor: progress; transform: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary { background: #fff; color: #171717; box-shadow: var(--shadow-border); }
button.secondary:hover { background: #f7f8fb; color: #171717; }
.filters button.secondary.active { background: #171717; color: #fff; }
.refresh-button.is-loading { background: #fff; color: #666; }
button.danger { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px rgba(217, 45, 32, .14); }
button.danger:hover { background: #ffe4e2; color: #b42318; }
.primary-action { width: 100%; margin-top: 2px; }
.refresh-button { flex: 0 0 auto; }

.list-panel { padding-bottom: 12px; }
.list-heading { align-items: center; }
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.filters button {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px;
  border-radius: 999px;
}
.list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 4px 0 14px;
}
.search-field { margin-bottom: 0; }
.search-field input { min-height: 44px; }
#clear-filters-button { white-space: nowrap; }
.month-calendar {
  display: grid;
  gap: 8px;
  margin: 2px 0 14px;
}
.month-calendar-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}
.month-calendar-header strong {
  min-width: 0;
  text-align: center;
  font-size: 16px;
  letter-spacing: -0.03em;
}
.calendar-nav {
  min-width: 44px;
  padding: 0;
  font-size: 18px;
}
.month-calendar-weekdays,
.month-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.month-calendar-weekdays span {
  color: var(--soft);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}
.calendar-blank,
.calendar-day {
  min-height: 42px;
  border-radius: 12px;
}
.calendar-day {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px 2px;
  background: #fff;
  color: #303744;
  box-shadow: var(--shadow-border);
  font-size: 12px;
}
.calendar-day:disabled {
  opacity: .36;
  cursor: default;
  transform: none;
}
.calendar-day.has-items {
  color: #111827;
}
.calendar-day.active {
  background: #171717;
  color: #fff;
}
.calendar-date { line-height: 1; }
.calendar-quantity {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
}
.calendar-day.active .calendar-quantity { background: #fff; color: #171717; }

.items { display: grid; gap: 14px; }
.item-card {
  overflow: hidden;
  display: grid;
  gap: 0;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 8px 24px -18px rgba(0,0,0,.32);
  background: #fff;
}
.market-order-card { border-radius: 4px; }
.item-card.is-completed {
  order: 20;
  background: #fbfcfd;
}
.item-card.is-done {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, .30), 0 10px 24px -18px rgba(22, 163, 74, .58);
}
.item-card.is-purchase-only {
  box-shadow: 0 0 0 2px rgba(220, 38, 38, .28), 0 10px 24px -18px rgba(220, 38, 38, .50);
}
.item-card.is-review-completed,
.item-card.is-review-completed .order-date-row,
.item-card.is-review-completed .payback-strip { background: var(--review-green-soft); }
.item-card.is-payback-completed,
.item-card.is-payback-completed .order-date-row,
.item-card.is-payback-completed .payback-strip { background: var(--payback-blue-soft); }
.item-card.is-review-before,
.item-card.is-review-before .order-date-row,
.item-card.is-review-before .payback-strip { background: var(--review-red-soft); }
.item-card.is-completed .order-body,
.item-card.is-completed .order-date-row {
  opacity: .74;
}
.item-card.is-collapsed .order-body,
.item-card.is-collapsed .item-controls,
.item-card.is-collapsed .actions {
  display: none;
}

.order-date-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 18px 18px 15px;
  border-bottom: 1px solid #eef0f3;
}
.order-date-row strong {
  font-size: clamp(24px, 5.4vw, 34px);
  line-height: 1;
  letter-spacing: -0.06em;
  font-weight: 800;
}
.collapsed-product-name {
  display: none;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f2933;
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 800;
  letter-spacing: -0.04em;
}
.item-card.is-collapsed .collapsed-product-name {
  display: block;
}
.more-button {
  min-height: 38px;
  min-width: 64px;
  flex-shrink: 0;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .75);
  color: #3f4652;
  box-shadow: var(--shadow-border);
  font-size: 13px;
  letter-spacing: -0.02em;
  cursor: pointer;
  white-space: nowrap;
}
.more-button:hover,
.more-button:active {
  background: rgba(255, 255, 255, .95);
  color: #171717;
  transform: none;
}
.order-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}
.order-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  color: #1f2933;
  font-size: clamp(20px, 4.8vw, 31px);
  line-height: 1.18;
  letter-spacing: -0.06em;
}
.order-status-line strong {
  color: #0b0d12;
  font-weight: 800;
}
.market-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #3f4652;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.order-product-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.product-thumb {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 38% 34%, #ff5b67 0 14px, transparent 15px),
    radial-gradient(circle at 62% 54%, #f7b13a 0 18px, transparent 19px),
    linear-gradient(135deg, #fff1f2, #f6fbff);
  color: rgba(11, 13, 18, .46);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
  font-size: 12px;
  font-weight: 800;
}
.order-product-copy { min-width: 0; }
.item-card h3 {
  min-width: 0;
  margin: 0;
  color: #111827;
  font-size: clamp(20px, 4.5vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.055em;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.order-price-line {
  margin: 4px 0 0;
  color: #666;
  font-size: clamp(18px, 4.2vw, 26px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}
.payback-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 18px 16px;
}
.payback-note { color: var(--muted); font-size: 13px; }
.status-chip.completed { background: var(--payback-blue-soft); color: var(--payback-blue); }
.status-chip.pending { background: var(--review-red-soft); color: var(--review-red); }
.item-card.is-review-completed .status-chip.completed { background: var(--review-green-soft); color: var(--review-green); }
.item-card.is-payback-completed .status-chip.completed { background: var(--payback-blue-soft); color: var(--payback-blue); }
.item-card.is-review-before .status-chip.pending { background: var(--review-red-soft); color: var(--review-red); }
.item-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-items: end;
  padding: 10px 14px 2px;
  border-top: 8px solid #f3f4f6;
}
.item-controls.correction-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.compact-controls label { margin-bottom: 6px; }
.item-controls .wide { grid-column: 1 / -1; min-width: 0; }
.payback-review-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
.amount-row,
.status-review-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.payback-review-row label { min-width: 0; }
.payback-review-row input,
.payback-review-row select {
  min-height: 44px;
  padding: 10px 8px;
  font-size: clamp(13px, 3.2vw, 15px);
  text-overflow: clip;
}
.correction-field input, .correction-controls input { background: #fbfdff; }
.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .78fr);
  gap: 8px;
  padding: 8px 14px 14px;
}
.danger-action {
  background: #fff5f5;
  color: #c2410c;
  box-shadow: inset 0 0 0 1px rgba(194,65,12,.18);
}
.danger-action:hover { background: #ffedd5; }
.empty {
  margin: 0;
  padding: 22px;
  border-radius: 16px;
  background: #fafafa;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}

#toast {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(calc(100vw - 28px), 520px);
  border-radius: 999px;
  padding: 12px 16px;
  background: #171717;
  color: white;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1040px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { padding-inline: 14px; }
  .topbar { align-items: flex-start; }
  .safe-badge { white-space: normal; text-align: right; }
  .hero-card { display: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .base-info-row { grid-template-columns: minmax(0, 1fr) minmax(120px, .72fr); }
  .base-info-form .primary-action { grid-column: 1 / -1; }
  .section-heading, .list-heading { display: grid; grid-template-columns: 1fr; }
  .list-tools { grid-template-columns: minmax(0, 1fr); }
  .summary-filter-row { justify-content: stretch; }
  .filters { justify-content: stretch; }
  .filters button { flex: 1 1 auto; }
  .order-date-row { padding: 16px 14px 13px; }
  .order-body { padding: 16px 14px; }
  .order-product-row { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .product-thumb { width: 96px; height: 96px; }
  .payback-strip { padding: 0 14px 14px; }
  .status-chip { width: fit-content; }
  .item-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  .actions { grid-template-columns: minmax(0, 1fr); padding: 0 14px 14px; }
  .actions button { min-height: 48px; }
}

@media (max-width: 420px) {
  .app-shell { padding-inline: 12px; }
  .brand-copy .eyebrow { display: none; }
  .safe-badge { display: none; }
  h1 { font-size: clamp(30px, 10vw, 38px); }
  .subcopy { font-size: 15px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .base-info-row { grid-template-columns: minmax(0, 1fr) minmax(104px, .7fr); }
  .base-info-form .primary-action { grid-column: 1 / -1; }
  .panel { padding: 14px; border-radius: 16px; }
  .summary-card { padding: 14px; }
  .file-drop { grid-template-columns: 38px 1fr; min-height: 76px; }
  .file-icon { width: 38px; height: 38px; }
  .order-product-row { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }
  .product-thumb { width: 82px; height: 82px; font-size: 11px; }
  textarea { min-height: 132px; }
}

@media (max-width: 350px) {
  .summary-card { padding: 12px; }
  .summary-card strong { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
