:root {
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-2: #ecefe9;
  --text: #14171a;
  --muted: #6c7572;
  --primary: #2e7d5b;
  --primary-strong: #23624a;
  --primary-soft: #e3f0e8;
  --accent: #f5c518;
  --danger: #cf4a5c;
  --danger-soft: #fbe9ec;
  --border: rgba(20, 23, 26, 0.08);
  --border-strong: rgba(20, 23, 26, 0.18);
  --shadow-sm: 0 1px 2px rgba(20, 23, 26, 0.06);
  --shadow: 0 8px 24px rgba(20, 23, 26, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --app-bar-h: 60px;
  --tab-bar-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #12161a;
  --surface: #1b2126;
  --surface-2: #262e34;
  --text: #eef2f0;
  --muted: #9aa5a0;
  --primary: #46b184;
  --primary-strong: #63c79c;
  --primary-soft: #1e3730;
  --accent: #f5c518;
  --danger: #e8697c;
  --danger-soft: #3a2129;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body.has-sheet {
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- shell ---------- */

.app {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100dvh;
  overflow: hidden;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--app-bar-h);
  padding: calc(var(--safe-t) + 8px) 16px 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary-soft);
  font-size: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-text small {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 24px;
  scroll-padding-top: 52px;
}

.view {
  max-width: 640px;
  margin: 0 auto;
  animation: fade-in 180ms ease both;
}

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

.tab-bar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px 8px calc(6px + var(--safe-b));
  min-height: calc(var(--tab-bar-h) + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 30;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.tab-icon {
  font-size: 20px;
  line-height: 1;
}

.tab-label {
  font-size: 11.5px;
  font-weight: 600;
}

.tab.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- primitives ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 90ms ease, background 140ms ease, opacity 140ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 12px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  transition: background 140ms ease;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.input,
.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.input:focus,
.textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: transparent;
}

.textarea {
  min-height: 168px;
  resize: vertical;
  line-height: 1.5;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.switch-row:first-of-type {
  border-top: 0;
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.switch-text strong {
  font-size: 14.5px;
  font-weight: 600;
}

.switch-text small {
  color: var(--muted);
  font-size: 12.5px;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  appearance: none;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 160ms ease;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease;
}

.switch:checked {
  background: var(--primary);
  border-color: transparent;
}

.switch:checked::after {
  transform: translateX(20px);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13.5px;
  margin-bottom: 14px;
}

.banner-warn {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- lista ---------- */

.summary {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ring {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p, 0) * 1%), var(--surface-2) 0);
  display: grid;
  place-items: center;
}

.ring::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--surface);
}

.ring-value {
  position: relative;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.summary-info {
  min-width: 0;
  flex: 1;
}

.summary-info strong {
  display: block;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.summary-info small {
  color: var(--muted);
  font-size: 13px;
}

.summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.add-row .input {
  flex: 1;
  min-width: 0;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin: 0 -2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}

.chip:active {
  transform: scale(0.97);
}

.chip-plus {
  color: var(--primary);
  font-weight: 700;
}

.chip small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 4px 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.suggestions {
  margin-bottom: 4px;
}

.group {
  margin-bottom: 12px;
}

.group-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 8px;
  background: var(--bg);
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
}

.group-header.is-other {
  color: var(--danger);
}

.group-icon {
  font-size: 16px;
}

.group-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.group-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.group-chevron {
  font-size: 11px;
  transition: transform 160ms ease;
}

.group-header[aria-expanded='false'] .group-chevron {
  transform: rotate(-90deg);
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: start;
  gap: 4px;
  padding: 4px 8px 4px 0;
  border-top: 1px solid var(--border);
}

.item:first-child {
  border-top: 0;
}

.item-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  min-height: 64px;
  padding: 12px 4px 12px 12px;
  cursor: pointer;
}

.check {
  position: relative;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin: 1px 0 0;
  appearance: none;
  border: 2px solid var(--border-strong);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.check::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 140ms ease;
}

.check:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.check:checked::after {
  transform: rotate(45deg) scale(1);
}

