:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans JP", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f7f7f7;
  color: #26203a;
  --accent: #f33535;
  --accent-dark: #c9182b;
  --blue: #246bfe;
  --green: #19a866;
  --yellow: #ffd740;
  --cream: #f7f7f7;
  --ink: #26203a;
  --muted: #6b6380;
  --line: #d9d5cc;
  --soft-line: #e7dcc6;
  --surface: #ffffff;
  --success-bg: #dff7eb;
  --success: #087246;
  --warn-bg: #fff1a8;
  --warn: #775100;
  --error-bg: #ffe2dd;
  --error: #b51f2c;
  --shadow: 0 10px 28px rgba(38, 32, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #ffffff 0, #f7f7f7 360px, #f5f5f5 100%);
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(38, 32, 58, 0.12);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(38, 32, 58, 0.14);
  background: #ff385c;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(243, 53, 53, 0.22);
}

h1 {
  font-size: clamp(16px, 3.8vw, 22px);
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.layout {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.result-panel {
  min-height: 430px;
}

body:not(.is-uploading-receipt) .compact-upload-panel {
  display: none;
}

body.is-uploading-receipt .compact-upload-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-height: auto;
  padding: 16px 18px;
  background: #e4efff;
}

body.is-uploading-receipt .result-panel {
  grid-column: 1 / -1;
}

.section-title {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 760;
}

.badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.muted {
  background: #ffffff;
  color: var(--muted);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.error {
  background: var(--error-bg);
  color: var(--error);
}

.topbar-actions .badge {
  background: #dff7eb;
}

.version-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.settings-menu {
  position: relative;
  margin-left: auto;
}

.settings-menu summary {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  list-style: none;
}

.settings-menu summary::-webkit-details-marker {
  display: none;
}

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(260px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(38, 32, 58, 0.16);
}

.settings-field {
  margin-bottom: 0;
}

.settings-panel .button {
  width: 100%;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
  font-weight: 600;
  box-shadow: none;
}

select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 107, 254, 0.12);
}

.compact-upload-panel p {
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.orientation-progress {
  width: min(100%, 320px);
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(36, 107, 254, 0.22);
  border-radius: 8px;
  background: #eef5ff;
  color: var(--ink);
}

.floating-orientation-progress {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 76px);
  z-index: 19;
  width: min(320px, calc(100vw - 36px));
  margin-top: 0;
  box-shadow: 0 12px 28px rgba(38, 32, 58, 0.16);
}

.orientation-progress[hidden] {
  display: none;
}

.orientation-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}

.orientation-progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(36, 107, 254, 0.14);
}

.orientation-progress-track span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.button {
  min-height: 44px;
  border: 1px solid rgba(38, 32, 58, 0.16);
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: #ffffff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  box-shadow: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(38, 32, 58, 0.10);
}

.button.primary {
  width: 100%;
  border-color: transparent;
  color: #ffffff;
  background: #ff385c;
  text-shadow: none;
}

.button.primary:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.button.secondary {
  min-width: 108px;
  border-color: rgba(38, 32, 58, 0.12);
  color: var(--ink);
  background: #dbe9ff;
}

.button.disabled {
  color: var(--muted);
  cursor: not-allowed;
  background: #f2efe8;
}

.button.secondary:hover,
.button.icon:hover {
  box-shadow: 0 8px 18px rgba(38, 32, 58, 0.10);
}

.button.icon {
  min-height: 34px;
  border-color: rgba(38, 32, 58, 0.12);
  color: var(--ink);
  background: var(--yellow);
}

.result-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(38, 32, 58, 0.24);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 700;
}

#result {
  display: grid;
  gap: 14px;
}

.result-deck {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.result-deck::after {
  content: "横にスワイプ";
  justify-self: center;
  display: none;
  padding: 5px 11px;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 999px;
  background: #e4efff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.result-deck.is-swipeable::after {
  display: inline-flex;
}

.result-track {
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 84%);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 4px;
  padding: 0 4px 8px;
  -webkit-overflow-scrolling: touch;
}

.result-track::-webkit-scrollbar {
  height: 8px;
}

.result-track::-webkit-scrollbar-track {
  background: #eeeeee;
  border: 0;
  border-radius: 999px;
}

.result-track::-webkit-scrollbar-thumb {
  background: rgba(38, 32, 58, 0.28);
  border: 0;
  border-radius: 999px;
}

.result-card,
.queue-card {
  width: 100%;
}

.result-card {
  scroll-snap-align: center;
  align-self: start;
  padding: 0;
  border: 1px solid rgba(38, 32, 58, 0.08);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(38, 32, 58, 0.08);
  overflow: hidden;
}

.receipt-preview {
  margin: 0;
  display: grid;
  gap: 0;
}

