:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #d8dce3;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --accent: #0f766e;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-title { font-size: 18px; margin: 0; flex-shrink: 0; }
.header-menu { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* ハンバーガー（モバイルのみ表示） */
.hamburger {
  display: none; position: relative;
  border: 1.5px solid var(--primary); background: #fff; color: var(--primary-d);
  width: 44px; height: 40px; border-radius: 8px; font-size: 20px; line-height: 1; cursor: pointer;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.menu-dot { position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; }

/* 目立つヘッダーボタン（クリックできると一目で分かる） */
.nav-btn {
  position: relative;
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary-d);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: background .12s, box-shadow .12s, transform .05s;
  white-space: nowrap;
  min-width: 88px;
  text-align: center;
}
.nav-btn:hover { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(37,99,235,.3); }
.nav-btn:active { transform: translateY(1px); }
/* 承認待ち件数バッジ（ナビボタンの右上に赤丸で表示・点滅で目立たせる） */
.nav-badge {
  position: absolute; top: -8px; right: -8px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--danger); color: #fff;
  border-radius: 10px; font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
  animation: badge-pulse 1.4s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 0 rgba(220,38,38,.55); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 2px #fff, 0 0 0 7px rgba(220,38,38,0); }
}
@media (prefers-reduced-motion: reduce) { .nav-badge { animation: none; } }
/* ログアウトは控えめ（グレー） */
.nav-btn-plain { border-color: var(--border); color: var(--muted); font-weight: 500; }
.nav-btn-plain:hover { background: var(--muted); color: #fff; box-shadow: none; }

/* 使い方パネル */
.help-panel { border-color: var(--primary); }
.help-lead { font-size: 14px; margin: 0 0 14px; line-height: 1.7; }
.help-step-head { font-size: 14px; margin: 18px 0 8px; }
.help-text { font-size: 13px; line-height: 1.8; margin: 0 0 8px; }
.help-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.9; }
.help-steps li { margin-bottom: 6px; }
.help-sep { border: none; border-top: 1px dashed var(--border); margin: 18px 0 4px; }