.item-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.item-name {
  min-width: 0;
  width: 100%;
  font-size: 16px;
  line-height: 1.45;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.item-details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.item-author {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.item-meta {
  flex: 0 1 auto;
  max-width: 100%;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
}

.item.is-checked .item-name {
  color: var(--muted);
  text-decoration: line-through;
}

.item-btn {
  display: grid;
  place-items: center;
  align-self: start;
  width: 44px;
  height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.item-btn:hover {
  background: var(--surface-2);
}

.item-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.item-action-list { display: grid; gap: 10px; }
.item-action-list .btn { min-height: 48px; justify-content: flex-start; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.empty-art {
  font-size: 46px;
  line-height: 1;
}

.empty-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty-text {
  color: var(--muted);
  font-size: 14px;
  max-width: 34ch;
}

.hint-list {
  display: grid;
  gap: 6px;
  width: 100%;
  margin: 4px 0 6px;
  padding: 0;
  list-style: none;
}

.hint-list li {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
}

.hint-list code {
  color: var(--text);
  font-size: 12px;
}

/* ---------- corsie ---------- */

.order-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  touch-action: manipulation;
}

.order-row.is-dragging {
  opacity: 0.92;
  border-color: var(--primary);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.order-row.is-pinned {
  border-style: dashed;
}

.drag-handle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: grab;
  touch-action: none;
}

.order-row.is-pinned .drag-handle {
  cursor: not-allowed;
  opacity: 0.35;
}

.order-icon {
  font-size: 17px;
}

.order-label {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.order-actions {
  display: flex;
  gap: 2px;
}

.order-actions .icon-btn {
  width: 34px;
  height: 34px;
  font-size: 14px;
  border-radius: 9px;
}

.order-actions .icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- categorie picker ---------- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.cat-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.cat-option.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

/* ---------- storico ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.stat small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.session:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.session-head {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.session-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.session-toggle[aria-expanded='false'] .group-chevron {
  transform: rotate(-90deg);
}

.session-date {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
}

.session-count {
  color: var(--muted);
  font-size: 12.5px;
}

.session-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.rank-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.rank-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.rank-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.rank-value {
  min-width: 34px;
  text-align: right;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- sheet ---------- */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 16, 14, 0.45);
  opacity: 0;
  transition: opacity 200ms ease;
}

.sheet-root.is-open .sheet-backdrop {
  opacity: 1;
}

.sheet-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding: 8px 16px calc(16px + var(--safe-b));
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.24);
  transform: translateY(102%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-root.is-open .sheet-panel {
  transform: translateY(0);
}

.sheet-grabber {
  width: 40px;
  height: 4px;
  margin: 4px auto 10px;
  border-radius: 999px;
  background: var(--border-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sheet-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.sheet-body {
  margin-top: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-text {
  font-size: 14.5px;
  color: var(--muted);
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.sheet-actions .btn {
  flex: 1;
}

.preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  min-height: 34px;
  font-size: 13px;
  color: var(--muted);
}

.preview strong {
  color: var(--text);
}

/* ---------- toast ---------- */

.cloud-locked .app { display: none; }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-wrap[hidden] { display: none; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: 24px; margin: 8px 0; }
.auth-card h2 { margin-top: 18px; }
.auth-field { display: grid; gap: 6px; margin: 16px 0; font-size: 14px; }
.auth-error { color: var(--danger); margin-bottom: 12px; }
.sync-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 16px; font-size: 12px; color: var(--muted); }
.sync-bar .btn { min-height: 30px; }

.product-name-list { margin-top: 12px; }
.quick-input { min-height: 52px; max-height: 200px; resize: vertical; line-height: 1.45; }
.quick-hint { display: block; color: var(--muted); font-size: 12px; margin: -4px 0 10px; }
.quick-completions { margin-bottom: 10px; }
.history-filters { margin: 12px 0; flex-wrap: wrap; }
.history-rank-row { display: grid; grid-template-columns: minmax(0, 1fr) 60px 34px 36px; }
.rank-product { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.rank-product small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.history-rank-row .btn { min-width: 34px; padding: 4px; }
@media (max-width: 440px) {
  .history-rank-row { grid-template-columns: minmax(0, 1fr) 32px 36px; }
  .history-rank-row .rank-bar { display: none; }
}
.product-name-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.product-name-row .add-row { margin: 0 0 8px; }
.product-name-row input { min-width: 0; }
.source-lines { padding-left: 20px; margin: 8px 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.source-lines li { margin: 6px 0; }
.order-meta { color: var(--muted); font-size: 12px; margin: 0 0 8px; overflow-wrap: anywhere; }
.original-order, .unconfirmed-orders { margin-top: 12px; }
.original-order summary, .unconfirmed-orders summary, .product-name-row summary { cursor: pointer; font-size: 13px; padding: 8px 0; }
.unconfirmed-orders { border-top: 1px solid var(--border); padding-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-bar-h) + var(--safe-b) + 14px);
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 14px;
  background: #262e34;
  color: #f4f7f5;
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 70;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-action {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}

/* ---------- motion ---------- */

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

@media (min-width: 560px) {
  .main {
    padding-left: 20px;
    padding-right: 20px;
  }
}
