:root {
  color-scheme: light;
  --ink: #12243a;
  --muted: #65758a;
  --navy: #153456;
  --navy-2: #1f527f;
  --green: #17865f;
  --green-soft: #dff5eb;
  --blue-soft: #eaf2f8;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --line: #dce4ec;
  --danger: #b42318;
  --shadow: 0 12px 32px rgb(25 47 74 / 10%);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  max-width: 100%;
  overflow-x: hidden;
  background: var(--canvas);
}

body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
}

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

button { touch-action: manipulation; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) 20px 15px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

h1 { margin-bottom: 0; font-size: 1.45rem; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 1.65rem; letter-spacing: -.035em; }
h3 { margin-bottom: 0; font-size: 1.05rem; }

.eyebrow {
  margin-bottom: 3px;
  color: var(--navy-2);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.local-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #116445;
  font-size: .75rem;
  font-weight: 700;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px 16px calc(94px + env(safe-area-inset-bottom));
}

.screen { display: none; }
.screen.is-active { display: block; animation: screen-in 180ms ease-out; }

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

.screen-heading,
.dialog-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.screen-heading { margin-bottom: 18px; }

.primary-button,
.secondary-button,
.icon-button,
.sale-button,
.ship-button,
.complete-button,
.transaction-button,
.photo-button,
.edit-button,
.complaint-button,
.delete-button,
.danger-button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  padding: 0 17px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 14px rgb(21 52 86 / 18%);
}