.callout { border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.callout .callout-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.callout ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.8; }
.callout-warn { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; }
.callout-cost { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }
.callout-check { background: #fef2f2; border: 1.5px solid #f87171; color: #991b1b; font-size: 13px; line-height: 1.8; }
.callout-check .callout-title { font-size: 15px; }

/* アップロード上部のバナー */
.upload-banner {
  background: #fff7ed; border: 1px solid #fdba74; color: #9a3412;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; line-height: 1.7; margin-bottom: 14px;
}
.upload-banner .banner-cost {
  display: inline-block; margin-left: 8px; background: #065f46; color: #fff;
  border-radius: 12px; padding: 2px 10px; font-size: 12px; white-space: nowrap;
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.panel h2 { font-size: 16px; margin: 0 0 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.sub-head { font-size: 13px; color: var(--muted); margin: 16px 0 6px; }
.hidden { display: none !important; }
.view-off { display: none !important; }
.view-nav { display: inline-flex; gap: 4px; margin-right: 6px; }

/* ボタン */
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row-divider { display: inline-block; width: 1px; height: 20px; background: #d1d5db; margin: 0 6px; vertical-align: middle; }
.draft-status { margin-left: 8px; color: #6b7280; font-size: 12px; }

/* 設定 */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.settings-grid label, .add-category {
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted);
}
.settings-grid input, .settings-grid select, #new-category {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 14px; color: var(--text);
}
.categories-editor { margin-top: 16px; }
.categories-editor h3 { font-size: 13px; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef2ff; color: var(--primary-d);
  border-radius: 14px; padding: 4px 10px; font-size: 13px;
}
.chip button { border: none; background: none; cursor: pointer; color: var(--primary-d); font-size: 14px; line-height: 1; }
.add-category { flex-direction: row; align-items: center; gap: 8px; }
.note { color: var(--muted); font-size: 12px; margin: 12px 0 0; line-height: 1.6; }
/* 提出後ロックの帯 */
.editor-lock-banner { border-radius: 10px; padding: 12px 16px; margin: 0 0 14px; font-size: 14px; line-height: 1.7; border: 1.5px solid; }
.editor-lock-banner.locked { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.editor-lock-banner.rejected { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
/* ロック中は編集セクションを読み取り専用に（操作不可＋見た目で示す） */
.editor-locked .lockable { position: relative; opacity: .6; pointer-events: none; user-select: none; filter: grayscale(.15); }
.editor-locked .lockable::after { content: "🔒 提出済み（読み取り専用）"; position: absolute; top: 8px; right: 10px; background: #9a3412; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; pointer-events: none; }
/* 使い方の埋め込み動画（レスポンシブ・16:9） */
.howto-video { margin: 12px 0 0; }
.howto-video-title { font-size: 13px; font-weight: 700; color: var(--primary-d, #1e3a8a); cursor: pointer; margin: 0 0 6px; list-style: none; }
.howto-video-title::-webkit-details-marker { display: none; }
.howto-video-title::before { content: "▶ "; font-size: 11px; }
.howto-video[open] .howto-video-title::before { content: "▼ "; }
.video-embed { position: relative; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* パネル冒頭のリード文（説明より一回り大きく・読みやすく） */
.panel-lead { color: var(--text); font-size: 15px; font-weight: 600; line-height: 1.7; }
/* 入力欄ラベルのリード文（少し大きめ） */
.field-lead { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
/* ログイン画面のシステム名 */
.login-brand { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--primary-d, #1e3a8a); letter-spacing: .02em; }
.panel-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ドロップゾーン */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  transition: background .15s, border-color .15s;
}
.dropzone.drag { background: #eef4ff; border-color: var(--primary); }
.dropzone .hint { font-size: 12px; margin-top: 10px; }
.upload-status { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-chip .chip-remove { border: none; background: none; color: var(--danger); font-size: 16px; cursor: pointer; line-height: 1; padding: 0 2px; }

/* AIで分析する（目立つボタン） */
.analyze-bar { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dz-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.transit-links { margin-top: 8px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; }
.transit-links-label { width: 100%; margin-bottom: 2px; font-weight: 600; }
.transit-links a {
  flex: 1 1 180px; max-width: 280px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  margin: 0; padding: 9px 18px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  font-weight: 700; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.transit-links a::after { content: "↗"; font-size: 12px; opacity: .9; }
.transit-links a:hover { background: var(--primary-d); box-shadow: 0 3px 8px rgba(37,99,235,.35); }
.transit-links a:active { transform: translateY(1px); }

/* 交通系IC: 読み取り・切り分けの作業画面 */
.modal.crop-modal { max-width: min(1040px, 96vw); width: 100%; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.crop-modal h2, .crop-modal > .note, .crop-modal .crop-step1, .crop-modal .crop-toolbar, .crop-modal .panel-actions, .crop-modal > .howto-video { flex: 0 0 auto; }
/* モーダル内の動画はやや小さめ＆余白詰めて作業領域を確保 */
.crop-modal > .howto-video { margin: 4px 0 8px; }
.crop-modal > .howto-video .video-embed { max-width: 480px; }
.crop-modal .panel-actions { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.crop-step1 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eef4ff; border: 1px solid #c7d8f5; border-radius: 8px; padding: 10px 12px; margin: 8px 0;
}
.crop-step1.done { background: #ecfdf3; border-color: #b6e6c8; }
.crop-step-num {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%; background: #1e3a8a; color: #fff; font-weight: 700; font-size: 13px;
}
.crop-step1 .hint { margin: 0; }
.crop-empty { color: var(--muted, #6b7280); line-height: 1.6; font-size: 12px; }
.crop-toolbar { display: flex; align-items: center; gap: 12px; margin: 8px 0; font-size: 13px; flex-wrap: wrap; }
.crop-snap { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #374151; cursor: pointer; user-select: none; }
.crop-snap input { margin: 0; }
.crop-count-msg { font-size: 12px; font-weight: 600; }
.crop-count-msg.ok { color: #166534; }
.crop-count-msg.miss { color: #b91c1c; }
.crop-body { display: flex; gap: 14px; align-items: stretch; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.crop-stage { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); background: #f7f8fa; }
.crop-wrap { position: relative; width: 100%; }
.crop-wrap img { display: block; width: 100%; user-select: none; -webkit-user-drag: none; }
.crop-stage { touch-action: pan-y; }
.crop-lines { position: absolute; inset: 0; }
.crop-line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed #dc2626; cursor: row-resize; touch-action: none; }
/* タッチ/マウスでつかみやすいよう、線の上下に透明な当たり判定を広げる */
.crop-line::before { content: ""; position: absolute; left: 0; right: 0; top: -9px; height: 18px; }
.crop-line .crop-x {
  position: absolute; right: 4px; top: -10px; background: #dc2626; color: #fff;
  font-size: 11px; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; cursor: pointer;
}
.crop-seg-tag {
  position: absolute; left: 6px; display: inline-flex; align-items: center; gap: 3px;
  background: #1e3a8a; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px; transform: translateY(-50%);
  pointer-events: auto; user-select: none; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.crop-seg-tag.is-excluded { background: #b91c1c; cursor: pointer; }
.crop-seg-tag .seg-no-lab { opacity: .85; }
.crop-seg-tag .seg-no-input {
  width: 38px; text-align: center; font-weight: 700; font-size: 12px;
  border: none; border-radius: 3px; padding: 1px 2px; -moz-appearance: textfield; background: #fff; color: #1e3a8a;
}
.crop-seg-tag .seg-no-input.is-new { background: #fff7ed; color: #c2410c; outline: 2px solid #fb923c; }
.crop-seg-tag .seg-no-input::-webkit-outer-spin-button,
.crop-seg-tag .seg-no-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.crop-seg-tag .seg-ex {
  cursor: pointer; background: rgba(255,255,255,.25); color: #fff; border-radius: 50%;
  width: 15px; height: 15px; line-height: 15px; text-align: center; font-size: 10px;
}
.crop-seg-tag .seg-ex:hover { background: #dc2626; }
/* 除外区画の網掛け（視覚のみ） */
.crop-seg-excluded {
  position: absolute; left: 0; right: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(185,28,28,.16) 0 8px, rgba(185,28,28,.30) 8px 16px);
  border-top: 1px solid rgba(185,28,28,.55); border-bottom: 1px solid rgba(185,28,28,.55);
}
.crop-legend-head { margin-bottom: 8px; font-weight: 700; color: #374151; }
.crop-foot { flex-wrap: wrap; align-items: center; }
.crop-foot-spacer { flex: 1 1 auto; }
.crop-legend { width: 186px; flex: 0 0 auto; min-height: 0; font-size: 12px; overflow: auto; }
.crop-legend .seg-ok { color: #166534; font-size: 12px; line-height: 1.4; margin-bottom: 2px; }
.crop-legend .seg-miss { color: #b91c1c; font-size: 12px; line-height: 1.4; margin-bottom: 2px; }
.crop-prev-entry { margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.crop-prev-canvas { display: block; margin-top: 4px; border: 1px solid var(--border); border-radius: 4px; width: 100%; max-width: 160px; height: auto; cursor: zoom-in; }
/* プレビュー拡大ポップアップ */
.crop-zoom {
  position: fixed; z-index: 320; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 18px 56px rgba(0,0,0,.38); padding: 10px;
  pointer-events: none; max-width: 94vw; max-height: 88vh;
}
.crop-zoom.hidden { display: none; }
.crop-zoom canvas { display: block; border-radius: 6px; max-width: 100%; }
.crop-zoom-cap { font-size: 13px; font-weight: 700; color: #1e3a8a; margin: 0 0 8px; }
@media (max-width: 680px) {
  /* 交通系の作業画面: スマホでは画面いっぱい＋画像を大きく表示し、操作ボタンは下に固定 */
  .modal.crop-modal { max-width: 100vw; width: 100%; max-height: 96vh; overflow-y: auto; padding: 14px 12px; }
  .crop-modal h2 { font-size: 16px; }
  .crop-modal > .note { font-size: 12px; line-height: 1.6; }
  .crop-body { flex-direction: column; flex: 0 0 auto; overflow: visible; gap: 10px; }
  .crop-stage { flex: 0 0 auto; height: 56vh; }
  .crop-legend { width: 100%; flex: 0 0 auto; max-height: none; border-top: 1px solid var(--border); padding-top: 8px; }
  .crop-modal > .howto-video .video-embed { max-width: 100%; }
  .crop-toolbar { gap: 8px 12px; }
  /* 操作ボタン（AIで照合・割り当て・閉じる）をモーダル下部に貼り付けて常に押せるように */
  .crop-modal .panel-actions.crop-foot {
    position: sticky; bottom: 0; z-index: 5;
    background: var(--panel); margin: 8px -12px -14px; padding: 12px;
  }
  .crop-foot .btn { flex: 1 1 auto; }
}
.btn-analyze {
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #fff; border: none; border-radius: 10px;
  padding: 14px 28px; font-size: 17px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 18px rgba(37,99,235,.35);
  animation: analyze-pulse 1.6s ease-in-out infinite;
}
.btn-analyze:hover { filter: brightness(1.06); }
.btn-analyze:active { transform: translateY(1px); }
.btn-analyze:disabled { opacity: .55; cursor: not-allowed; animation: none; box-shadow: none; }
.analyze-hint { font-size: 13px; color: var(--muted); }
@keyframes analyze-pulse { 0%,100% { box-shadow: 0 6px 18px rgba(37,99,235,.3); } 50% { box-shadow: 0 6px 26px rgba(37,99,235,.55); } }
.thumb-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px;
}
.thumb-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.thumb-chip .st-processing { color: var(--primary); }
.thumb-chip .st-error { color: var(--danger); }
.thumb-chip .st-done { color: var(--accent); }

/* テーブル */
.table-wrap { overflow-x: auto; }
.edit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.edit-table th, .edit-table td {
  border: 1px solid var(--border); padding: 4px 6px; text-align: left; vertical-align: middle;
}
.edit-table th { background: #f7f8fa; font-weight: 600; white-space: nowrap; }
.edit-table td input, .edit-table td select {
  width: 100%; border: none; background: transparent; font-size: 13px; padding: 4px; color: var(--text);
}
.edit-table td input:focus, .edit-table td select:focus { outline: 2px solid var(--primary); border-radius: 4px; }
/* テキストセル: 通常は1行（省略）、フォーカスで上下に広がり全文表示 */
.edit-table td textarea.cell-grow {
  width: 100%; border: none; background: transparent; font-size: 13px; font-family: inherit;
  color: var(--text); padding: 4px; resize: none; overflow: hidden; line-height: 1.4;
  height: 1.9em; white-space: nowrap; box-sizing: border-box;
}
.edit-table td textarea.cell-grow.expanded {
  white-space: pre-wrap; overflow: auto; outline: 2px solid var(--primary);
  border-radius: 4px; background: #fff; position: relative; z-index: 4;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 220px;
}
.edit-table td.col-no { text-align: center; width: 46px; color: var(--muted); }
.edit-table td.col-no .no-input {
  width: 40px; text-align: center; padding: 4px 2px; font-weight: 700; color: var(--text, #111);
  border: 1px solid var(--border); border-radius: 5px; -moz-appearance: textfield;
}
.edit-table td.col-no .no-input::-webkit-outer-spin-button,
.edit-table td.col-no .no-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.edit-table td.col-no .no-input.dup { border-color: var(--danger, #dc2626); background: #fef2f2; color: var(--danger, #dc2626); }
.edit-table td.col-amount input { text-align: right; }
.edit-table td.col-receipt img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; cursor: pointer; }
.edit-table .row-loading td { color: var(--muted); font-style: italic; }
.del-row { color: var(--danger); border: none; background: none; cursor: pointer; font-size: 16px; }
.total-badge {
  background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 20px;
  font-size: 15px; font-weight: 600;
}

.edit-table tr.row-error td { background: #fef2f2; }

/* 海外照合 */
.overseas-slots { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 14px; }
.ov-slot {
  flex: 1; min-width: 220px; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.ov-slot.drag { background: #eef4ff; border-color: var(--primary); }
.ov-label { font-size: 13px; font-weight: 600; }
.ov-hint { font-size: 11px; color: var(--muted); }
.ov-name { font-size: 12px; color: var(--muted); word-break: break-all; }
.ov-name.ready { color: var(--accent); }
/* 選択済みファイルの一覧（長い場合は省略）＋クリアボタン */
.ov-name .ov-files { display: block; max-height: 3.6em; overflow: hidden; line-height: 1.2; }
.ov-name .ov-clear {
  margin-top: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer;
  background: #fff; color: #6b7280; border: 1px solid #d1d5db; border-radius: 6px;
}
.ov-name .ov-clear:hover { background: #f3f4f6; color: #374151; }

/* モーダル */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; padding: 24px; max-width: 520px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.confirm-summary { font-size: 14px; line-height: 1.9; }
.confirm-summary .big { font-size: 20px; font-weight: 700; color: var(--accent); }
.confirm-warnings { margin: 12px 0; }
.confirm-warnings .warn-box {
  background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; padding: 10px 12px;
  font-size: 13px; color: #9a3412;
}
.confirm-warnings .warn-box ul { margin: 6px 0 0; padding-left: 18px; }
.confirm-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 14px 0 4px; line-height: 1.5; }

/* 重複確認 */
.dup-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.dup-row { display: flex; align-items: center; gap: 8px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.dup-row .dup-note { color: var(--muted); font-size: 12px; }

/* ログイン */
.login-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; margin: 6px 0;
}
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* 行追加ボタン */
#btn-add-row, #btn-add-sub-row { margin-top: 8px; }

/* 問題報告 */
.report-text {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; resize: vertical; box-sizing: border-box;
}

/* あいさつバナー */
.greeting {
  background: linear-gradient(90deg, #eef4ff, #f0fdfa);
  border: 1px solid #c7d2fe; border-radius: 10px;
  padding: 14px 18px; font-size: 16px; font-weight: 600; color: #1e3a8a;
  display: flex; align-items: center; gap: 10px;
}
.greeting .greeting-emoji { font-size: 22px; flex: 0 0 auto; }
.greeting .greeting-text { flex: 1 1 auto; }
.greeting .greeting-char {
  flex: 0 0 auto;
  width: 92px; height: 92px; object-fit: contain;
  margin: -18px 0 -18px 8px; /* バナーから少しはみ出して可愛く見せる */
  transform-origin: bottom center;
  animation: greeting-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.12));
}
@keyframes greeting-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-6px) rotate(2deg); }
}
@media (max-width: 560px) { .greeting .greeting-char { width: 64px; height: 64px; } }
@media (prefers-reduced-motion: reduce) { .greeting .greeting-char { animation: none; } }

/* AI分析中のキャラクター演出 */
.analyzing-box {
  background: #fff; border-radius: 16px; padding: 28px 36px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); max-width: 360px;
}
.analyzing-char { width: 180px; height: 180px; display: flex; align-items: center; justify-content: center;
  animation: char-bob 1.4s ease-in-out infinite; }
.analyzing-char img { width: 100%; height: 100%; object-fit: contain; }
.analyzing-char .analyzing-fallback { font-size: 80px; display: none; }
.analyzing-char.no-img img { display: none; }
.analyzing-char.no-img .analyzing-fallback { display: block; animation: char-spin 2s linear infinite; }
.analyzing-text { font-size: 20px; font-weight: 700; color: #1f2430; letter-spacing: .08em; }
.analyzing-sub { font-size: 13px; color: var(--muted); min-height: 18px; }
.analyzing-dots { display: flex; gap: 8px; }
.analyzing-dots span {
  width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.analyzing-dots span:nth-child(2) { animation-delay: .2s; }
.analyzing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes char-bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}
@keyframes char-spin { to { transform: rotate(360deg); } }
@keyframes dot-pulse {
  0%, 100% { transform: scale(.6); opacity: .4; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* 申請情報バー */
.reqinfo-panel { background: #f8fafc; }
.reqinfo { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.reqinfo .ri { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.reqinfo .ri input {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: 14px; color: var(--text);
}
.reqinfo .ri-applicant-field input {
  font-weight: 600; min-width: 180px;
}
.reqinfo .ri-applicant-field input[readonly] { background: #eef2ff; color: var(--primary-d); cursor: default; }
.reqinfo .ri input[type="number"] { width: 90px; }

/* テーブル操作ボタン */
.btn-move, .btn-del, .btn-cred, .btn-edit-user {
  border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 3px 8px;
  font-size: 11px; cursor: pointer; white-space: nowrap; margin: 1px;
}
.btn-move:hover { background: #eef2ff; border-color: var(--primary); color: var(--primary-d); }
.btn-edit-user { color: var(--primary-d, #1e3a8a); border-color: #c7d2fe; background: #eef2ff; }
.btn-edit-user:hover { background: #dbe4ff; border-color: var(--primary, #4f46e5); }
/* 不具合報告カード */
.report-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 6px 0; background: #fff; }
.report-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.report-when { font-size: 12px; color: var(--muted); }
.report-who { font-size: 13px; font-weight: 700; }
.report-who small { color: var(--muted); font-weight: 400; }
.report-body { font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.btn-del:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.btn-cred { color: #166534; border-color: #b6e6c8; background: #f0fdf4; }
.btn-cred:hover { background: #dcfce7; border-color: #16a34a; }
.col-receipt .rc-none { color: #cbd5e1; font-size: 12px; }
.col-receipt .rc-pages { display: block; font-size: 10px; color: var(--muted); text-align: center; }
/* 切り分け済み画像（横長・数行）は、日付列が見えるよう左寄せの横長サムネで表示 */
.edit-table td.col-receipt img.is-crop {
  width: 92px; height: 30px; object-fit: cover; object-position: left center;
  border: 1px solid var(--border);
}
.col-receipt .rc-crop {
  display: inline-block; margin-top: 2px; font-size: 10px; font-weight: 700;
  color: #166534; background: #ecfdf3; border: 1px solid #b6e6c8; border-radius: 4px; padding: 0 4px;
}

/* 提出 */
.btn-submit-strong {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff; border: none; border-radius: 12px;
  padding: 16px 36px; font-size: 18px; font-weight: 800; cursor: pointer;
  box-shadow: 0 8px 22px rgba(220,38,38,.4);
  letter-spacing: .04em;
  transition: filter .12s, transform .05s;
}
.btn-submit-strong:hover:not(:disabled) { filter: brightness(1.07); }
.btn-submit-strong:active:not(:disabled) { transform: translateY(1px); }
.btn-submit-strong:not(:disabled) { animation: submit-pulse 1.5s ease-in-out infinite; }
.btn-submit-strong:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; box-shadow: none; }
@keyframes submit-pulse { 0%,100% { box-shadow: 0 8px 22px rgba(220,38,38,.35); } 50% { box-shadow: 0 8px 30px rgba(220,38,38,.6); } }

/* 提出パネルの「PDFをダウンロード」。提出ボタンの横で目立つが、主役(提出)は邪魔しない配色 */
.btn-pdf-strong {
  background: #fff; color: #1d4ed8; border: 2px solid #2563eb; border-radius: 12px;
  padding: 14px 26px; font-size: 16px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 14px rgba(37,99,235,.18);
  letter-spacing: .02em; transition: filter .12s, transform .05s, background .12s;
}
.btn-pdf-strong:hover:not(:disabled) { background: #eff6ff; }
.btn-pdf-strong:active:not(:disabled) { transform: translateY(1px); }
.btn-pdf-strong:disabled { background: #e5e7eb; color: #9ca3af; border-color: #d1d5db; cursor: not-allowed; box-shadow: none; }

.submit-memo { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.submit-memo .memo-text { font-size: 13px; line-height: 1.8; margin: 0 0 8px; color: #334155; }

/* 承認印ボタン（PDF確認後に押せる赤い目立つボタン） */
.btn-stamp {
  border: 2px solid #dc2626; color: #dc2626; background: #fff;
  border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
  margin: 1px; white-space: nowrap; transition: background .12s, box-shadow .12s;
}
.btn-stamp:disabled { opacity: .7; cursor: not-allowed; border-style: dashed; background: #fafafa; color: #9ca3af; }
.btn-stamp.stamp-ready { background: #dc2626; color: #fff; border-style: solid; box-shadow: 0 0 0 3px rgba(220,38,38,.18); animation: stamp-pulse 1.4s ease-in-out infinite; }
.btn-stamp.stamp-ready:hover { background: #b91c1c; }
@keyframes stamp-pulse { 0%,100%{ box-shadow: 0 0 0 3px rgba(220,38,38,.15);} 50%{ box-shadow: 0 0 0 6px rgba(220,38,38,.28);} }
.btn-undo { border-color: #f59e0b; color: #b45309; }
.btn-undo:hover { background: #fffbeb; }
#inbox-table td .btn, #inbox-table td .btn-stamp { margin: 1px; }

/* チャットワーク用コピペ */
.chatwork-box {
  margin: 12px 0 16px; background: #eff6ff; border: 1.5px solid #93c5fd;
  border-radius: 10px; padding: 12px 14px;
}
.chatwork-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 15px; font-weight: 700; color: #1e40af; margin-bottom: 8px;
}
.btn-copy {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 6px rgba(37,99,235,.3);
}
.btn-copy:hover { background: var(--primary-d); }
.btn-copy:active { transform: translateY(1px); }
.chatwork-text {
  width: 100%; border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 12px;
  font-size: 14px; line-height: 1.7; background: #fff; resize: vertical; box-sizing: border-box;
  font-family: inherit; color: var(--text);
}

/* 決済状況 */
.overview-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.overview-controls .ri { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.overview-controls input { padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; width: 90px; font-size: 14px; }
.overview-summary { font-size: 14px; font-weight: 600; color: var(--accent); }
#overview-table td .btn { margin: 1px; }

/* 一括追加の結果テーブル */
.bulk-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.bulk-table th, .bulk-table td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.bulk-table th { background: #f7f8fa; }

/* ユーザーバー */
.user-bar { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; }
.user-name { font-size: 13px; color: var(--text); font-weight: 600; }

/* 履歴 / ユーザー一覧 */
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px;
}
.history-row .h-period { font-weight: 600; min-width: 110px; }
.history-row .h-total { min-width: 90px; text-align: right; color: var(--accent); }
.history-row .h-status { color: var(--muted); flex: 1; }
.history-row small { color: var(--muted); font-weight: 400; }
.history-row .h-period { min-width: 56px; }
.history-row.row-current { background: #eef4ff; border-color: #c7d2fe; }

/* 履歴アコーディオン（年ごとに開閉） */
.acc-group { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: #f7f8fa; border: none; cursor: pointer;
  padding: 11px 14px; font-size: 14px; text-align: left;
}
.acc-head:hover { background: #eef2ff; }
.acc-caret { display: inline-block; transition: transform .15s; color: var(--muted); font-size: 11px; }
.acc-head.open .acc-caret { transform: rotate(90deg); }
.acc-title { font-weight: 700; }
.acc-meta { color: var(--muted); font-size: 12px; margin-left: auto; }
.acc-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.acc-body.hidden { display: none; }

/* AI経費分析 */
.analysis-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.analysis-status { font-size: 13px; color: var(--accent); font-weight: 600; }
.analysis-options { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.analysis-options .ri-range { display: inline-flex; gap: 10px; align-items: flex-end; }
.analysis-options .ri { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.analysis-options input[type="month"] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; }
.analysis-note-field { display: block; margin: 8px 0; font-size: 12px; color: var(--muted); }
.analysis-note-field textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; resize: vertical; font-family: inherit; }
.analysis-data { margin: 8px 0 4px; }
.analysis-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.analysis-report-block { margin-top: 14px; }
.analysis-report {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px;
  background: #fcfcfd; font-size: 14px; line-height: 1.8;
}
.analysis-report h4.an-h { font-size: 15px; margin: 14px 0 6px; color: #1e3a8a; }
.analysis-report h4.an-h:first-child { margin-top: 0; }
.analysis-report ul { margin: 6px 0; padding-left: 20px; }
.analysis-report li { margin: 3px 0; }
.analysis-report p { margin: 8px 0; }
.analysis-report .analysis-meta { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .analysis-tables { grid-template-columns: 1fr; } }

/* 領収書ホバー拡大プレビュー */
.img-preview {
  position: fixed; z-index: 300; pointer-events: none;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); padding: 6px;
}
.img-preview img { display: block; max-width: 46vw; max-height: 82vh; border-radius: 4px; }
/* スマホ長押し時は画面中央に大きく表示 */
.img-preview.preview-center img { max-width: 92vw; max-height: 80vh; }
.col-receipt img { cursor: zoom-in; }
.greeting .greeting-char { cursor: zoom-in; }

/* AIモデル選択 */
.model-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.model-pick select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); }

/* トースト */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 14px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* ===== 印刷／PDF用レイアウト ===== */
/* 画面では枠外に置き、html2canvasのソースとして使う */
#print-area {
  position: absolute;
  left: -10000px;
  top: 0;
}
.sheet {
  width: 794px;         /* A4縦 210mm @96dpi */
  min-height: 1123px;   /* A4縦 297mm @96dpi */
  background: #fff;
  color: #000;
  padding: 40px 44px;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.sheet + .sheet { page-break-before: always; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.doc-head-left { flex: 1; min-width: 0; }
.doc-head .doc-title { text-align: left; margin: 0 0 14px; }
/* 申請情報は縦に積み、ラベル幅を揃える。値が途中で折り返さないように nowrap */
.doc-head .doc-meta { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0; align-items: flex-start; }
.doc-approvals { display: flex; gap: 0; }
.appr-box { width: 92px; height: 84px; border: 1px solid #333; border-left: none; display: flex; flex-direction: column; }
.appr-box:first-child { border-left: 1px solid #333; }
.appr-box .appr-role { font-size: 10px; text-align: center; border-bottom: 1px solid #333; padding: 2px 0; background: #eaeef5; white-space: nowrap; }
.appr-box .appr-name { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.appr-box .appr-date { font-size: 10px; text-align: center; color: #444; padding-bottom: 3px; }
.appr-box.appr-stamped .appr-name { color: #b91c1c; }

.doc-title { text-align: center; font-size: 26px; font-weight: 700; margin: 0 0 18px; letter-spacing: .3em; }
.doc-title-cont { font-size: 18px; letter-spacing: .15em; margin-bottom: 12px; }
.doc-meta { font-size: 13.5px; }
.doc-meta span { white-space: nowrap; }
.doc-meta span b { display: inline-block; min-width: 4.5em; margin-right: 8px; font-weight: 600; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.doc-table th, .doc-table td { border: 1px solid #333; padding: 5px 6px; word-break: break-word; overflow-wrap: anywhere; vertical-align: top; }
.doc-table th { background: #eaeef5; text-align: center; }
.doc-table td.t-no { text-align: center; }
.doc-table td.t-amount { text-align: right; white-space: nowrap; }
/* 縦A4向けの列幅配分（№/日付/内容/支払先/目的/金額/備考） */
.doc-table col.c-no { width: 5%; }
.doc-table col.c-date { width: 12%; }
.doc-table col.c-cat { width: 11%; }
.doc-table col.c-payee { width: 19%; }
.doc-table col.c-purpose { width: 19%; }
.doc-table col.c-amount { width: 12%; }
.doc-table col.c-note { width: 22%; }
.doc-section-label { margin: 16px 0 6px; font-size: 13px; font-weight: 600; }
.doc-total { text-align: right; font-size: 16px; font-weight: 700; margin-top: 14px; }
.doc-notes { margin-top: 18px; font-size: 12px; color: #333; line-height: 1.8; }
.doc-no-expense { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: .35em; color: #1e3a8a; border: 2.5px solid #1e3a8a; border-radius: 8px; padding: 16px 0; margin: 10px 0 18px; }

/* 領収書ページ（A4縦） */
.receipt-grid { display: grid; gap: 16px; width: 100%; flex: 1; min-height: 0; }
.receipt-grid.per-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.receipt-grid.per-2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.receipt-grid.per-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.receipt-cell { border: 1px solid #ccc; padding: 8px; display: flex; flex-direction: column; min-height: 0; }
.receipt-cell .r-label { font-size: 14px; font-weight: 700; margin-bottom: 6px; flex: 0 0 auto; }
/* 画像はアスペクト比を保ったまま枠内に収める（html2canvasはobject-fit非対応のため max-* で制御）*/
.receipt-cell .r-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.receipt-cell .r-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.receipt-cell .r-label .r-no {
  display: inline-block; background: #1e3a8a; color: #fff;
  border-radius: 5px; padding: 1px 9px; margin-right: 6px;
  font-size: 15px; font-weight: 800; letter-spacing: .02em;
}

/* ===== スマホ・タブレット対応（レスポンシブ） ===== */
@media (max-width: 760px) {
  body { font-size: 13px; }
  .app-header { padding: 10px 12px; gap: 8px; position: relative; flex-wrap: nowrap; }
  .app-title { font-size: 15px; line-height: 1.3; }
  .hamburger { display: inline-flex; }
  .nav-btn { min-width: 0; padding: 10px 12px; font-size: 14px; }
  /* ヘッダーメニューをドロップダウン化（ハンバーガーで開閉） */
  .header-menu {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 8px;
    background: var(--panel); border-bottom: 1px solid var(--border);
    padding: 12px; box-shadow: 0 10px 24px rgba(0,0,0,.16);
  }
  .app-header.menu-open .header-menu { display: flex; }
  .header-menu > .nav-btn { width: 100%; text-align: left; }
  .header-menu .view-nav:not(.hidden) { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
  .header-menu .view-nav .nav-btn { width: 100%; text-align: left; }
  .header-menu .user-bar:not(.hidden) { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
  .header-menu .user-name { padding: 2px 4px; font-weight: 700; }
  /* バナーのコスト注記は折り返す（はみ出し防止） */
  .upload-banner .banner-cost { display: block; white-space: normal; margin: 8px 0 0; }

  .app-main { padding: 14px 12px 60px; gap: 14px; }
  .panel { padding: 14px 12px; }

  /* あいさつバナー：文字を折り返し、キャラは小さめ */
  .greeting { padding: 10px 12px; font-size: 14px; }

  /* 申請情報：縦に積む */
  .reqinfo { gap: 10px; }
  .reqinfo .ri { width: 100%; }
  .reqinfo .ri input,
  .reqinfo .ri-applicant-field input,
  .reqinfo .ri input[type="number"] { width: 100%; }

  /* AI分析バー・各種操作列は折り返す */
  .analyze-bar { gap: 8px; }
  .panel-actions { flex-wrap: wrap; }

  /* 海外照合スロットは縦積み */
  .overseas-slots { flex-direction: column; }
  .overseas-slots > * { width: 100%; }

  /* 編集テーブルは横スクロール（列が潰れないよう最小幅を確保） */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .edit-table { min-width: 760px; }
  #inbox-table, #overview-table, .bulk-table { min-width: 640px; }

  /* ログイン枠の余白を圧縮 */
  .login-box, .modal { padding: 18px 16px; }
}

@media (max-width: 480px) {
  .app-title { font-size: 14px; }
  .greeting .greeting-char { width: 56px; height: 56px; margin: -10px 0 -10px 6px; }
}

/* 印刷時（A4縦） */
@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { position: static; left: 0; }
  .sheet { width: 100%; min-height: auto; padding: 0; page-break-after: always; }
  .sheet:last-child { page-break-after: auto; }
  .receipt-grid { height: auto; }
  .receipt-cell { break-inside: avoid; }
  .receipt-cell .r-img { display: block; }
  .receipt-cell .r-img img { max-height: 90vh; max-width: 100%; width: auto; height: auto; }
}