.receipt-preview img {
  width: 100%;
  height: clamp(108px, 18vh, 152px);
  display: block;
  border: 0;
  border-radius: 0;
  background: #f4f4f4;
  object-fit: cover;
  box-shadow: none;
  cursor: zoom-in;
}

.receipt-preview img {
  transform: rotate(var(--preview-rotation, 0deg));
  transition: transform 0.18s ease;
}

.receipt-preview figcaption {
  min-height: 0;
  padding: 7px 14px 0;
  justify-self: stretch;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview {
  min-height: 160px;
  align-content: center;
  justify-items: center;
  border: 0;
  border-radius: 0;
  background: #f4fbff;
  box-shadow: none;
}

.file-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 32, 58, 0.16);
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
  box-shadow: none;
}

.result-card:last-child {
  padding-bottom: 0;
  border-bottom: 1px solid rgba(38, 32, 58, 0.08);
}

.card-summary {
  display: grid;
  gap: 6px;
  padding: 8px 14px 10px;
}

.card-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.card-status {
  color: var(--accent-dark);
  font-weight: 700;
}

.card-summary-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 14px;
}

.card-amount {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 760;
  white-space: nowrap;
}

.card-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
}

.card-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: right;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.account-change summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  list-style-position: inside;
}

.account-search-field {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(38, 32, 58, 0.18);
  border-radius: 8px;
  padding: 0 9px;
  background: #ffffff;
  color: var(--ink);
}