.primary-button:hover { background: #0d2a49; }

.secondary-button {
  padding: 0 17px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--blue-soft);
  color: var(--navy);
  font-size: 1.5rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 25px 22px 22px;
  border-radius: 22px;
  background: linear-gradient(145deg, #153456 0%, #206191 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -70px;
  top: -90px;
  border-radius: 50%;
  background: rgb(255 255 255 / 7%);
}

.hero-card > p { margin-bottom: 4px; color: #dbe9f4; font-weight: 700; }
.hero-card > strong { display: block; margin-bottom: 22px; font-size: clamp(2.45rem, 12vw, 4.5rem); line-height: 1; letter-spacing: -.055em; }

.goal-copy { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: #eef6fb; font-size: .86rem; font-weight: 700; }

.progress-track { height: 11px; overflow: hidden; border-radius: 999px; background: rgb(255 255 255 / 20%); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #62dda6; transition: width 300ms ease; }

.milestones { display: flex; gap: 8px; margin-top: 16px; }
.milestone { padding: 6px 9px; border: 1px solid rgb(255 255 255 / 25%); border-radius: 999px; color: #dbe9f4; font-size: .72rem; font-weight: 800; }
.milestone.is-achieved { border-color: #62dda6; background: rgb(98 221 166 / 18%); color: #fff; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin: 14px 0;
}

.metric-card,
.panel,
.placeholder-card,
.product-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 5px 16px rgb(25 47 74 / 5%);
}

.metric-card { min-width: 0; padding: 15px; border-radius: 15px; }
.metric-card span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.metric-card strong { display: block; overflow-wrap: anywhere; font-size: 1.13rem; }

.inventory-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  padding: 15px 16px;
  border: 1px solid #edc68a;
  border-radius: 15px;
  background: #fff6df;
  color: #704700;
}
.inventory-warning[hidden] { display: none; }
.inventory-warning strong { display: block; margin-bottom: 4px; }
.inventory-warning p { margin: 0; font-size: .82rem; line-height: 1.55; }
.warning-button { flex: 0 0 auto; min-height: 42px; padding: 0 14px; border: 1px solid #d49b3f; border-radius: 11px; background: #fff; color: #704700; cursor: pointer; font-weight: 800; }

.panel,
.placeholder-card { padding: 18px; border-radius: 17px; }

.panel-heading { margin-bottom: 13px; }
.empty-state { padding: 20px 10px; color: var(--muted); text-align: center; font-size: .9rem; }

.product-grid { display: grid; gap: 12px; }
.product-search-panel { display: grid; grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr); gap: 12px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.product-search-panel > label { margin: 0; }
.product-detail-filters { grid-column: 1 / -1; margin: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; padding: 3px 13px 0; }
.filter-reset { width: calc(100% - 26px); margin: 0 13px 13px; }
.product-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.product-toolbar label { width: min(260px, 100%); margin: 0; }
.product-toolbar select { min-height: 42px; }
.product-toolbar > span { flex: 0 0 auto; padding-bottom: 11px; color: var(--muted); font-size: .8rem; font-weight: 800; }

.product-card { padding: 17px; border-radius: 17px; }
.product-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.product-card h3 { margin-bottom: 5px; overflow-wrap: anywhere; }
.management-id { margin: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .76rem; }
.status-badge { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--navy-2); font-size: .72rem; font-weight: 800; }
.status-badge.is-sold { background: var(--green-soft); color: #116445; }
.status-stack { display: grid; justify-items: end; gap: 6px; }
.status-badge.is-long { background: #fff0cf; color: #825100; }
.product-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 17px 0; }
.product-facts div { min-width: 0; }
.product-facts span { display: block; margin-bottom: 3px; color: var(--muted); font-size: .72rem; }
.product-facts strong { overflow-wrap: anywhere; font-size: .9rem; }
.status-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-bottom: 10px; }
.status-editor label { margin: 0; }
.status-editor select { min-height: 42px; }
.status-editor .secondary-button { min-width: 104px; padding: 0 10px; }
.product-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.product-actions > :only-child { grid-column: 1 / -1; }
.sale-button, .ship-button, .complete-button, .transaction-button, .photo-button, .edit-button, .complaint-button, .delete-button { width: 100%; padding: 0 11px; border-color: #b9c9d8; background: #f5f9fc; color: var(--navy); }
.ship-button { border-color: #edc68a; background: #fff6df; color: #704700; }
.complete-button { border-color: #b8dccd; background: #e8f7f0; color: #116445; }
.transaction-button { border-color: #a9c7e1; background: #eef7ff; color: var(--navy-2); }
.photo-button { border-color: #b8dccd; background: #f0faf6; color: #116445; }
.edit-button { border-color: #c7d3df; background: #fff; }
.complaint-button { border-color: #d6c4e8; background: #faf7ff; color: #604080; }
.delete-button { border-color: #e6bbb6; background: #fff7f6; color: var(--danger); }
.sale-summary { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--green); font-weight: 800; }

.recent-list { display: grid; gap: 9px; }
.recent-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.recent-row:last-child { border-bottom: 0; }
.recent-row p { margin: 0 0 3px; font-weight: 800; }
.recent-row span { color: var(--muted); font-size: .75rem; }
.recent-row strong { flex: 0 0 auto; color: var(--green); }
.recent-row:hover { color: var(--navy-2); }
.recent-row-result { display: grid; flex: 0 0 auto; justify-items: end; gap: 3px; }

.placeholder-card { color: var(--muted); }
.placeholder-card h3 { margin-bottom: 8px; color: var(--ink); }
.placeholder-card p { margin-bottom: 0; line-height: 1.7; }
.results-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.results-controls label { margin: 0; }
.results-section { margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 5px 16px rgb(25 47 74 / 5%); }
.results-section .panel-heading > strong { color: var(--navy-2); font-size: .9rem; }
.results-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.results-metric-grid article { min-width: 0; padding: 13px; border-radius: 12px; background: #f3f6f9; }
.results-metric-grid span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.results-metric-grid strong { display: block; overflow-wrap: anywhere; font-size: 1rem; }
.monthly-chart { display: grid; gap: 9px; margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); }
.monthly-chart-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(74px, auto); align-items: center; gap: 9px; }
.monthly-chart-label { color: var(--muted); font-size: .73rem; font-weight: 800; }
.monthly-chart-track { height: 9px; overflow: hidden; border-radius: 999px; background: #edf1f5; }
.monthly-chart-bar { display: block; min-width: 2px; height: 100%; border-radius: inherit; background: var(--green); }
.monthly-chart-bar.is-negative { background: var(--danger); }
.monthly-chart-value { overflow-wrap: anywhere; text-align: right; font-size: .77rem; }

.settings-summary p { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 0; padding: 13px 0; border-bottom: 1px solid var(--line); }
.settings-summary p:first-child { padding-top: 0; }
.settings-summary p span { color: var(--muted); }
.settings-summary .settings-note { display: block; padding-bottom: 0; border-bottom: 0; color: var(--muted); font-size: .85rem; line-height: 1.65; }
.preset-panel { margin-top: 14px; }
.preset-panel .panel-heading { align-items: flex-end; }
.preset-panel .panel-heading .secondary-button { flex: 0 0 auto; padding-inline: 12px; white-space: nowrap; }
.panel-actions { display: flex; gap: 7px; }
.compact-button { min-height: 38px; padding: 0 11px; }
.app-settings-panel .panel-heading { margin-bottom: 12px; }
.milestone-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 9px; }
.milestone-setting-list { display: grid; gap: 8px; }
.milestone-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfd; }
.milestone-setting-row label { margin: 0; }
.milestone-setting-actions { display: flex; gap: 5px; }
.delete-preset-button { min-height: 38px; padding: 0 10px; border: 1px solid #e6bbb6; border-radius: 10px; background: #fff7f6; color: var(--danger); cursor: pointer; font-weight: 800; }
.panel-note { margin: -2px 0 15px; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.backup-panel, .danger-panel { margin-top: 14px; }
.last-backup { margin: 0 0 13px; color: var(--muted); font-size: .83rem; }
.last-backup strong { color: var(--ink); }
.backup-button { width: 100%; }
.restore-form { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.restore-form label { margin: 0; }
.restore-form p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.danger-panel { border-color: #e6bbb6; background: #fffafa; }
.danger-panel h3 { margin-bottom: 8px; color: var(--danger); }
.danger-panel > p { color: #7a3a34; font-size: .82rem; line-height: 1.6; }
.danger-button { width: 100%; padding: 0 16px; border-color: #d89993; background: #fff; color: var(--danger); }
.preset-list { display: grid; gap: 9px; }
.preset-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px auto auto; align-items: end; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfd; }
.preset-row label { margin: 0; }
.preset-row input { min-height: 42px; }
.preset-active { display: flex; align-items: center; gap: 6px; min-height: 42px; margin: 0; white-space: nowrap; }
.preset-active input { width: 18px; min-height: 18px; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  min-width: 0;
  min-height: 54px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .71rem;
  font-weight: 800;
}

.bottom-nav button span { display: block; margin-bottom: 2px; font-size: 1.1rem; }
.bottom-nav button.is-active { background: var(--blue-soft); color: var(--navy); }

.form-dialog {
  width: min(620px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(10 27 46 / 28%);
}

.form-dialog::backdrop { background: rgb(12 30 49 / 58%); backdrop-filter: blur(3px); }
.form-dialog form { min-width: 0; padding: 21px; overflow-x: hidden; }
.dialog-heading { margin-bottom: 20px; }
.dialog-heading > div { min-width: 0; }
.dialog-heading h2 { overflow-wrap: anywhere; }

label { display: grid; gap: 7px; margin-bottom: 15px; color: var(--ink); font-size: .86rem; font-weight: 800; }
.required { margin-left: 7px; color: var(--danger); font-size: .7rem; }

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #b9c7d5;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-size: 16px;
  font-weight: 500;
}

textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgb(31 82 127 / 13%); }
input[readonly] { background: #eef3f7; color: var(--muted); }

.money-input { display: flex; align-items: center; min-height: 46px; padding-left: 12px; border: 1px solid #b9c7d5; border-radius: 11px; background: #fff; }
.money-input:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgb(31 82 127 / 13%); }
.money-input > span { color: var(--muted); }
.money-input input { flex: 1 1 auto; width: auto; border: 0; box-shadow: none; }

details { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; }
summary { padding: 13px; cursor: pointer; color: var(--navy-2); font-size: .87rem; font-weight: 800; }
.optional-fields { padding: 3px 13px 1px; }
.field-grid { display: grid; gap: 0; }

.profit-preview { display: grid; gap: 3px; margin: 8px 0 11px; padding: 16px; border-radius: 14px; background: var(--green-soft); color: #0e5a3f; }
.profit-preview span { font-size: .78rem; font-weight: 800; }
.profit-preview strong { font-size: 1.7rem; letter-spacing: -.035em; }
.profit-preview small { font-weight: 700; }

.form-hint { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.form-error { min-height: 1.25em; margin-bottom: 8px; color: var(--danger); font-size: .82rem; font-weight: 700; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(83px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 999px;
  background: #102b48;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
  font-size: .85rem;
  font-weight: 700;
}

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

.file-picker input { padding: 9px; background: #f7fafc; }
.file-picker input::file-selector-button { margin-right: 10px; padding: 8px 11px; border: 0; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 800; }
.photo-count { margin: 0 0 11px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.photo-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.photo-empty { grid-column: 1 / -1; padding: 28px 12px; border: 1px dashed #b9c7d5; border-radius: 14px; color: var(--muted); text-align: center; font-size: .84rem; }
.photo-tile { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.photo-preview-button { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: #e7edf2; cursor: zoom-in; }
.photo-preview-button img { width: 100%; height: 100%; object-fit: cover; }
.photo-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; padding: 7px; }
.photo-controls button { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #f7fafc; color: var(--navy); cursor: pointer; font-weight: 800; }
.photo-controls button:disabled { cursor: default; opacity: .4; }
.photo-controls .delete-photo { color: var(--danger); }

.image-viewer { width: min(920px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 12px; border: 0; border-radius: 18px; background: #0d1c2b; box-shadow: 0 24px 80px rgb(10 27 46 / 35%); }
.image-viewer::backdrop { background: rgb(5 15 25 / 75%); }
.image-viewer > .icon-button { position: absolute; top: 18px; right: 18px; z-index: 2; }
.image-viewer img { display: block; width: 100%; max-height: calc(100vh - 132px); object-fit: contain; border-radius: 12px; }
.download-button { display: flex; align-items: center; justify-content: center; width: max-content; margin: 10px auto 0; padding: 0 18px; text-decoration: none; }
.reminder-copy { margin-bottom: 17px; padding: 16px; border: 1px solid #edc68a; border-radius: 14px; background: #fff6df; color: #704700; }
.reminder-copy strong { display: block; margin-bottom: 9px; line-height: 1.55; }
.reminder-copy p { margin: 5px 0 0; font-size: .82rem; line-height: 1.55; }
.reminder-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.complaint-dialog { width: min(760px, calc(100% - 24px)); }
.complaint-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.complaint-summary div { min-width: 0; padding: 11px; border-radius: 11px; background: #f3f6f9; }
.complaint-summary span { display: block; margin-bottom: 3px; color: var(--muted); font-size: .72rem; }
.complaint-summary strong { display: block; overflow-wrap: anywhere; font-size: .85rem; }
.complaint-photo-section { display: grid; gap: 13px; margin-bottom: 16px; }
.complaint-photo-section section { min-width: 0; }
.complaint-photo-section h3 { margin-bottom: 8px; font-size: .88rem; }
.complaint-photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.complaint-photo-grid img { width: 100%; aspect-ratio: 1; border-radius: 9px; background: #edf2f6; object-fit: cover; }
.complaint-photo-empty { grid-column: 1 / -1; margin: 0; padding: 12px; border: 1px dashed #c7d3df; border-radius: 10px; color: var(--muted); font-size: .76rem; text-align: center; }
.privacy-note { margin-bottom: 15px; padding: 13px 14px; border: 1px solid #edc68a; border-radius: 12px; background: #fff8e8; color: #704700; }
.privacy-note strong { display: block; margin-bottom: 4px; font-size: .84rem; }
.privacy-note p { margin: 0; font-size: .76rem; line-height: 1.55; }
.check-field { display: flex; align-items: center; gap: 8px; width: fit-content; }
.check-field input { width: 20px; min-height: 20px; }

@media (min-width: 720px) {
  .app-header { padding-inline: 32px; }
  .app-shell { padding: 30px 28px 112px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .results-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .yearly-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 13px; }
  .photo-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .complaint-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .complaint-photo-section { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-nav { left: 50%; right: auto; bottom: 18px; width: min(560px, calc(100% - 40px)); padding: 7px; border: 1px solid var(--line); border-radius: 18px; transform: translateX(-50%); box-shadow: var(--shadow); }
}

@media (max-width: 520px) {
  .inventory-warning { align-items: stretch; flex-direction: column; }
  .results-controls { grid-template-columns: 1fr; }
  .warning-button { width: 100%; }
  .product-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .status-editor { grid-template-columns: 1fr; }
  .status-editor .secondary-button { width: 100%; }
  .product-toolbar label { width: 100%; }
  .product-toolbar > span { padding-bottom: 0; }
  .product-search-panel { grid-template-columns: 1fr; }
  .product-detail-filters { grid-column: 1; }
  .filter-grid { grid-template-columns: 1fr; }
  .reminder-actions { grid-template-columns: 1fr; }
  .complaint-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preset-row { grid-template-columns: minmax(0, 1fr) auto; }
  .preset-row > label:first-child { grid-column: 1 / -1; }
  .preset-active { grid-column: 1; }
  .preset-row > .delete-preset-button { grid-column: 2; }
  .preset-panel .panel-heading .secondary-button { min-width: 100px; font-size: .78rem; }
  .preset-panel .panel-heading { align-items: stretch; flex-direction: column; }
  .panel-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .panel-actions .secondary-button { width: 100%; }
  .milestone-setting-row { grid-template-columns: 1fr; }
  .milestone-setting-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1020px) {
  .metric-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

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