.account-search-field svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.account-search-input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.account-current {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.account-quick-list,
.account-search-results {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.account-choice-button {
  width: 100%;
  min-height: 38px;
  display: grid;
  justify-items: start;
  border: 1px solid rgba(38, 32, 58, 0.14);
  border-radius: 8px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.account-choice-button span {
  font-size: 13px;
  font-weight: 800;
}

.account-choice-button.is-selected {
  border-color: var(--blue);
  background: #eef5ff;
}

.correction-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 12px 10px;
  padding: 10px;
  border: 1px solid rgba(132, 92, 0, 0.24);
  border-radius: 8px;
  background: var(--warn-bg);
}

.correction-panel label {
  display: grid;
  gap: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.correction-panel input,
.choice-panel select,
.card-payment-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(38, 32, 58, 0.18);
  border-radius: 8px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.card-payment-field {
  display: grid;
  gap: 5px;
  margin: 8px 14px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.card-payment-field select {
  min-height: 38px;
  font-size: 13px;
}

.quick-add {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 18;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.quick-add label {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 32, 58, 0.14);
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(38, 32, 58, 0.18);
  cursor: pointer;
}

.quick-add input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.quick-add-main {
  width: 62px;
  height: 62px;
  background: var(--accent);
  color: #ffffff;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.quick-add-secondary {
  width: 44px;
  height: 44px;
  background: #ffffff;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

.warning-list {
  display: grid;
  gap: 4px;
}

.warning-list p {
  margin: 0;
}

.detail-open {
  width: calc(100% - 28px);
  min-height: 34px;
  margin: 0 14px 14px;
  border: 1px solid rgba(38, 32, 58, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.image-lightbox {
  width: min(94vw, 760px);
  max-height: 88svh;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

.image-lightbox::backdrop {
  background: rgba(18, 16, 30, 0.72);
  backdrop-filter: blur(4px);
}

.image-lightbox-panel {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.image-lightbox-panel .button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
}

.image-lightbox img {
  width: 100%;
  max-height: 76svh;
  object-fit: contain;
  border-radius: 10px;
  background: #f5f5f5;
}

.image-lightbox p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.detail-modal {
  width: min(92vw, 560px);
  max-height: min(88svh, 760px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.detail-modal::backdrop {
  background: rgba(18, 16, 30, 0.48);
  backdrop-filter: blur(4px);
}

.detail-modal-panel {
  max-height: min(88svh, 760px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(38, 32, 58, 0.22);
}

.detail-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(38, 32, 58, 0.10);
}

.detail-modal-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.detail-modal-head strong {
  color: var(--ink);
  font-size: 15px;
}

.detail-modal-head span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-modal-body {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

.detail-section {
  display: grid;
  gap: 8px;
}

.detail-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.detail-raw {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(38, 32, 58, 0.10);
  border-radius: 8px;
  background: #fafafa;
  font-size: 11px;
  white-space: pre-wrap;
}

.loading-card {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 10px 28px rgba(38, 32, 58, 0.10);
}

.loading-card .receipt-preview {
  width: min(100%, 340px);
  margin-bottom: 2px;
}

.loading-card .receipt-preview img {
  height: 180px;
}

.loading-card small {
  color: var(--muted);
  font-weight: 800;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #eeeeee;
  border-top-color: #ff385c;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

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

.kv {
  display: grid;
  grid-template-columns: minmax(92px, 132px) minmax(0, 1fr);
  gap: 0;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}

.kv dt,
.kv dd {
  min-height: 34px;
  padding: 8px 10px;
  border-bottom: 1px solid #eeeeee;
}

.kv dt {
  background: #fafafa;
  color: var(--muted);
  font-weight: 700;
}

.kv dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.kv dt:nth-last-of-type(1),
.kv dd:nth-last-of-type(1) {
  border-bottom: 0;
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.audit-row {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(38, 32, 58, 0.10);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(38, 32, 58, 0.06);
}

.audit-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.mono {
  color: var(--muted);
}

.audit-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.audit-main strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.audit-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.audit-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.audit-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.audit-status.success {
  background: var(--success-bg);
  color: var(--success);
}

.audit-status.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.audit-status.error {
  background: var(--error-bg);
  color: var(--error);
}

.audit-status.muted {
  background: #eeeeee;
  color: var(--muted);
}

.audit-delete {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(181, 31, 44, 0.18);
  background: #fff1f1;
  color: var(--error);
  font-size: 12px;
}

.log-toggle {
  min-height: 38px;
}

.audit-footer-actions {
  position: sticky;
  bottom: -1px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px -16px -16px;
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(38, 32, 58, 0.10);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.process-log-row {
  box-shadow: 0 6px 16px rgba(38, 32, 58, 0.04);
}

.audit-empty {
  padding: 18px;
  border: 1px dashed rgba(38, 32, 58, 0.18);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

pre.mono {
  margin: 0;
  white-space: pre-wrap;
}

.setup-card {
  min-height: 320px;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(38, 32, 58, 0.12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.setup-card h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.setup-card p {
  color: var(--muted);
  line-height: 1.6;
}

.setup-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff7dd;
}

.setup-list dt,
.setup-list dd {
  margin: 0;
}

.setup-list dt {
  color: var(--muted);
  font-weight: 800;
}

.review-action {
  box-sizing: border-box;
  width: calc(100% - 28px);
  max-width: calc(100% - 28px);
  min-height: 42px;
  margin: 8px 14px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
}

.review-note {
  margin: 6px 14px 0;
  padding: 8px 10px;
  border: 1px solid rgba(132, 92, 0, 0.16);
  border-radius: 10px;
  background: #fff7dc;
  color: #6f5200;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.review-note.success {
  background: var(--success-bg);
  color: var(--success);
}

.choice-panel {
  display: grid;
  gap: 6px;
  margin: 8px 12px 0;
}

.choice-panel summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.choice-panel summary svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.choice-panel label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.choice-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: -2px 0 2px;
}

.choice-panel select {
  min-height: 40px;
  border-width: 1px;
  box-shadow: none;
  font-size: 13px;
}

.freee-entry-fields {
  margin: 8px 14px 0;
  padding: 10px;
  border: 1px solid rgba(38, 32, 58, 0.10);
  border-radius: 10px;
  background: #ffffff;
}

.freee-entry-fields[open] {
  gap: 9px;
}

.freee-entry-fields label {
  display: grid;
  gap: 5px;
}

.item-shortcut-button {
  min-height: 34px;
  justify-self: start;
  padding: 0 12px;
  font-size: 12px;
}

.payment-settled-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.payment-settled-control input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.freee-entry-fields textarea {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  border: 1px solid rgba(38, 32, 58, 0.16);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.account-change {
  margin: 6px 14px 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.account-change[open] {
  display: grid;
  gap: 8px;
}

.next-camera-action {
  box-sizing: border-box;
  width: calc(100% - 28px);
  max-width: calc(100% - 28px);
  min-height: 40px;
  margin: 8px 14px 4px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
}

.queue-next-camera-action {
  width: min(100%, 260px);
  max-width: 260px;
  margin: 4px 0 0;
}

@media (max-width: 800px) {
  .topbar {
    position: sticky;
    align-items: center;
    flex-direction: row;
    padding: 10px 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .layout {
    width: min(100% - 24px, 640px);
    grid-template-columns: 1fr;
    padding: 16px 0;
  }

  .panel {
    padding: 18px;
    box-shadow: var(--shadow);
  }

  .result-panel {
    min-height: auto;
  }

  body.is-uploading-receipt .compact-upload-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .kv {
    grid-template-columns: 1fr;
    font-size: 12px;
  }

  .kv dt {
    min-height: 26px;
    padding: 6px 8px 2px;
    border-bottom: 0;
  }

  .kv dd {
    min-height: 30px;
    padding: 2px 8px 7px;
  }

  .result-track {
    grid-auto-columns: minmax(252px, 88%);
  }

  .receipt-preview img {
    height: clamp(140px, 24vh, 220px);
  }

  .audit-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
